|
|
|
@ -11,11 +11,15 @@ class ASOptionTile extends StatelessWidget {
|
|
|
|
|
///单个Widget
|
|
|
|
|
final Widget item;
|
|
|
|
|
|
|
|
|
|
///内边距
|
|
|
|
|
final EdgeInsetsGeometry padding;
|
|
|
|
|
|
|
|
|
|
///item 推荐使用`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile`
|
|
|
|
|
ASOptionTile({Key key, this.items, this.item}) : super(key: key);
|
|
|
|
|
ASOptionTile({Key key, this.items, this.item, this.padding})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
///单个子组件的Tile
|
|
|
|
|
ASOptionTile.single({Key key, @required this.item})
|
|
|
|
|
ASOptionTile.single({Key key, @required this.item, this.padding})
|
|
|
|
|
: items = [],
|
|
|
|
|
super(key: key);
|
|
|
|
|
|
|
|
|
@ -23,21 +27,24 @@ class ASOptionTile extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Material(
|
|
|
|
|
color: kForegroundColor,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(5.w),
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: this.padding ?? EdgeInsets.fromLTRB(10.w, 10.w, 10.w, 0),
|
|
|
|
|
child: Material(
|
|
|
|
|
color: kForegroundColor,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(5.w),
|
|
|
|
|
),
|
|
|
|
|
child: item ??
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(length * 2 - 1, (index) {
|
|
|
|
|
final displayIndex = index ~/ 2;
|
|
|
|
|
if (index.isEven)
|
|
|
|
|
return items[displayIndex];
|
|
|
|
|
else
|
|
|
|
|
return ASDivider(indent: 14.w, endIndent: 14.w);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: item ??
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(length * 2 - 1, (index) {
|
|
|
|
|
final displayIndex = index ~/ 2;
|
|
|
|
|
if (index.isEven)
|
|
|
|
|
return items[displayIndex];
|
|
|
|
|
else
|
|
|
|
|
return ASDivider(indent: 14.w, endIndent: 14.w);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|