From 264fb000b3cc3b82122102768c9d146b6bb58db0 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 20 Jul 2021 17:27:52 +0800 Subject: [PATCH] update as tiles --- lib/list_tile/as_edit_tile.dart | 26 +++++++++++++++++++------- lib/list_tile/as_option_tile.dart | 18 +++++++++++------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/list_tile/as_edit_tile.dart b/lib/list_tile/as_edit_tile.dart index 874cef5..417dd1a 100644 --- a/lib/list_tile/as_edit_tile.dart +++ b/lib/list_tile/as_edit_tile.dart @@ -14,6 +14,7 @@ class ASEditTile extends StatelessWidget { final List? inputFormatters; final TextInputType? keyBoardType; final TextStyle? hintTextStyle; + final Widget? suffix; ASEditTile({ Key? key, this.title, @@ -23,13 +24,16 @@ class ASEditTile extends StatelessWidget { this.onChange, this.onSubmitted, this.inputFormatters, - this.keyBoardType, this.hintTextStyle, + this.keyBoardType, + this.hintTextStyle, + this.suffix, }) : super(key: key); @override Widget build(BuildContext context) { return ConstrainedBox( constraints: BoxConstraints(minHeight: 46.w), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ 10.wb, InkWell( @@ -41,12 +45,15 @@ class ASEditTile extends StatelessWidget { child: title ?? Text(''), ), ), - prefix ?? SizedBox(), + Offstage( + offstage: prefix == null, + child: prefix, + ), Expanded( child: TextField( controller: controller, onChanged: onChange, - inputFormatters:inputFormatters, + inputFormatters: inputFormatters, keyboardType: keyBoardType, onSubmitted: onSubmitted, textAlign: TextAlign.end, @@ -60,14 +67,19 @@ class ASEditTile extends StatelessWidget { isDense: true, contentPadding: EdgeInsets.zero, hintText: hintText, - hintStyle:hintTextStyle?? TextStyle( - color: kTextSubColor, - fontSize: 14.sp, - ), + hintStyle: hintTextStyle ?? + TextStyle( + color: kTextSubColor, + fontSize: 14.sp, + ), ), ), ), 10.wb, + Offstage( + offstage: suffix == null, + child: suffix, + ) ], ), ); diff --git a/lib/list_tile/as_option_tile.dart b/lib/list_tile/as_option_tile.dart index 8b308ba..5b00f68 100644 --- a/lib/list_tile/as_option_tile.dart +++ b/lib/list_tile/as_option_tile.dart @@ -15,6 +15,7 @@ class ASOptionTile extends StatelessWidget { final EdgeInsetsGeometry? padding; ///标题 + ///leading!=null 时 items!=null 是必要的 final dynamic leading; ///item 推荐使用`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile` @@ -36,13 +37,16 @@ class ASOptionTile extends StatelessWidget { Container( alignment: Alignment.centerLeft, child: this.leading is String - ? Text( - this.leading, - style: TextStyle( - color: kTextColor, - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ) + ? Padding( + padding:EdgeInsets.symmetric(vertical: 14.w,horizontal: 10.w), + child: Text( + this.leading, + style: TextStyle( + color: kTextColor, + fontSize: 16.sp, + fontWeight: FontWeight.bold), + ), + ) : this.leading, ), );