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.
88 lines
2.6 KiB
88 lines
2.6 KiB
4 years ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/services.dart';
|
||
|
import 'package:fluttertoast/fluttertoast.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({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: "修改用户名",
|
||
|
titleColor: Colors.black,
|
||
|
leadingColor: Colors.black,
|
||
|
background: Colors.white,
|
||
|
action: Container(
|
||
|
alignment: Alignment.center,
|
||
|
margin: EdgeInsets.only(right: 16),
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
String name = _controller.text;
|
||
|
if(name != null && name != "") {
|
||
|
Navigator.of(context).pop(name);
|
||
|
} else {
|
||
|
Fluttertoast.showToast(msg: "请输入用户名");
|
||
|
}
|
||
|
},
|
||
|
child: Text(
|
||
|
"保存",
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontSize: 18,
|
||
|
fontWeight: FontWeight.bold),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
body: 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,
|
||
|
color: Color(0xFF32A060),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|