From cb89a828199adc04bbfe98809e9e3b2b61379945 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 9 Dec 2020 11:49:51 +0800 Subject: [PATCH] update list tile --- example/lib/example_listtile.dart | 31 +++++++++++++++++++++++-------- lib/list_tile/as_list_tile.dart | 20 +++++++++++++++----- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/example/lib/example_listtile.dart b/example/lib/example_listtile.dart index 3af0c62..c0ea301 100644 --- a/example/lib/example_listtile.dart +++ b/example/lib/example_listtile.dart @@ -23,16 +23,31 @@ class _ExampleListTileState extends State { ASOptionTile( items: [ ASListTile( - title: '转单号(UPS)', - text: 'DFADN2329TNAGA', - trail: Placeholder(), + title: '转单号(UPS)', + text: 'DFADN2329TNAGA', + trail: InkWell( + onTap: () {}, + child: SizedBox( + width: 20.w, + height: 20.w, + child: Placeholder(), + ), ), - ASListTile( - title: '订单编号', - text: - 'DDAWMFOAGNAIOWNGOANIWOGNAOWIDJAWIOHFA92474Y2798489TY892YH8G67TGT2UBF29GB8298H42897YH472H', - // trail: Icon(Icons.ac_unit_outlined), + ), + ASListTile( + title: '订单编号', + text: + 'DDAWMFOAGNAIOWNGOANIWOGNAOWIDJAWIOHFA92474Y2798489TY892YH8G67TGT2UBF29GB8298H42897YH472H', + // trail: Icon(Icons.ac_unit_outlined), + ), + ASListTile.option( + title: '分类管理', + text: '分类管理', + trail: InkWell( + onTap: () {}, + child: SizedBox(width: 20.w,height: 32.w,), ), + ), ], ), 20.hb, diff --git a/lib/list_tile/as_list_tile.dart b/lib/list_tile/as_list_tile.dart index e83c546..5025cf2 100644 --- a/lib/list_tile/as_list_tile.dart +++ b/lib/list_tile/as_list_tile.dart @@ -12,8 +12,8 @@ class ASListTile extends StatefulWidget { ///内容 final Widget trail; - ///宽度,默认332px - final double width; + ///高度,默认32px + final double height; ///对齐方式 final CrossAxisAlignment crossAxisAlignment; @@ -22,10 +22,17 @@ class ASListTile extends StatefulWidget { this.title, this.text, this.trail, - this.width, + this.height, this.crossAxisAlignment, }) : super(key: key); - + ASListTile.option({ + Key key, + this.title, + this.text, + this.trail, + }) : height = 32.w, + crossAxisAlignment = CrossAxisAlignment.center, + super(key: key); @override _ASListTileState createState() => _ASListTileState(); } @@ -34,7 +41,10 @@ class _ASListTileState extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.symmetric(vertical: 8.w, horizontal: 10.w), + margin: widget.height == null + ? EdgeInsets.symmetric(vertical: 8.w, horizontal: 10.w) + : EdgeInsets.symmetric(horizontal: 10.w), + height: widget.height, alignment: Alignment.centerLeft, child: Row( crossAxisAlignment: