From e68c86022764352aa3f3e4bc61f26758c5129f0d Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 26 Nov 2020 16:54:01 +0800 Subject: [PATCH] add as edit tile --- lib/list_tile/as_edit_tile.dart | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/list_tile/as_edit_tile.dart b/lib/list_tile/as_edit_tile.dart index 751205e..de09dfe 100644 --- a/lib/list_tile/as_edit_tile.dart +++ b/lib/list_tile/as_edit_tile.dart @@ -4,7 +4,15 @@ import 'package:ansu_ui/ansu_ui.dart'; class ASEditTile extends StatefulWidget { final Widget title; final FocusNode node; - ASEditTile({Key key, this.title, this.node}) : super(key: key); + final String hintText; + final TextEditingController controller; + ASEditTile({ + Key key, + this.title, + this.node, + this.hintText, + @required this.controller, + }) : super(key: key); @override _ASEditTileState createState() => _ASEditTileState(); @@ -14,7 +22,7 @@ class _ASEditTileState extends State { FocusNode _node; @override Widget build(BuildContext context) { - return InkWell( + return GestureDetector( onTap: () { if (widget.node != null) { widget.node?.requestFocus(); @@ -27,16 +35,19 @@ class _ASEditTileState extends State { child: Row( children: [ 10.wb, - DefaultTextStyle( - style: TextStyle( - color: Colors.black.withOpacity(0.65), - fontSize: 14.sp, + InkWell( + child: DefaultTextStyle( + style: TextStyle( + color: Colors.black.withOpacity(0.65), + fontSize: 14.sp, + ), + child: widget.title ?? Text(''), ), - child: widget.title ?? Text(''), ), Expanded( child: TextField( focusNode: widget.node ?? _node, + controller: widget.controller, textAlign: TextAlign.end, style: TextStyle( fontSize: 14.sp, @@ -47,7 +58,7 @@ class _ASEditTileState extends State { border: InputBorder.none, isDense: true, contentPadding: EdgeInsets.zero, - hintText: 'awd', + hintText: widget.hintText, hintStyle: TextStyle( color: kTextSubColor, fontSize: 14.sp,