You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.9 KiB
94 lines
2.9 KiB
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 EditName extends StatefulWidget { |
|
final Map<String, dynamic> arguments; |
|
|
|
EditName({required this.arguments}); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _EditName(); |
|
} |
|
} |
|
|
|
class _EditName extends State<EditName> { |
|
TextEditingController _controller = TextEditingController(); |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return Scaffold( |
|
appBar: MyAppBar( |
|
title: S.of(context).xiugaiyonghuming, |
|
titleColor: Colors.black, |
|
leadingColor: Colors.black, |
|
background: Colors.white, |
|
action: Container( |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only(right: 16.w), |
|
child: GestureDetector( |
|
onTap: () { |
|
String name = _controller.text; |
|
if (name != "") { |
|
Navigator.of(context).pop(name); |
|
} else { |
|
SmartDialog.showToast("请输入用户名", alignment: Alignment.center); |
|
} |
|
}, |
|
child: Text( |
|
S.of(context).baocun, |
|
style: TextStyle( |
|
color: Colors.black, |
|
fontSize: 18.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( |
|
style: TextStyle( |
|
height: 1.h, |
|
fontSize: 16.sp, |
|
), |
|
onChanged: (value) {}, |
|
controller: _controller, |
|
keyboardType: TextInputType.text, |
|
decoration: InputDecoration( |
|
errorBorder: InputBorder.none, |
|
focusedBorder: InputBorder.none, |
|
enabledBorder: InputBorder.none, |
|
hintText: widget.arguments['nick'], |
|
// contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12), |
|
hintStyle: TextStyle( |
|
fontSize: 10.sp, |
|
color: Color(0xFFA29E9E), |
|
), |
|
), |
|
textInputAction: TextInputAction.next, |
|
inputFormatters: [LengthLimitingTextInputFormatter(10)], |
|
maxLines: 1, |
|
), |
|
Container( |
|
height: 1.h, |
|
color: Color(0xFF32A060), |
|
), |
|
], |
|
), |
|
), |
|
), |
|
); |
|
} |
|
}
|
|
|