|
|
|
@ -6,7 +6,6 @@ import '../../api/api_client.dart';
|
|
|
|
|
import '../../api/api_client_info.dart';
|
|
|
|
|
import '../../common_widget/app_data.dart';
|
|
|
|
|
import '../../view_model/home_view_model.dart';
|
|
|
|
|
import '../../view/main_tab_view/main_tab_view.dart';
|
|
|
|
|
|
|
|
|
|
class UserInfo extends StatefulWidget {
|
|
|
|
|
const UserInfo({super.key});
|
|
|
|
@ -37,17 +36,7 @@ class _UserInfoState extends State<UserInfo> {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
leading: IconButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// 返回到 MainTabView 并切换到“个人”标签页
|
|
|
|
|
Get.back(); // 关闭当前页面并返回到主界面
|
|
|
|
|
|
|
|
|
|
// 等待页面关闭后再切换标签
|
|
|
|
|
Future.delayed(Duration(milliseconds: 100), () {
|
|
|
|
|
// 查找 MainTabView 并获取 TabController
|
|
|
|
|
final mainTabController = Get.find<MainTabView>().getController(context);
|
|
|
|
|
if (mainTabController != null) {
|
|
|
|
|
mainTabController.index = 3; // 切换到“个人”标签页的索引
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Get.back(result: true);
|
|
|
|
|
},
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
"assets/img/back.png",
|
|
|
|
@ -171,7 +160,7 @@ class _UserInfoState extends State<UserInfo> {
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
|
|
|
|
builder: (context) => Container(
|
|
|
|
|
height: 132,
|
|
|
|
|
height: 80,
|
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
@ -208,21 +197,6 @@ class _UserInfoState extends State<UserInfo> {
|
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 18),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 18),
|
|
|
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.zero,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Text(
|
|
|
|
|
"取消",
|
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 18),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -245,7 +219,11 @@ class _UserInfoState extends State<UserInfo> {
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
_updateNickname();
|
|
|
|
|
await ChangeApiClient().changeName(
|
|
|
|
|
Authorization: AppData().currentToken,
|
|
|
|
|
userName: AppData().currentUsername);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
@ -256,16 +234,12 @@ class _UserInfoState extends State<UserInfo> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Text(
|
|
|
|
|
"取消",
|
|
|
|
|
"保存",
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
_updateNickname();
|
|
|
|
|
await ChangeApiClient().changeName(
|
|
|
|
|
Authorization: AppData().currentToken,
|
|
|
|
|
userName: AppData().currentUsername);
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
@ -276,7 +250,7 @@ class _UserInfoState extends State<UserInfo> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Text(
|
|
|
|
|
"保存",
|
|
|
|
|
"取消",
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|