diff --git a/lib/view/home_view.dart b/lib/view/home_view.dart index dde9209..8fd1806 100644 --- a/lib/view/home_view.dart +++ b/lib/view/home_view.dart @@ -231,7 +231,7 @@ class _HomeViewState extends State { ], ), ), - + const SizedBox(height: 10,), ///搜索 Container( padding: const EdgeInsets.only(left: 20, right: 20, top: 10), @@ -319,14 +319,16 @@ class _HomeViewState extends State { ), ), + const SizedBox(height: 10,), ///推荐+轮播图 Container( padding: const EdgeInsets.only(left: 20, right: 20, top: 10), child: const Text( '每日推荐', - style: TextStyle(fontSize: 22, fontWeight: FontWeight.w500), + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), ), ), + const SizedBox(height: 5,), Container( padding: const EdgeInsets.only(left: 20, right: 20, top: 5), height: 186, @@ -334,15 +336,18 @@ class _HomeViewState extends State { child: MySwiperWidget, ), + const SizedBox(height: 10), + ///精选歌曲 Container( alignment: Alignment.topLeft, padding: const EdgeInsets.only(left: 20, right: 20, top: 5), child: const Text( '精选歌曲', - style: TextStyle(fontSize: 22, fontWeight: FontWeight.w500), + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), ), ), + const SizedBox(height: 5,), ListView.builder( padding: EdgeInsets.zero, itemCount: selectedSongs.length, @@ -388,14 +393,16 @@ class _HomeViewState extends State { }, ), + const SizedBox(height: 10,), ///精选歌单 Container( padding: const EdgeInsets.only(left: 20, right: 20, top: 5), child: const Text( '精选歌单', - style: TextStyle(fontSize: 22, fontWeight: FontWeight.w500), + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), ), ), + const SizedBox(height: 5,), SizedBox( height: 180, child: ListView.builder( @@ -483,6 +490,7 @@ class _HomeViewState extends State { children: [ IconButton( onPressed: () { + Navigator.pop(context); Get.to(() => CommentView( initialSongIndex: index, )); diff --git a/lib/view/rank_view.dart b/lib/view/rank_view.dart index 25f04a8..b94bbf8 100644 --- a/lib/view/rank_view.dart +++ b/lib/view/rank_view.dart @@ -25,6 +25,7 @@ class _RankViewState extends State { final downloadManager = Get.put(DownloadManager()); + @override void initState() { super.initState(); _fetchSonglistData(); @@ -187,7 +188,7 @@ class _RankViewState extends State { child: RichText( text: TextSpan( text: rankNum.toString(), - style: TextStyle( + style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w700, color: Color(0xffCE0000), @@ -221,7 +222,7 @@ class _RankViewState extends State { Text( rankNames[index], maxLines: 1, - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 16, fontWeight: @@ -230,7 +231,7 @@ class _RankViewState extends State { Text( rankSingerName[index], maxLines: 1, - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 14), ) @@ -298,7 +299,7 @@ class _RankViewState extends State { icon: Image.asset("assets/img/list_add.png"), iconSize: 60, ), - Text("加入歌单") + const Text("加入歌单") ], ), Column( @@ -308,7 +309,7 @@ class _RankViewState extends State { icon: Image.asset("assets/img/list_download.png"), iconSize: 60, ), - Text("下载") + const Text("下载") ], ), Column( @@ -318,7 +319,7 @@ class _RankViewState extends State { icon: Image.asset("assets/img/list_collection.png"), iconSize: 60, ), - Text("收藏") + const Text("收藏") ], ), Column( @@ -328,17 +329,19 @@ class _RankViewState extends State { icon: Image.asset("assets/img/list_good.png"), iconSize: 60, ), - Text("点赞") + const Text("点赞") ], ), Column( children: [ IconButton( - onPressed: (){}, + onPressed: (){ + Navigator.pop(context); + }, icon: Image.asset("assets/img/list_comment.png"), iconSize: 60, ), - Text("评论") + const Text("评论") ], ), ], diff --git a/lib/view/user/user_info.dart b/lib/view/user/user_info.dart index 431c246..7f50453 100644 --- a/lib/view/user/user_info.dart +++ b/lib/view/user/user_info.dart @@ -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 { elevation: 0, leading: IconButton( onPressed: () { - // 返回到 MainTabView 并切换到“个人”标签页 - Get.back(); // 关闭当前页面并返回到主界面 - - // 等待页面关闭后再切换标签 - Future.delayed(Duration(milliseconds: 100), () { - // 查找 MainTabView 并获取 TabController - final mainTabController = Get.find().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 { 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 { 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 { ), actions: [ 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 { ), ), 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 { ), ), child: const Text( - "保存", + "取消", style: TextStyle(color: Colors.white), ), ), diff --git a/lib/view/user/user_view.dart b/lib/view/user/user_view.dart index b5d13b0..be2ef41 100644 --- a/lib/view/user/user_view.dart +++ b/lib/view/user/user_view.dart @@ -31,6 +31,8 @@ class _UserViewState extends State { List playlistNames = []; List playlistid = []; int downloadCount = 0; + String avatar = AppData().currentAvatar; + String username = AppData().currentUsername; final downloadManager = Get.put(DownloadManager()); @@ -85,7 +87,7 @@ class _UserViewState extends State { Row( children: [ Image.network( - AppData().currentAvatar, + avatar, width: 64, height: 64, ), @@ -93,7 +95,7 @@ class _UserViewState extends State { width: 25, ), Text( - AppData().currentUsername, + username, style: const TextStyle(fontSize: 20), ) ], @@ -424,8 +426,15 @@ class _UserViewState extends State { Column( children: [ IconButton( - onPressed: () { - Get.to(const UserInfo()); + onPressed: () async { + Navigator.pop(context); + bool result = await Get.to(const UserInfo()); + if (result) { + setState(() { + avatar = AppData().currentAvatar; + username = AppData().currentUsername; + }); + } }, icon: Image.asset("assets/img/user_infor.png"), iconSize: 60, @@ -437,6 +446,7 @@ class _UserViewState extends State { children: [ IconButton( onPressed: () async { + Navigator.pop(context); UniversalBean bean = await LogoutApiClient().logout( Authorization: AppData().currentToken, ); @@ -453,21 +463,6 @@ class _UserViewState extends State { ], ), const SizedBox(height: 30), - ElevatedButton( - onPressed: () => Navigator.pop(context), - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xff429482), - padding: const EdgeInsets.symmetric(vertical: 14), - tapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.zero, - ), - ), - child: const Text( - "取消", - style: TextStyle(color: Colors.black, fontSize: 18), - ), - ), ], ), ),