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