206 lines
6.2 KiB
Dart
206 lines
6.2 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:game/common/EventBusUtil.dart';
|
|
|
|
import '../../common/func.dart';
|
|
import '../../dialog/change_nickname_dialog.dart';
|
|
import 'me_model.dart';
|
|
|
|
class EditInfoPage extends StatefulWidget {
|
|
const EditInfoPage({super.key});
|
|
|
|
@override
|
|
State<EditInfoPage> createState() => _EditInfoPageState();
|
|
}
|
|
|
|
class _EditInfoPageState extends State<EditInfoPage> {
|
|
late StreamSubscription subscription;
|
|
final MeModel _viewModel = MeModel();
|
|
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
subscription = _viewModel.streamController.stream.listen((event) {
|
|
String code = event['code'];
|
|
if (code.isNotEmpty) {
|
|
switch (code) {
|
|
case "updateUserNickName":
|
|
EasyLoading.showToast("修改成功");
|
|
|
|
EventBusUtil.fire(RefreshUserdata());
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
// TODO: implement dispose
|
|
subscription.cancel();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFF17181A),
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
width: size.width,
|
|
height: 50,
|
|
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Text(
|
|
"编辑个人信息",
|
|
style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)),
|
|
),
|
|
Positioned(
|
|
left: 14,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: 19,
|
|
height: 26,
|
|
image: AssetImage('assets/images/btn_fanhui.png'),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 60,
|
|
margin: EdgeInsets.only(top: 18, left: 15, right: 15),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(11)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: 14),
|
|
child: Text(
|
|
"头像",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: 23),
|
|
child: Image(
|
|
width: 4,
|
|
height: 8,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 60,
|
|
margin: EdgeInsets.only(top: 18, left: 15, right: 15),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(11)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: 14),
|
|
child: Text(
|
|
"头像框",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: 23),
|
|
child: Image(
|
|
width: 4,
|
|
height: 8,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
FunctionUtil.popDialog(context, ChangeNicknameDialog(
|
|
onTap: (value) {
|
|
_viewModel.updateUserNickName(value);
|
|
},
|
|
));
|
|
},
|
|
child: Container(
|
|
height: 60,
|
|
margin: EdgeInsets.only(top: 18, left: 15, right: 15),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(11)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: 14),
|
|
child: Text(
|
|
"昵称",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: 23),
|
|
child: Image(
|
|
width: 4,
|
|
height: 8,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: 60,
|
|
margin: EdgeInsets.only(top: 18, left: 15, right: 15),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(11)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: 14),
|
|
child: Text(
|
|
"ID",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: 23),
|
|
child: Text(
|
|
"12345678",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|