flutter_select

一次学习Flutter的过程,一个简单的单选或者多选。

截图

截图

导入

flutter_sujian_select:^1.0.1
import 'package:flutter_sujian_select/flutter_select.dart';

##使用

单选

SelectGroup<int>(
              index:0,
              items: <SelectItem<int>>[
                SelectItem(label: '30天',value: 1),
                SelectItem(label: '60天',value: 2),
                SelectItem(label: '90天',value: 3),
              ],
              onSingleSelect: (int value){
              
              },
            ),

多选

SelectGroup<int>(
              type: SelectType.multiple,
              style: SelectStyle.rectangle,
              direction: SelectDirection.vertical,
              listIndex: [1,2],
              items: <SelectItem<int>>[
                SelectItem(label: '1',value: 1),
                SelectItem(label: '2',value: 2),
                SelectItem(label: '3',value: 3),
                SelectItem(label: '4',value: 4),
              ],
              onMultipleSelect: (List<int> value){
             
              },
            ),

属性说明

属性描述默认值
borderColor边框颜色Colors.blue
unSelectColor未选中背景颜色Colors.white
selectColor选中颜色Colors.blue
spaceitem之间的距离const EdgeInsets.all(0.0)
padding内边距const EdgeInsets.all(8.0)
isRepeatBorderLine是否去掉重复的线(矩形生效)false
type选择类型SelectType.single
styleitem风格SelectStyle.circular
direction排列方向SelectDirection.horizontal
index默认值(单选可用)null
listIndex默认值(多选可用)null
onSingleSelect单选回调(单选可用)null
onMultipleSelect多选回调(单选可用)null
items选项(必要)null

Libraries

flutter_sujian_select
select_group
select_item