update list tile

null_safety
张萌 4 years ago
parent 2c41a716e1
commit a38a8252d8

@ -14,12 +14,16 @@ class ASListTile extends StatefulWidget {
///332px
final double width;
///
final CrossAxisAlignment crossAxisAlignment;
ASListTile({
Key key,
this.title,
this.text,
this.trail,
this.width,
this.crossAxisAlignment,
}) : super(key: key);
@override
@ -33,7 +37,8 @@ class _ASListTileState extends State<ASListTile> {
margin: EdgeInsets.symmetric(vertical: 8.w),
alignment: Alignment.centerLeft,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
widget.crossAxisAlignment ?? CrossAxisAlignment.start,
children: [
Container(
width: 85.w,

@ -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);
}),
),
);
}
}

Loading…
Cancel
Save