import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class EditSignature extends StatefulWidget { final Map arguments; EditSignature({this.arguments}); @override State createState() { return _EditSignature(); } } class _EditSignature extends State { TextEditingController _controller = TextEditingController(); int textLength = 0; @override Widget build(BuildContext context) { return Scaffold( appBar: MyAppBar( title: S.of(context).gexingqianming, titleColor: Colors.black, leadingColor: Colors.black, action: Container( alignment: Alignment.center, margin: EdgeInsets.only(right: 16.w), child: GestureDetector( onTap: () { String signature = _controller.text; if (signature != null && signature != "") { Navigator.of(context).pop(signature); } else { SmartDialog.showToast("请输入个性签名~", alignment: Alignment.center); } }, child: Container( width: 46.w, height: 24.h, alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFF319E5F), borderRadius: BorderRadius.all(Radius.circular(4))), child: Text( S.of(context).baocun, style: TextStyle( color: Colors.white, fontSize: 14.sp, fontWeight: FontWeight.bold), ), ), ), ), ), body: GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child:Container( margin: EdgeInsets.all(16), child: Column( children: [ TextField( maxLines: 5, controller: _controller, keyboardType: TextInputType.text, onChanged: (value) { setState(() { textLength = value.length; }); }, maxLength: 50, decoration: InputDecoration( errorBorder: InputBorder.none, focusedBorder: InputBorder.none, enabledBorder: InputBorder.none, hintText: widget.arguments['signature'], // contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12), hintStyle: TextStyle( fontSize: 10.sp, color: Color(0xFFA29E9E), ), ), textInputAction: TextInputAction.next, ), Container( height: 1.h, color: Color(0xFFD8D8D8), ), ], ), )), ); } }