add as edit tile

null_safety
小赖 4 years ago
parent fc2c2d506c
commit e68c860227

@ -4,7 +4,15 @@ import 'package:ansu_ui/ansu_ui.dart';
class ASEditTile extends StatefulWidget { class ASEditTile extends StatefulWidget {
final Widget title; final Widget title;
final FocusNode node; 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 @override
_ASEditTileState createState() => _ASEditTileState(); _ASEditTileState createState() => _ASEditTileState();
@ -14,7 +22,7 @@ class _ASEditTileState extends State<ASEditTile> {
FocusNode _node; FocusNode _node;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return GestureDetector(
onTap: () { onTap: () {
if (widget.node != null) { if (widget.node != null) {
widget.node?.requestFocus(); widget.node?.requestFocus();
@ -27,16 +35,19 @@ class _ASEditTileState extends State<ASEditTile> {
child: Row( child: Row(
children: [ children: [
10.wb, 10.wb,
DefaultTextStyle( InkWell(
style: TextStyle( child: DefaultTextStyle(
color: Colors.black.withOpacity(0.65), style: TextStyle(
fontSize: 14.sp, color: Colors.black.withOpacity(0.65),
fontSize: 14.sp,
),
child: widget.title ?? Text(''),
), ),
child: widget.title ?? Text(''),
), ),
Expanded( Expanded(
child: TextField( child: TextField(
focusNode: widget.node ?? _node, focusNode: widget.node ?? _node,
controller: widget.controller,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -47,7 +58,7 @@ class _ASEditTileState extends State<ASEditTile> {
border: InputBorder.none, border: InputBorder.none,
isDense: true, isDense: true,
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
hintText: 'awd', hintText: widget.hintText,
hintStyle: TextStyle( hintStyle: TextStyle(
color: kTextSubColor, color: kTextSubColor,
fontSize: 14.sp, fontSize: 14.sp,

Loading…
Cancel
Save