|
|
|
@ -1,6 +1,12 @@
|
|
|
|
|
import 'package:aku_community_manager/const/api.dart';
|
|
|
|
|
import 'package:aku_community_manager/provider/user_provider.dart';
|
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
|
|
|
|
import 'package:aku_community_manager/utils/network/base_model.dart';
|
|
|
|
|
import 'package:aku_community_manager/utils/network/net_util.dart';
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
|
@ -27,6 +33,7 @@ class _NickNameChangePageState extends State<NickNameChangePage> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
UserProvider userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
return AkuScaffold(
|
|
|
|
|
title: '修改昵称',
|
|
|
|
|
body: Material(
|
|
|
|
@ -42,7 +49,7 @@ class _NickNameChangePageState extends State<NickNameChangePage> {
|
|
|
|
|
controller: _textEditingController,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
hintText: '',
|
|
|
|
|
hintText: '${userProvider.userInfoModel.nickName}',
|
|
|
|
|
hintStyle:
|
|
|
|
|
TextStyle(color: Color(0xFF999999), fontSize: 34.sp),
|
|
|
|
|
border: UnderlineInputBorder(
|
|
|
|
@ -54,9 +61,17 @@ class _NickNameChangePageState extends State<NickNameChangePage> {
|
|
|
|
|
),
|
|
|
|
|
150.w.heightBox,
|
|
|
|
|
MaterialButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// userProvider.setName(_textEditingController.text);
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
BaseModel baseModel = await NetUtil().get(
|
|
|
|
|
API.user.updateNickName,
|
|
|
|
|
params: {'nickName': _textEditingController.text});
|
|
|
|
|
|
|
|
|
|
if (baseModel.status == true) {
|
|
|
|
|
userProvider.setNickName(_textEditingController.text);
|
|
|
|
|
Get.back();
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: baseModel.message);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: '保存'.text.black.size(32.sp).make(),
|
|
|
|
|
color: Color(0xFFFFC40C),
|
|
|
|
|