update list tile

null_safety
张萌 4 years ago
parent 2c41a716e1
commit a38a8252d8

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

@ -11,11 +11,15 @@ class ASOptionTile extends StatelessWidget {
///Widget ///Widget
final Widget item; final Widget item;
///
final EdgeInsetsGeometry padding;
///item 使`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile` ///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 ///Tile
ASOptionTile.single({Key key, @required this.item}) ASOptionTile.single({Key key, @required this.item, this.padding})
: items = [], : items = [],
super(key: key); super(key: key);
@ -23,21 +27,24 @@ class ASOptionTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Padding(
color: kForegroundColor, padding: this.padding ?? EdgeInsets.fromLTRB(10.w, 10.w, 10.w, 0),
shape: RoundedRectangleBorder( child: Material(
borderRadius: BorderRadius.circular(5.w), 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