update ASOptionTile

null_safety
张萌 4 years ago
parent 097e95a381
commit 7f35b9007b

@ -59,6 +59,11 @@ class _ExampleListTileState extends State<ExampleListTile> {
child: TextField(),
),
),
20.hb,
ASOptionTile(
leading: '基础信息',
items: [],
),
],
),
);

@ -14,19 +14,40 @@ class ASOptionTile extends StatelessWidget {
///
final EdgeInsetsGeometry padding;
///
final dynamic leading;
///item 使`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile`
ASOptionTile({Key key, this.items, this.item, this.padding})
ASOptionTile({Key key, this.items, this.item, this.padding, this.leading})
: super(key: key);
///Tile
ASOptionTile.single({Key key, @required this.item, this.padding})
ASOptionTile.single(
{Key key, @required this.item, this.padding, this.leading})
: items = [],
super(key: key);
int get length => items.length;
@override
Widget build(BuildContext context) {
if (this.leading != null) {
this.items.insert(
0,
Container(
padding: EdgeInsets.fromLTRB(10.w, 10.w, 10.w, 10.w),
alignment: Alignment.centerLeft,
child: this.leading is String
? Text(
this.leading,
style: TextStyle(
color: kTextColor,
fontSize: 16.sp,
fontWeight: FontWeight.bold),
)
: this.leading,
),
);
}
return Material(
color: kForegroundColor,
shape: RoundedRectangleBorder(

Loading…
Cancel
Save