From ddba101ab21710f9a0f148f28bb7816c858785a8 Mon Sep 17 00:00:00 2001 From: canxin121 Date: Wed, 30 Oct 2024 10:37:36 +0800 Subject: [PATCH] [Test] try fix impeller empty padding [Update] update dependencies [Test] try fix ios safe area [Test] fix ios navigation bar --- .../db_music_agg_listview_page.dart | 262 ++- .../db_playlist_collection_page.dart | 57 +- .../db_playlist_gridview_page.dart | 261 ++- .../music_aggregator.dart | 196 +- .../online_music_agg_listview_page.dart | 387 ++-- .../online_playlist_gridview_page.dart | 74 +- lib/common_pages/setting_page.dart | 2043 +++++++++-------- lib/desktop/comps/control_bar.dart | 2 +- lib/desktop/comps/navigation_column.dart | 4 +- .../comps/popup_comp/volume_slider.dart | 5 +- lib/desktop/home.dart | 5 +- .../pages/explore_page/music_chart_page.dart | 65 +- .../pages/explore_page/playlist_tag_page.dart | 65 +- .../pages}/search_page/music_aggregator.dart | 52 +- .../pages}/search_page/playlist.dart | 54 +- lib/main.dart | 2 +- .../comps/play_display_comp/music_artpic.dart | 31 +- .../play_display_comp/music_control_bar.dart | 26 +- lib/mobile/home.dart | 3 +- lib/mobile/pages/explore_page.dart | 93 +- lib/mobile/pages/search_page.dart | 148 +- lib/src/rust/api/cache/cache_op.dart | 2 +- lib/src/rust/api/cache/file_cache.dart | 2 +- lib/src/rust/api/cache/music_cache.dart | 2 +- lib/src/rust/api/init.dart | 2 +- lib/src/rust/api/music_api/fns.dart | 2 +- lib/src/rust/api/music_api/mirror.dart | 2 +- lib/src/rust/api/music_api/plugin_fn.dart | 2 +- lib/src/rust/api/music_api/wrapper.dart | 2 +- lib/src/rust/api/types/config.dart | 2 +- lib/src/rust/api/types/external_api.dart | 2 +- lib/src/rust/api/types/playinfo.dart | 2 +- lib/src/rust/api/types/version.dart | 2 +- lib/src/rust/api/utils/crypto.dart | 2 +- lib/src/rust/api/utils/database.dart | 2 +- lib/src/rust/api/utils/http_helper.dart | 2 +- lib/src/rust/api/utils/path_util.dart | 2 +- lib/src/rust/frb_generated.dart | 4 +- lib/src/rust/frb_generated.io.dart | 2 +- lib/src/rust/frb_generated.web.dart | 2 +- lib/utils/chore.dart | 4 +- lib/utils/device_set.dart | 4 +- pubspec.lock | 4 +- pubspec.yaml | 2 +- rust/Cargo.lock | 100 +- rust/Cargo.toml | 14 +- rust/src/frb_generated.rs | 8 +- 47 files changed, 2108 insertions(+), 1903 deletions(-) rename lib/{common_pages => desktop/pages}/search_page/music_aggregator.dart (76%) rename lib/{common_pages => desktop/pages}/search_page/playlist.dart (76%) diff --git a/lib/common_pages/db_music_agg_listview_page.dart b/lib/common_pages/db_music_agg_listview_page.dart index a71c74e..6e68d79 100644 --- a/lib/common_pages/db_music_agg_listview_page.dart +++ b/lib/common_pages/db_music_agg_listview_page.dart @@ -130,136 +130,158 @@ class DbMusicContainerListPageState extends State final double screenWidth = MediaQuery.of(context).size.width; return CupertinoPageScaffold( - backgroundColor: backgroundColor, - navigationBar: CupertinoNavigationBar( - padding: const EdgeInsetsDirectional.only(end: 16), - backgroundColor: backgroundColor, - leading: CupertinoButton( - padding: const EdgeInsets.all(0), - child: Icon(CupertinoIcons.back, color: activeIconRed), - onPressed: () { - popPage(context, isDesktop); - }, - ), - middle: Text( - playlist.name, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - trailing: DbMusicListChoicMenu( - isDesktop: widget.isDesktop, - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), + backgroundColor: backgroundColor, + child: Column( + children: [ + CupertinoNavigationBar( + padding: const EdgeInsetsDirectional.only(end: 16), + backgroundColor: backgroundColor, + leading: CupertinoButton( + padding: const EdgeInsets.all(0), + child: Icon(CupertinoIcons.back, color: activeIconRed), + onPressed: () { + popPage(context, isDesktop); + }, + ), + middle: Text( + playlist.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + trailing: DbMusicListChoicMenu( + isDesktop: widget.isDesktop, + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed) + .useSystemChineseFont(), + )), + playlist: playlist, + musicAggs: musicAggs, )), - playlist: playlist, - musicAggs: musicAggs, - )), - child: CustomScrollView( - slivers: [ - MobilePlaylistHeader( - playlist: playlist, - musicAggregators: musicAggs, - isDarkMode: isDarkMode), - SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - bool isFirst = index == 0; - bool isLastItem = index == musicAggs.length - 1; + Expanded( + child: CustomScrollView( + slivers: [ + MobilePlaylistHeader( + playlist: playlist, + musicAggregators: musicAggs, + isDarkMode: isDarkMode), + SliverList( + delegate: SliverChildBuilderDelegate( + (context, index) { + bool isFirst = index == 0; + bool isLastItem = index == musicAggs.length - 1; - final musicAgg = musicAggs[index]; - return Column( - children: [ - if (isFirst) - const Padding(padding: EdgeInsets.only(top: 5)), - Padding( - padding: const EdgeInsets.only(top: 5, bottom: 5), - child: MobileMusicAggregatorListItem( - key: ValueKey(musicAgg.identity()), - musicAgg: musicAgg, - playlist: widget.playlist, - cacheCover: globalConfig.storageConfig.saveCover, - ), - ), - if (!isLastItem) - Center( - child: SizedBox( - width: screenWidth * 0.85, - child: Divider( - color: dividerColor, - height: 0.5, + final musicAgg = musicAggs[index]; + return Column( + children: [ + if (isFirst) + const Padding(padding: EdgeInsets.only(top: 5)), + Padding( + padding: const EdgeInsets.only(top: 5, bottom: 5), + child: MobileMusicAggregatorListItem( + key: ValueKey(musicAgg.identity()), + musicAgg: musicAgg, + playlist: widget.playlist, + cacheCover: globalConfig.storageConfig.saveCover, + ), ), - ), - ) - ], - ); - }, - childCount: musicAggs.length, - ), - ), - const SliverToBoxAdapter( - child: Padding( - padding: EdgeInsets.only(top: 200), - ), - ), - ], - ), - ); + if (!isLastItem) + Center( + child: SizedBox( + width: screenWidth * 0.85, + child: Divider( + color: dividerColor, + height: 0.5, + ), + ), + ) + ], + ); + }, + childCount: musicAggs.length, + ), + ), + const SliverToBoxAdapter( + child: Padding( + padding: EdgeInsets.only(top: 200), + ), + ), + ], + )), + ], + )); } Widget _buildDesktopLayout(bool isDarkMode, bool isDesktop) { final double screenWidth = MediaQuery.of(context).size.width; return CupertinoPageScaffold( - backgroundColor: getPrimaryBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - padding: const EdgeInsetsDirectional.only(end: 16), - backgroundColor: getPrimaryBackgroundColor(isDarkMode), - leading: CupertinoButton( - padding: const EdgeInsets.all(0), - child: Icon(CupertinoIcons.back, color: activeIconRed), - onPressed: () { - popPage(context, isDesktop); - }, - ), - trailing: DbMusicListChoicMenu( - isDesktop: widget.isDesktop, - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), + backgroundColor: getPrimaryBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + padding: const EdgeInsetsDirectional.only(end: 16), + backgroundColor: getPrimaryBackgroundColor(isDarkMode), + middle: Text( + playlist.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + leading: CupertinoButton( + padding: const EdgeInsets.all(0), + child: Icon(CupertinoIcons.back, color: activeIconRed), + onPressed: () { + popPage(context, isDesktop); + }, + ), + trailing: DbMusicListChoicMenu( + isDesktop: widget.isDesktop, + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed) + .useSystemChineseFont(), + )), + playlist: playlist, + musicAggs: musicAggs, )), - playlist: playlist, - musicAggs: musicAggs, - )), - child: CustomScrollView( - slivers: [ - MusicListHeader( - playlist: playlist, - musicAggregators: musicAggs, - isDarkMode: isDarkMode, - screenWidth: screenWidth, - cacheCover: globalConfig.storageConfig.saveCover, - ), - const SliverToBoxAdapter( - child: SizedBox(height: 20), - ), - MusicAggregatorList( - musicAggs: musicAggs, - playlist: playlist, - cacheCover: globalConfig.storageConfig.saveCover, - ), - ], - ), - ); + Expanded( + child: CustomScrollView( + slivers: [ + MusicListHeader( + playlist: playlist, + musicAggregators: musicAggs, + isDarkMode: isDarkMode, + screenWidth: screenWidth, + cacheCover: globalConfig.storageConfig.saveCover, + ), + const SliverToBoxAdapter( + child: SizedBox(height: 20), + ), + MusicAggregatorList( + musicAggs: musicAggs, + playlist: playlist, + cacheCover: globalConfig.storageConfig.saveCover, + ), + ], + )), + ], + )); } } diff --git a/lib/common_pages/db_playlist_collection_page.dart b/lib/common_pages/db_playlist_collection_page.dart index 7fee94d..2c320fe 100644 --- a/lib/common_pages/db_playlist_collection_page.dart +++ b/lib/common_pages/db_playlist_collection_page.dart @@ -54,34 +54,37 @@ class DbPlaylistCollectionPageState extends State return CupertinoPageScaffold( backgroundColor: getPrimaryBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text( - '所有歌单列表', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - trailing: PlaylistCollectionPageMenu( - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - )), - isDesktop: widget.isDesktop, - playlists: - playlistsCollections.map((e) => e.$2).expand((e) => e).toList(), - playlistCollections: playlistsCollections.map((e) => e.$1).toList(), - ), - ), - child: SafeArea( - child: Column( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text( + '所有歌单列表', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + trailing: PlaylistCollectionPageMenu( + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed) + .useSystemChineseFont(), + )), + isDesktop: widget.isDesktop, + playlists: playlistsCollections + .map((e) => e.$2) + .expand((e) => e) + .toList(), + playlistCollections: + playlistsCollections.map((e) => e.$1).toList(), + ), + ), Expanded( child: ListView.builder( itemCount: playlistsCollections.length, @@ -99,7 +102,7 @@ class DbPlaylistCollectionPageState extends State ), ), ], - ))); + )); } @override diff --git a/lib/common_pages/db_playlist_gridview_page.dart b/lib/common_pages/db_playlist_gridview_page.dart index 1f20e46..71b6551 100644 --- a/lib/common_pages/db_playlist_gridview_page.dart +++ b/lib/common_pages/db_playlist_gridview_page.dart @@ -131,51 +131,60 @@ class DbPlaylistGridPageState extends State final Color navigatorBarColor = getNavigatorBarColor(isDarkMode); return CupertinoPageScaffold( - backgroundColor: getPrimaryBackgroundColor(isDarkMode), - child: Column( - children: [ - CupertinoNavigationBar( - backgroundColor: navigatorBarColor, - leading: Padding( - padding: const EdgeInsets.only(left: 0.0), - child: Align( - alignment: Alignment.center, - child: Text( - playlistCollection.name, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: textColor) - .useSystemChineseFont(), + backgroundColor: getPrimaryBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: navigatorBarColor, + middle: Text( + playlistCollection.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + leading: Padding( + padding: const EdgeInsets.only(left: 0.0), + child: Align( + alignment: Alignment.center, + child: Text( + playlistCollection.name, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: textColor) + .useSystemChineseFont(), + ), ), ), + trailing: PlaylistGridPageMenu( + playlists: playlists, + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed) + .useSystemChineseFont(), + )), + isDesktop: true, + playlistCollection: playlistCollection, + ), ), - trailing: PlaylistGridPageMenu( - playlists: playlists, - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: - TextStyle(color: activeIconRed).useSystemChineseFont(), - )), - isDesktop: true, - playlistCollection: playlistCollection, + Expanded( + child: playlists.isEmpty + ? Center( + child: Text("没有歌单", + style: TextStyle(color: textColor) + .useSystemChineseFont()), + ) + : buildDesktopGrid(), ), - ), - Expanded( - child: playlists.isEmpty - ? Center( - child: Text("没有歌单", - style: - TextStyle(color: textColor).useSystemChineseFont()), - ) - : buildDesktopGrid(), - ), - ], - ), - ); + ], + )); } /// 移动端 UI 构建 @@ -187,38 +196,41 @@ class DbPlaylistGridPageState extends State return CupertinoPageScaffold( backgroundColor: backgroundColor, - navigationBar: CupertinoNavigationBar( - backgroundColor: backgroundColor, - leading: CupertinoButton( - padding: const EdgeInsets.all(0), - child: Icon(CupertinoIcons.back, color: activeIconRed), - onPressed: () { - popPage(context, widget.isDesktop); - }, - ), - middle: Text( - playlistCollection.name, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - trailing: PlaylistGridPageMenu( - playlists: playlists, - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - )), - isDesktop: false, - playlistCollection: playlistCollection, - ), - ), child: Column( children: [ + CupertinoNavigationBar( + backgroundColor: backgroundColor, + leading: CupertinoButton( + padding: const EdgeInsets.all(0), + child: Icon(CupertinoIcons.back, color: activeIconRed), + onPressed: () { + popPage(context, widget.isDesktop); + }, + ), + middle: Text( + playlistCollection.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + trailing: PlaylistGridPageMenu( + playlists: playlists, + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: + TextStyle(color: activeIconRed).useSystemChineseFont(), + )), + isDesktop: false, + playlistCollection: playlistCollection, + ), + ), Expanded( child: playlists.isEmpty ? Center( @@ -234,45 +246,43 @@ class DbPlaylistGridPageState extends State } Widget buildDesktopGrid() { - return SafeArea( - child: CustomScrollView( - slivers: [ - SliverPadding( - padding: EdgeInsets.symmetric( - horizontal: Platform.isIOS ? 0.0 : 10.0, vertical: 20), - sliver: SliverGrid( - gridDelegate: const SliverGridDelegateWithResponsiveColumnCount( - minColumnWidth: 200.0, - mainAxisSpacing: 10.0, - crossAxisSpacing: 10.0, - minColumnCount: 4, - maxColumnCount: 8, - ), - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - var musicList = playlists[index]; - return PlaylistCard( - key: ValueKey(musicList.identity), - playlist: musicList, - onTap: () { - navigate( - context, - DbMusicContainerListPage( - playlist: musicList, - isDesktop: true, - ), - widget.isDesktop, - "###Playlist_${musicList.identity}###"); - }, - cacheCover: globalConfig.storageConfig.saveCover, - ); - }, - childCount: playlists.length, - ), + return CustomScrollView( + slivers: [ + SliverPadding( + padding: EdgeInsets.symmetric( + horizontal: Platform.isIOS ? 0.0 : 10.0, vertical: 20), + sliver: SliverGrid( + gridDelegate: const SliverGridDelegateWithResponsiveColumnCount( + minColumnWidth: 200.0, + mainAxisSpacing: 10.0, + crossAxisSpacing: 10.0, + minColumnCount: 4, + maxColumnCount: 8, + ), + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + var musicList = playlists[index]; + return PlaylistCard( + key: ValueKey(musicList.identity), + playlist: musicList, + onTap: () { + navigate( + context, + DbMusicContainerListPage( + playlist: musicList, + isDesktop: true, + ), + widget.isDesktop, + "###Playlist_${musicList.identity}###"); + }, + cacheCover: globalConfig.storageConfig.saveCover, + ); + }, + childCount: playlists.length, ), ), - ], - ), + ), + ], ); } @@ -280,8 +290,7 @@ class DbPlaylistGridPageState extends State return CustomScrollView( slivers: [ SliverPadding( - padding: EdgeInsets.symmetric( - horizontal: Platform.isIOS ? 0.0 : 10.0, vertical: 20), + padding: EdgeInsets.only(top: 20), sliver: SliverGrid( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, @@ -290,21 +299,23 @@ class DbPlaylistGridPageState extends State delegate: SliverChildBuilderDelegate( (BuildContext context, int index) { var playlisy = playlists[index]; - return PlaylistCard( - playlist: playlists[index], - onTap: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (context) => DbMusicContainerListPage( - playlist: playlisy, - isDesktop: false, - ), - ), - ); - }, - key: ValueKey(playlisy.identity), - ); + return Padding( + padding: EdgeInsets.symmetric(horizontal: 10), + child: PlaylistCard( + playlist: playlists[index], + onTap: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => DbMusicContainerListPage( + playlist: playlisy, + isDesktop: false, + ), + ), + ); + }, + key: ValueKey(playlisy.identity), + )); }, childCount: playlists.length, ), diff --git a/lib/common_pages/multi_selection_page/music_aggregator.dart b/lib/common_pages/multi_selection_page/music_aggregator.dart index 4924cd5..1fe3114 100644 --- a/lib/common_pages/multi_selection_page/music_aggregator.dart +++ b/lib/common_pages/multi_selection_page/music_aggregator.dart @@ -65,109 +65,113 @@ class MusicAggregatorMultiSelectionPageState final double screenWidth = MediaQuery.of(context).size.width; return CupertinoPageScaffold( - backgroundColor: backgroundColor, - child: Column(children: [ - CupertinoNavigationBar( - padding: const EdgeInsetsDirectional.only(end: 16), - backgroundColor: backgroundColor, - leading: CupertinoButton( - padding: const EdgeInsets.all(0), - child: Icon(CupertinoIcons.back, color: activeIconRed), - onPressed: () { - if (context.mounted) popPage(context, widget.isDesktop); - }, - ), - trailing: MusicAggMultiSelectMenu( - playlist: widget.playlist, - musicAggs: widget.musicAggs, - setState: () => setState(() {}), - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), + backgroundColor: backgroundColor, + child: Column( + children: [ + CupertinoNavigationBar( + padding: const EdgeInsetsDirectional.only(end: 16), + backgroundColor: backgroundColor, + leading: CupertinoButton( + padding: const EdgeInsets.all(0), + child: Icon(CupertinoIcons.back, color: activeIconRed), + onPressed: () { + if (context.mounted) popPage(context, widget.isDesktop); + }, ), - ), - controller: controller, - ), - ), - Expanded( - child: widget.musicAggs.isEmpty - ? Center( + trailing: MusicAggMultiSelectMenu( + playlist: widget.playlist, + musicAggs: widget.musicAggs, + setState: () => setState(() {}), + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, child: Text( - "没有音乐", - style: TextStyle( - color: isDarkMode - ? CupertinoColors.white - : CupertinoColors.black) - .useSystemChineseFont(), + '选项', + style: + TextStyle(color: activeIconRed).useSystemChineseFont(), ), - ) - : Align( - key: ValueKey(controller.hashCode), - alignment: Alignment.topCenter, - child: DragSelectGridView( - gridController: controller, - padding: EdgeInsets.only( - bottom: 100, - top: 10, - left: widget.isDesktop ? 0 : 10, - right: widget.isDesktop ? 0 : 10, - ), - itemCount: widget.musicAggs.length, - triggerSelectionOnTap: true, - itemBuilder: (context, index, selected) { - final musicAgg = widget.musicAggs[index]; + ), + controller: controller, + ), + ), + Expanded( + child: widget.musicAggs.isEmpty + ? Center( + child: Text( + "没有音乐", + style: TextStyle( + color: isDarkMode + ? CupertinoColors.white + : CupertinoColors.black) + .useSystemChineseFont(), + ), + ) + : Align( + key: ValueKey(controller.hashCode), + alignment: Alignment.topCenter, + child: DragSelectGridView( + gridController: controller, + padding: EdgeInsets.only( + bottom: 100, + top: 10, + left: widget.isDesktop ? 0 : 10, + right: widget.isDesktop ? 0 : 10, + ), + itemCount: widget.musicAggs.length, + triggerSelectionOnTap: true, + itemBuilder: (context, index, selected) { + final musicAgg = widget.musicAggs[index]; - Widget musicAggItem = widget.isDesktop - ? DesktopMusicAggregatorListItem( - musicAgg: musicAgg, - playlist: widget.playlist, - isDarkMode: isDarkMode, - hasBackgroundColor: index % 2 == 0, - ) - : MobileMusicAggregatorListItem( - showMenu: false, - musicAgg: musicAgg, - playlist: widget.playlist, - ); - return Column( - children: [ - Row( - key: ValueKey("${selected}_${musicAgg.identity()}"), + Widget musicAggItem = widget.isDesktop + ? DesktopMusicAggregatorListItem( + musicAgg: musicAgg, + playlist: widget.playlist, + isDarkMode: isDarkMode, + hasBackgroundColor: index % 2 == 0, + ) + : MobileMusicAggregatorListItem( + showMenu: false, + musicAgg: musicAgg, + playlist: widget.playlist, + ); + return Column( children: [ - Expanded( - child: musicAggItem, - ), - Icon( - selected - ? CupertinoIcons.check_mark_circled - : CupertinoIcons.circle, - color: selected - ? CupertinoColors.systemGreen - : CupertinoColors.systemGrey4, + Row( + key: ValueKey( + "${selected}_${musicAgg.identity()}"), + children: [ + Expanded( + child: musicAggItem, + ), + Icon( + selected + ? CupertinoIcons.check_mark_circled + : CupertinoIcons.circle, + color: selected + ? CupertinoColors.systemGreen + : CupertinoColors.systemGrey4, + ), + ], ), + const Padding(padding: EdgeInsets.only(top: 10)), + SizedBox( + width: screenWidth * 0.85, + child: Divider( + color: dividerColor, + height: 0.5, + ), + ) ], - ), - const Padding(padding: EdgeInsets.only(top: 10)), - SizedBox( - width: screenWidth * 0.85, - child: Divider( - color: dividerColor, - height: 0.5, - ), - ) - ], - ); - }, - gridDelegate: const SliverGridDelegateWithFixedRowHeight( - rowHeight: 60, - ), - )), - ) - ]), - ); + ); + }, + gridDelegate: + const SliverGridDelegateWithFixedRowHeight( + rowHeight: 60, + ), + )), + ) + ], + )); } } diff --git a/lib/common_pages/online_music_agg_listview_page.dart b/lib/common_pages/online_music_agg_listview_page.dart index 3447e84..87a062a 100644 --- a/lib/common_pages/online_music_agg_listview_page.dart +++ b/lib/common_pages/online_music_agg_listview_page.dart @@ -97,116 +97,121 @@ class OnlineMusicAggregatorListViewPageState double screenWidth = MediaQuery.of(context).size.width; return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text( - widget.playlist?.name ?? widget.title ?? "在线歌曲", - style: TextStyle(color: getTextColor(isDarkMode)) - .useSystemChineseFont(), - ), - leading: CupertinoButton( - padding: EdgeInsets.zero, - child: Icon( - CupertinoIcons.back, - color: activeIconRed, - ), - onPressed: () { - popPage(context, widget.isDesktop); - }), - trailing: MusicPlaylistSmartPullDownMenu( - musicAggPageController: _pagingController, - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - )), - playlist: widget.playlist, - fetchAllMusicAggregators: _fetchAllMusicAggregators, - isDesktop: widget.isDesktop, - )), - backgroundColor: getPrimaryBackgroundColor(isDarkMode), - child: CustomScrollView( - slivers: [ - const SliverToBoxAdapter( - child: SafeArea(child: SizedBox()), - ), - if (widget.playlist != null) - MusicListHeader( - playlist: widget.playlist!, - isDarkMode: isDarkMode, - screenWidth: screenWidth, - fetchAllMusicAggregators: () async { - await _fetchAllMusicAggregators(); - return _pagingController.itemList ?? []; - }, - cacheCover: false, - musicAggregators: _pagingController.itemList ?? [], - ), - if (widget.playlist == null && widget.title != null) - DesktopMusicAggsHeader( - title: widget.title!, - summary: widget.summary, - cover: widget.cover, - isDarkMode: isDarkMode, - screenWidth: screenWidth, - fetchAllMusicAggregators: () async { - await _fetchAllMusicAggregators(); - return _pagingController.itemList ?? []; - }, - cacheCover: false, - musicAggregators: _pagingController.itemList ?? [], - ), - const SliverToBoxAdapter( - child: SizedBox(height: 20), - ), - PagedSliverList( - pagingController: _pagingController, - builderDelegate: PagedChildBuilderDelegate( - noItemsFoundIndicatorBuilder: (context) { - return Center( - child: Text( - '没有找到任何音乐', + backgroundColor: getPrimaryBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text( + widget.playlist?.name ?? widget.title ?? "在线歌曲", + maxLines: 1, + overflow: TextOverflow.ellipsis, style: TextStyle(color: getTextColor(isDarkMode)) .useSystemChineseFont(), ), - ); - }, itemBuilder: (context, musicAggregator, index) { - if (index == 0) { - return Column( - children: [ - const MusicAggregatorListHeaderRow(), - DesktopMusicAggregatorListItem( - musicAgg: musicAggregator, + leading: CupertinoButton( + padding: EdgeInsets.zero, + child: Icon( + CupertinoIcons.back, + color: activeIconRed, + ), + onPressed: () { + popPage(context, widget.isDesktop); + }), + trailing: MusicPlaylistSmartPullDownMenu( + musicAggPageController: _pagingController, + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed) + .useSystemChineseFont(), + )), + playlist: widget.playlist, + fetchAllMusicAggregators: _fetchAllMusicAggregators, + isDesktop: widget.isDesktop, + )), + Expanded( + child: CustomScrollView( + slivers: [ + if (widget.playlist != null) + MusicListHeader( + playlist: widget.playlist!, + isDarkMode: isDarkMode, + screenWidth: screenWidth, + fetchAllMusicAggregators: () async { + await _fetchAllMusicAggregators(); + return _pagingController.itemList ?? []; + }, + cacheCover: false, + musicAggregators: _pagingController.itemList ?? [], + ), + if (widget.playlist == null && widget.title != null) + DesktopMusicAggsHeader( + title: widget.title!, + summary: widget.summary, + cover: widget.cover, isDarkMode: isDarkMode, - hasBackgroundColor: index % 2 == 1, - ) - ], - ); - } else { - return Padding( - padding: const EdgeInsets.only( - top: 2, - bottom: 2, + screenWidth: screenWidth, + fetchAllMusicAggregators: () async { + await _fetchAllMusicAggregators(); + return _pagingController.itemList ?? []; + }, + cacheCover: false, + musicAggregators: _pagingController.itemList ?? [], + ), + const SliverToBoxAdapter( + child: SizedBox(height: 20), ), - child: DesktopMusicAggregatorListItem( - musicAgg: musicAggregator, - isDarkMode: isDarkMode, - hasBackgroundColor: index % 2 == 1, + PagedSliverList( + pagingController: _pagingController, + builderDelegate: PagedChildBuilderDelegate( + noItemsFoundIndicatorBuilder: (context) { + return Center( + child: Text( + '没有找到任何音乐', + style: TextStyle(color: getTextColor(isDarkMode)) + .useSystemChineseFont(), + ), + ); + }, itemBuilder: (context, musicAggregator, index) { + if (index == 0) { + return Column( + children: [ + const MusicAggregatorListHeaderRow(), + DesktopMusicAggregatorListItem( + musicAgg: musicAggregator, + isDarkMode: isDarkMode, + hasBackgroundColor: index % 2 == 1, + ) + ], + ); + } else { + return Padding( + padding: const EdgeInsets.only( + top: 2, + bottom: 2, + ), + child: DesktopMusicAggregatorListItem( + musicAgg: musicAggregator, + isDarkMode: isDarkMode, + hasBackgroundColor: index % 2 == 1, + ), + ); + } + }), ), - ); - } - }), - ), - const SliverToBoxAdapter( - child: Padding( - padding: EdgeInsets.only(top: 200), - ), - ), - ], - ), - ); + const SliverToBoxAdapter( + child: Padding( + padding: EdgeInsets.only(top: 200), + ), + ), + ], + ), + ) + ], + )); } Widget _buildMobile(BuildContext context, bool isDarkMode) { @@ -217,92 +222,100 @@ class OnlineMusicAggregatorListViewPageState : const Color.fromARGB(255, 245, 245, 246); return CupertinoPageScaffold( - backgroundColor: backgroundColor, - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text( - widget.playlist?.name ?? widget.title ?? "在线歌曲", - style: TextStyle(color: getTextColor(isDarkMode)) - .useSystemChineseFont(), - ), - leading: CupertinoButton( - padding: EdgeInsets.zero, - child: Icon( - CupertinoIcons.back, - color: activeIconRed, - ), - onPressed: () { - popPage(context, widget.isDesktop); - }), - trailing: MusicPlaylistSmartPullDownMenu( - musicAggPageController: _pagingController, - builder: (context, showMenu) => CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - )), - playlist: widget.playlist, - fetchAllMusicAggregators: _fetchAllMusicAggregators, - isDesktop: widget.isDesktop, - )), - child: CustomScrollView( - slivers: [ - if (widget.playlist != null) - MobilePlaylistHeader( - playlist: widget.playlist!, - musicAggregators: _pagingController.itemList ?? [], - fetchAllMusicAggregators: () async { - await _fetchAllMusicAggregators(); - return _pagingController.itemList ?? []; - }, - isDarkMode: isDarkMode, - ), - if (widget.playlist == null && widget.title != null) - MobileMusicAggsHeader( - title: widget.title!, - summary: widget.summary, - cover: widget.cover, - isDarkMode: isDarkMode, - musicAggregators: [], - fetchAllMusicAggregators: () async { - await _fetchAllMusicAggregators(); - return _pagingController.itemList ?? []; - }, - ), - PagedSliverList( - pagingController: _pagingController, - builderDelegate: PagedChildBuilderDelegate( - noItemsFoundIndicatorBuilder: (context) { - return Center( - child: Text( - '没有找到任何音乐', + backgroundColor: backgroundColor, + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text( + widget.playlist?.name ?? widget.title ?? "在线歌曲", + maxLines: 1, + overflow: TextOverflow.ellipsis, style: TextStyle(color: getTextColor(isDarkMode)) .useSystemChineseFont(), ), - ); - }, itemBuilder: (context, musicAggregator, index) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Column( - children: [ - MobileMusicAggregatorListItem( - musicAgg: musicAggregator, + leading: CupertinoButton( + padding: EdgeInsets.zero, + child: Icon( + CupertinoIcons.back, + color: activeIconRed, ), - Divider( - color: dividerColor, - ) - ], - ), - ); - }), - ), - const SliverToBoxAdapter( - child: Padding(padding: EdgeInsets.only(top: 200)), - ), - ], - ), - ); + onPressed: () { + popPage(context, widget.isDesktop); + }), + trailing: MusicPlaylistSmartPullDownMenu( + musicAggPageController: _pagingController, + builder: (context, showMenu) => CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed) + .useSystemChineseFont(), + )), + playlist: widget.playlist, + fetchAllMusicAggregators: _fetchAllMusicAggregators, + isDesktop: widget.isDesktop, + )), + Expanded( + child: CustomScrollView( + slivers: [ + if (widget.playlist != null) + MobilePlaylistHeader( + playlist: widget.playlist!, + musicAggregators: _pagingController.itemList ?? [], + fetchAllMusicAggregators: () async { + await _fetchAllMusicAggregators(); + return _pagingController.itemList ?? []; + }, + isDarkMode: isDarkMode, + ), + if (widget.playlist == null && widget.title != null) + MobileMusicAggsHeader( + title: widget.title!, + summary: widget.summary, + cover: widget.cover, + isDarkMode: isDarkMode, + musicAggregators: [], + fetchAllMusicAggregators: () async { + await _fetchAllMusicAggregators(); + return _pagingController.itemList ?? []; + }, + ), + PagedSliverList( + pagingController: _pagingController, + builderDelegate: PagedChildBuilderDelegate( + noItemsFoundIndicatorBuilder: (context) { + return Center( + child: Text( + '没有找到任何音乐', + style: TextStyle(color: getTextColor(isDarkMode)) + .useSystemChineseFont(), + ), + ); + }, itemBuilder: (context, musicAggregator, index) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + children: [ + MobileMusicAggregatorListItem( + musicAgg: musicAggregator, + ), + Divider( + color: dividerColor, + ) + ], + ), + ); + }), + ), + const SliverToBoxAdapter( + child: Padding(padding: EdgeInsets.only(top: 200)), + ), + ], + ), + ) + ], + )); } } diff --git a/lib/common_pages/online_playlist_gridview_page.dart b/lib/common_pages/online_playlist_gridview_page.dart index a240cce..79387d9 100644 --- a/lib/common_pages/online_playlist_gridview_page.dart +++ b/lib/common_pages/online_playlist_gridview_page.dart @@ -76,46 +76,50 @@ class SearchMusicListState extends State isDarkMode ? CupertinoColors.black : CupertinoColors.white; return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - backgroundColor: - widget.isDesktop ? getNavigatorBarColor(isDarkMode) : primaryColor, - leading: CupertinoButton( - padding: EdgeInsets.zero, - child: Icon( - CupertinoIcons.back, - color: activeIconRed, - ), - onPressed: () { - popPage(context, widget.isDesktop); - }), - middle: Text( - widget.title, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24, - color: textColor, - ).useSystemChineseFont(), - ), - trailing: SearchPlaylistPullDownMenu( - builder: (BuildContext context, Future Function() showMenu) => - CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - ), - ), - fetchAllMusicAggregators: _fetchAllPlaylists, - pagingController: _pagingController, - isDesktop: widget.isDesktop, - ), - ), backgroundColor: widget.isDesktop ? getPrimaryBackgroundColor(isDarkMode) : primaryColor, child: Column( children: [ + CupertinoNavigationBar( + backgroundColor: widget.isDesktop + ? getNavigatorBarColor(isDarkMode) + : primaryColor, + leading: CupertinoButton( + padding: EdgeInsets.zero, + child: Icon( + CupertinoIcons.back, + color: activeIconRed, + ), + onPressed: () { + popPage(context, widget.isDesktop); + }), + middle: Text( + widget.title, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24, + color: textColor, + ).useSystemChineseFont(), + ), + trailing: SearchPlaylistPullDownMenu( + builder: + (BuildContext context, Future Function() showMenu) => + CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed).useSystemChineseFont(), + ), + ), + fetchAllMusicAggregators: _fetchAllPlaylists, + pagingController: _pagingController, + isDesktop: widget.isDesktop, + ), + ), Expanded( child: PagedPlaylistGridview( isDesktop: widget.isDesktop, diff --git a/lib/common_pages/setting_page.dart b/lib/common_pages/setting_page.dart index 82d8ea8..749e6b7 100644 --- a/lib/common_pages/setting_page.dart +++ b/lib/common_pages/setting_page.dart @@ -68,163 +68,184 @@ class SettingPageState extends State with WidgetsBindingObserver { isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - backgroundColor: getSettingPageBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text( - '设置', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24, - color: textColor, - ).useSystemChineseFont(), - ), - ), - child: ListView( - children: [ - CupertinoFormSection.insetGrouped( - header: Text('应用信息', - style: TextStyle(color: textColor).useSystemChineseFont()), - children: [ - CupertinoFormRow( - prefix: SizedBox( - height: 60, - child: Padding( - padding: const EdgeInsets.all(10), - child: imageWithCache("", width: 50, height: 50), - )), - child: Align( - alignment: Alignment.centerLeft, - child: Container( - padding: const EdgeInsets.only(left: 10), - child: Text( - 'AppRhyme', - style: TextStyle( - color: textColor, - fontSize: 20.0, - ).useSystemChineseFont(), - ), - ))), - CupertinoFormRow( - prefix: Text( - '版本号', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - await checkVersionUpdate(context, true); - }, - child: Text( - globalPackageInfo.version, - style: TextStyle(color: CupertinoColors.activeBlue) - .useSystemChineseFont(), - ), - ), - ), - CupertinoFormRow( - prefix: Text( - '项目仓库', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: openProjectRepoLink, - child: Text( - 'github.com/canxin121/app_rhyme', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - ), - ), - ], - ), - CupertinoFormSection.insetGrouped(children: [ - CupertinoFormRow( - prefix: Text('音质设置', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (context) => const QualityConfigPage()), - ); - }, - child: const Icon(CupertinoIcons.right_chevron), - ), - ), - CupertinoFormRow( - prefix: Text('更新设置', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (context) => const UpdateConfigPage()), - ); - }, - child: const Icon(CupertinoIcons.right_chevron), + backgroundColor: getSettingPageBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text( + '设置', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24, + color: textColor, + ).useSystemChineseFont(), ), ), - CupertinoFormRow( - prefix: Text('储存设置', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (context) => StorageConfigPage( - isDesktop: widget.isDesktop, - )), - ); - }, - child: const Icon(CupertinoIcons.right_chevron), - ), - ), - CupertinoFormRow( - prefix: Text('音源设置', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (context) => const ExternalApiConfigPage()), - ); - }, - child: const Icon(CupertinoIcons.right_chevron), - ), - ), - if (widget.isDesktop) - CupertinoFormRow( - prefix: Text('窗口设置', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (context) => const WindowConfigPage()), - ); - }, - child: const Icon(CupertinoIcons.right_chevron), - ), - ), - CupertinoFormRow( - prefix: Text('查看日志', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - navigate(context, TalkerScreen(talker: globalTalker), - widget.isDesktop, ""); - }, - child: const Icon(CupertinoIcons.right_chevron), + Expanded( + child: ListView( + children: [ + CupertinoFormSection.insetGrouped( + header: Text('应用信息', + style: + TextStyle(color: textColor).useSystemChineseFont()), + children: [ + CupertinoFormRow( + prefix: SizedBox( + height: 50, + child: Padding( + padding: const EdgeInsets.all(10), + child: + imageWithCache("", width: 50, height: 50), + )), + child: Align( + alignment: Alignment.centerLeft, + child: Container( + padding: const EdgeInsets.only(left: 10), + child: Text( + 'AppRhyme', + style: TextStyle( + color: textColor, + fontSize: 20.0, + ).useSystemChineseFont(), + ), + ))), + CupertinoFormRow( + prefix: Text( + '版本号', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + await checkVersionUpdate(context, true); + }, + child: Text( + globalPackageInfo.version, + style: TextStyle(color: CupertinoColors.activeBlue) + .useSystemChineseFont(), + ), + ), + ), + CupertinoFormRow( + prefix: Text( + '项目仓库', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: openProjectRepoLink, + child: Text( + 'github.com/canxin121/app_rhyme', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + ), + ), + ], + ), + CupertinoFormSection.insetGrouped(children: [ + CupertinoFormRow( + prefix: Text('音质设置', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => + const QualityConfigPage()), + ); + }, + child: const Icon(CupertinoIcons.right_chevron), + ), + ), + CupertinoFormRow( + prefix: Text('更新设置', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => const UpdateConfigPage()), + ); + }, + child: const Icon(CupertinoIcons.right_chevron), + ), + ), + CupertinoFormRow( + prefix: Text('储存设置', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => StorageConfigPage( + isDesktop: widget.isDesktop, + )), + ); + }, + child: const Icon(CupertinoIcons.right_chevron), + ), + ), + CupertinoFormRow( + prefix: Text('音源设置', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => + const ExternalApiConfigPage()), + ); + }, + child: const Icon(CupertinoIcons.right_chevron), + ), + ), + if (widget.isDesktop) + CupertinoFormRow( + prefix: Text('窗口设置', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => + const WindowConfigPage()), + ); + }, + child: const Icon(CupertinoIcons.right_chevron), + ), + ), + CupertinoFormRow( + prefix: Text('查看日志', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + navigate(context, TalkerScreen(talker: globalTalker), + widget.isDesktop, ""); + }, + child: const Icon(CupertinoIcons.right_chevron), + ), + ), + ]) + ], ), - ), - ]) - ], - ), - ); + ) + ], + )); } } @@ -263,66 +284,79 @@ class QualityConfigPageState extends State isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - backgroundColor: getSettingPageBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text('音质设置', style: TextStyle(color: textColor)), - ), - child: ListView( - children: [ - CupertinoFormSection.insetGrouped( - header: Text('音质自动选择设置', - style: TextStyle(color: textColor).useSystemChineseFont()), - children: [ - CupertinoFormRow( - prefix: Text( - (Platform.isAndroid || Platform.isIOS) - ? 'WiFi 自动选择音质' - : '自动选择音质', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - child: Text( - qualityOptionToString( - globalConfig.qualityConfig.wifiAutoQuality), - style: - const TextStyle(color: CupertinoColors.activeBlue)), - onPressed: () async { - var quality = await showQualityOptionDialog(context); - if (quality != null) { - setState(() { - globalConfig.qualityConfig.wifiAutoQuality = quality; - globalConfig.save(documentFolder: globalDocumentPath); - }); - } - }, - ), - ), - if (Platform.isAndroid || Platform.isIOS) - CupertinoFormRow( - prefix: Text('移动网络自动选择音质', - style: - TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - child: Text( - qualityOptionToString( - globalConfig.qualityConfig.mobileAutoQuality), + backgroundColor: getSettingPageBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text('音质设置', style: TextStyle(color: textColor)), + ), + Expanded( + child: ListView( + children: [ + CupertinoFormSection.insetGrouped( + header: Text('音质自动选择设置', style: - const TextStyle(color: CupertinoColors.activeBlue)), - onPressed: () async { - var quality = await showQualityOptionDialog(context); - if (quality != null) { - globalConfig.qualityConfig.mobileAutoQuality = quality; - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - } - }, + TextStyle(color: textColor).useSystemChineseFont()), + children: [ + CupertinoFormRow( + prefix: Text( + (Platform.isAndroid || Platform.isIOS) + ? 'WiFi 自动选择音质' + : '自动选择音质', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + child: Text( + qualityOptionToString( + globalConfig.qualityConfig.wifiAutoQuality), + style: const TextStyle( + color: CupertinoColors.activeBlue)), + onPressed: () async { + var quality = + await showQualityOptionDialog(context); + if (quality != null) { + setState(() { + globalConfig.qualityConfig.wifiAutoQuality = + quality; + globalConfig.save( + documentFolder: globalDocumentPath); + }); + } + }, + ), + ), + if (Platform.isAndroid || Platform.isIOS) + CupertinoFormRow( + prefix: Text('移动网络自动选择音质', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + child: Text( + qualityOptionToString(globalConfig + .qualityConfig.mobileAutoQuality), + style: const TextStyle( + color: CupertinoColors.activeBlue)), + onPressed: () async { + var quality = + await showQualityOptionDialog(context); + if (quality != null) { + globalConfig.qualityConfig.mobileAutoQuality = + quality; + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + } + }, + ), + ), + ], ), - ), - ], - ), - ], - ), - ); + ], + ), + ) + ], + )); } } @@ -361,45 +395,57 @@ class UpdateConfigPageState extends State isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - backgroundColor: getSettingPageBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text('更新设置', style: TextStyle(color: textColor)), - ), - child: ListView( - children: [ - CupertinoFormSection.insetGrouped( - header: Text('自动检查更新设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text('自动检查版本更新', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoSwitch( - value: globalConfig.updateConfig.versionAutoUpdate, - onChanged: (value) { - globalConfig.updateConfig.versionAutoUpdate = value; - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), - ), - CupertinoFormRow( - prefix: Text('自动检查音源更新', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoSwitch( - value: globalConfig.updateConfig.externalApiAutoUpdate, - onChanged: (value) { - globalConfig.updateConfig.externalApiAutoUpdate = value; - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), + backgroundColor: getSettingPageBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text('更新设置', style: TextStyle(color: textColor)), + ), + Expanded( + child: ListView( + children: [ + CupertinoFormSection.insetGrouped( + header: + Text('自动检查更新设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text('自动检查版本更新', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoSwitch( + value: globalConfig.updateConfig.versionAutoUpdate, + onChanged: (value) { + globalConfig.updateConfig.versionAutoUpdate = value; + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + CupertinoFormRow( + prefix: Text('自动检查音源更新', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoSwitch( + value: + globalConfig.updateConfig.externalApiAutoUpdate, + onChanged: (value) { + globalConfig.updateConfig.externalApiAutoUpdate = + value; + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + ], + ), + ], ), - ], - ), - ], - ), - ); + ) + ], + )); } } @@ -480,389 +526,429 @@ class StorageConfigPageState extends State final textColor = isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - backgroundColor: getSettingPageBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - middle: Text('储存设置', style: TextStyle(color: textColor)), - backgroundColor: getNavigatorBarColor(isDarkMode), - ), - child: ListView( - children: [ - CupertinoFormSection.insetGrouped( - header: Text('自动缓存设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text('缓存封面', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoSwitch( - value: globalConfig.storageConfig.saveCover, - onChanged: (value) async { - globalConfig.storageConfig.saveCover = value; - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), - ), - ], - ), - if (!Platform.isIOS) - CupertinoFormSection.insetGrouped( - header: Text('缓存目录设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text('当前缓存目录', - style: - TextStyle(color: textColor).useSystemChineseFont()), - child: GestureDetector( - onTap: () { - setClipboard(globalConfig.getStorageFolder( - documentFolder: globalDocumentPath)); - }, - child: Container( - padding: const EdgeInsets.only(right: 10), - alignment: Alignment.centerRight, - height: 50, - child: Text( - globalConfig.getStorageFolder( - documentFolder: globalDocumentPath), + backgroundColor: getSettingPageBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + middle: Text('储存设置', style: TextStyle(color: textColor)), + backgroundColor: getNavigatorBarColor(isDarkMode), + ), + Expanded( + child: ListView( + children: [ + CupertinoFormSection.insetGrouped( + header: Text('自动缓存设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text('缓存封面', style: TextStyle(color: textColor) - .useSystemChineseFont(), - ))), - ), - CupertinoFormRow( - prefix: Text( - '移动缓存文件夹', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能将会将当前使用的缓存文件夹下的缓存数据迁移到新的文件夹下\n" - "请确保新的文件夹下没有AppRhyme的数据, 否则会导致该目标文件夹中数据完全丢失!!!\n" - "如果你想直接使用指定文件夹下的数据, 请使用'使用缓存文件夹'功能\n" - "是否继续?"); - if (confirm != null && confirm) { - await useNewCacheRoot(true, widget.isDesktop); - } - }, - child: const Icon(CupertinoIcons.folder), - ), - ), - CupertinoFormRow( - prefix: Text( - '使用缓存文件夹', - style: TextStyle(color: textColor).useSystemChineseFont(), + .useSystemChineseFont()), + child: CupertinoSwitch( + value: globalConfig.storageConfig.saveCover, + onChanged: (value) async { + globalConfig.storageConfig.saveCover = value; + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + ], ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能将会直接使用指定文件夹下的缓存数据, 请确保目标文件夹下有正确的缓存数据\n" - "这将会导致当前使用的缓存文件夹下的缓存数据完全丢失!!!\n" - "如果你想移动缓存数据到目标文件夹, 请使用'移动缓存文件夹'功能\n" - "是否继续?"); + if (!Platform.isIOS) + CupertinoFormSection.insetGrouped( + header: + Text('缓存目录设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text('当前缓存目录', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: GestureDetector( + onTap: () { + setClipboard(globalConfig.getStorageFolder( + documentFolder: globalDocumentPath)); + }, + child: Container( + padding: const EdgeInsets.only(right: 10), + alignment: Alignment.centerRight, + height: 50, + child: Text( + globalConfig.getStorageFolder( + documentFolder: globalDocumentPath), + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ))), + ), + CupertinoFormRow( + prefix: Text( + '移动缓存文件夹', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能将会将当前使用的缓存文件夹下的缓存数据迁移到新的文件夹下\n" + "请确保新的文件夹下没有AppRhyme的数据, 否则会导致该目标文件夹中数据完全丢失!!!\n" + "如果你想直接使用指定文件夹下的数据, 请使用'使用缓存文件夹'功能\n" + "是否继续?"); + if (confirm != null && confirm) { + await useNewCacheRoot(true, widget.isDesktop); + } + }, + child: const Icon(CupertinoIcons.folder), + ), + ), + CupertinoFormRow( + prefix: Text( + '使用缓存文件夹', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能将会直接使用指定文件夹下的缓存数据, 请确保目标文件夹下有正确的缓存数据\n" + "这将会导致当前使用的缓存文件夹下的缓存数据完全丢失!!!\n" + "如果你想移动缓存数据到目标文件夹, 请使用'移动缓存文件夹'功能\n" + "是否继续?"); - if (confirm != null && confirm) { - await useNewCacheRoot(false, widget.isDesktop); - } - }, - child: const Icon( - CupertinoIcons.folder, + if (confirm != null && confirm) { + await useNewCacheRoot(false, widget.isDesktop); + } + }, + child: const Icon( + CupertinoIcons.folder, + ), + ), + ), + ], ), - ), - ), - ], - ), - CupertinoFormSection.insetGrouped( - header: Text('数据库Sql设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text('当前数据库', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: GestureDetector( - onTap: () { - setClipboard(globalConfig.getSqlUrl( - documentFolder: globalDocumentPath)); - }, - child: Container( - padding: const EdgeInsets.only(right: 10), - alignment: Alignment.centerRight, - height: 50, - child: Text( - globalConfig.getSqlUrl( - documentFolder: globalDocumentPath), + CupertinoFormSection.insetGrouped( + header: + Text('数据库Sql设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text('当前数据库', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: GestureDetector( + onTap: () { + setClipboard(globalConfig.getSqlUrl( + documentFolder: globalDocumentPath)); + }, + child: Container( + padding: const EdgeInsets.only(right: 10), + alignment: Alignment.centerRight, + height: 50, + child: Text( + globalConfig.getSqlUrl( + documentFolder: globalDocumentPath), + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ))), + ), + CupertinoFormRow( + prefix: Text( + '迁移歌单数据库', style: TextStyle(color: textColor) .useSystemChineseFont(), - ))), - ), - CupertinoFormRow( - prefix: Text( - '迁移歌单数据库', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能可能导致数据丢失, 请先备份一份数据库Json文件后使用" - "该功能将会将当前使用的歌单数据库迁移到新的数据库中\n" - "请确保目标数据库中没有AppRhyme的数据, 否则会导致该目标数据库中数据完全丢失!!!\n" - "如果你想直接使用目标数据库下的数据, 请使用'使用歌单数据库'功能\n" - "是否继续?"); - if (confirm == null || !confirm) return; - if (!context.mounted) return; - String? newDbUrl; + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能可能导致数据丢失, 请先备份一份数据库Json文件后使用" + "该功能将会将当前使用的歌单数据库迁移到新的数据库中\n" + "请确保目标数据库中没有AppRhyme的数据, 否则会导致该目标数据库中数据完全丢失!!!\n" + "如果你想直接使用目标数据库下的数据, 请使用'使用歌单数据库'功能\n" + "是否继续?"); + if (confirm == null || !confirm) return; + if (!context.mounted) return; + String? newDbUrl; - if (Platform.isIOS) { - newDbUrl = await showIosDatabaseUrlDialog(context); - } else { - newDbUrl = await showNewDatabaseUrlDialog(context); - } + if (Platform.isIOS) { + newDbUrl = + await showIosDatabaseUrlDialog(context); + } else { + newDbUrl = + await showNewDatabaseUrlDialog(context); + } - if (newDbUrl == null) return; - if (!context.mounted) return; - try { - verifySqliteUrl(sqliteUrl: newDbUrl); - } catch (e) { - LogToast.error("数据库设置", "sqlite数据库链接有误: $e", - "[storageConfig.moveDatabase] failed: $e"); - return; - } - await showWaitDialog(context, widget.isDesktop, "正在移动数据中"); - try { - globalConfig.storageConfig.customDb = newDbUrl; - globalConfig.save(documentFolder: globalDocumentPath); - var musicDataJson = - await MusicDataJsonWrapper.fromDatabase(); - await clearDb(); - await setDb(databaseUrl: newDbUrl); - await clearDb(); - await musicDataJson.applyToDb(); + if (newDbUrl == null) return; + if (!context.mounted) return; + try { + verifySqliteUrl(sqliteUrl: newDbUrl); + } catch (e) { + LogToast.error("数据库设置", "sqlite数据库链接有误: $e", + "[storageConfig.moveDatabase] failed: $e"); + return; + } + await showWaitDialog( + context, widget.isDesktop, "正在移动数据中"); + try { + globalConfig.storageConfig.customDb = newDbUrl; + globalConfig.save( + documentFolder: globalDocumentPath); + var musicDataJson = + await MusicDataJsonWrapper.fromDatabase(); + await clearDb(); + await setDb(databaseUrl: newDbUrl); + await clearDb(); + await musicDataJson.applyToDb(); - playlistCollectionsPageRefreshStreamController.add(null); - LogToast.success("数据库设置", "数据库移动成功", - "[storageConfig.moveDatabase] success"); - } catch (e) { - LogToast.error("数据库设置", "数据库移动失败: $e", - "[storageConfig.moveDatabase] failed: $e"); - } finally { - if (context.mounted) { - popPage(context, widget.isDesktop); - } - } - }, - child: const Icon(CupertinoIcons.tray_2_fill), - ), - ), - CupertinoFormRow( - prefix: Text( - '使用歌单数据库', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能将会直接使用指定数据库下的歌单数据, 请确保目标数据库下有正确的歌单数据\n" - "这将会导致当前使用的歌单数据库下的歌单数据完全丢失!!!\n" - "如果你想移动歌单数据到目标数据库, 请使用'移动歌单数据库'功能\n" - "是否继续?"); - if (confirm == null || !confirm) return; - if (!context.mounted) return; - String? dbUrl; + playlistCollectionsPageRefreshStreamController + .add(null); + LogToast.success("数据库设置", "数据库移动成功", + "[storageConfig.moveDatabase] success"); + } catch (e) { + LogToast.error("数据库设置", "数据库移动失败: $e", + "[storageConfig.moveDatabase] failed: $e"); + } finally { + if (context.mounted) { + popPage(context, widget.isDesktop); + } + } + }, + child: const Icon(CupertinoIcons.tray_2_fill), + ), + ), + CupertinoFormRow( + prefix: Text( + '使用歌单数据库', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能将会直接使用指定数据库下的歌单数据, 请确保目标数据库下有正确的歌单数据\n" + "这将会导致当前使用的歌单数据库下的歌单数据完全丢失!!!\n" + "如果你想移动歌单数据到目标数据库, 请使用'移动歌单数据库'功能\n" + "是否继续?"); + if (confirm == null || !confirm) return; + if (!context.mounted) return; + String? dbUrl; - if (Platform.isAndroid) { - dbUrl = await showNewDatabaseUrlDialog(context); - } else if (Platform.isIOS) { - dbUrl = await showIosDatabaseUrlDialog(context); - } else { - dbUrl = await showExistDatabaseUrlDialog(context); - } + if (Platform.isAndroid) { + dbUrl = await showNewDatabaseUrlDialog(context); + } else if (Platform.isIOS) { + dbUrl = await showIosDatabaseUrlDialog(context); + } else { + dbUrl = await showExistDatabaseUrlDialog(context); + } - if (dbUrl == null) return; - if (!context.mounted) return; - await showWaitDialog(context, widget.isDesktop, "正在清除数据中"); + if (dbUrl == null) return; + if (!context.mounted) return; + await showWaitDialog( + context, widget.isDesktop, "正在清除数据中"); - try { - verifySqliteUrl(sqliteUrl: dbUrl); - } catch (e) { - LogToast.error("数据库设置", "sqlite数据库链接有误: $e", - "[storageConfig.moveDatabase] failed: $e"); - return; - } - try { - globalConfig.storageConfig.customDb = dbUrl; - globalConfig.save(documentFolder: globalDocumentPath); + try { + verifySqliteUrl(sqliteUrl: dbUrl); + } catch (e) { + LogToast.error("数据库设置", "sqlite数据库链接有误: $e", + "[storageConfig.moveDatabase] failed: $e"); + return; + } + try { + globalConfig.storageConfig.customDb = dbUrl; + globalConfig.save( + documentFolder: globalDocumentPath); - await clearDb(); - await setDb(databaseUrl: dbUrl); - playlistCollectionsPageRefreshStreamController.add(null); + await clearDb(); + await setDb(databaseUrl: dbUrl); + playlistCollectionsPageRefreshStreamController + .add(null); - LogToast.success("数据库设置", "数据库设置成功", - "[storageConfig.moveDatabase] success"); - } catch (e) { - LogToast.error("数据库设置", "数据库设置失败: $e", - "[storageConfig.moveDatabase] failed: $e"); - } finally { - if (context.mounted) popPage(context, widget.isDesktop); - } - }, - child: const Icon(CupertinoIcons.tray_2_fill), - ), - ), - ], - ), - CupertinoFormSection.insetGrouped( - header: Text('数据库Json设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text( - '导出json文件', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能可以将歌单数据库完整导出为json文件, 包含所有歌单和其中的歌曲\n" - "请选择要保存到的目标文件夹\n" - "是否继续?"); - if (confirm == null || !confirm) return; - String? directory = await pickDirectory(); - if (directory == null) return; - if (!context.mounted) return; - String? filename = await showFileNameDialog( - context, "json", - defaultFileName: "app_rhyme_database"); - if (filename == null) return; - String filePath = "$directory/$filename"; - try { - var databaseJson = - await MusicDataJsonWrapper.fromDatabase(); - await databaseJson.saveTo(path: filePath); - LogToast.success("数据库导出", "数据库导出为json成功: $filePath", - "[storageConfig.exportDatabase] success: $filePath"); - } catch (e) { - LogToast.error("数据库导出", "数据库导出为json失败: $e", - "[storageConfig.exportDatabase] failed: $e"); - } finally { - setState(() {}); - } - }, - child: const Icon(CupertinoIcons.share_solid), - ), - ), - CupertinoFormRow( - prefix: Text( - '导入Json文件', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - await importDatabaseJson(context, widget.isDesktop); - }, - child: const Icon(CupertinoIcons.arrow_down_doc_fill), - ), - ), - ]), - CupertinoFormSection.insetGrouped( - header: Text('导入Json文件', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text( - '导入任意json文件', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var file = await pickFile(); - if (file == null) return; - try { - var musicDataJson = - await MusicDataJsonWrapper.loadFrom(path: file); - switch (await musicDataJson.getType()) { - case MusicDataType.database: - if (context.mounted) { - await importDatabaseJson( - context, widget.isDesktop, - musicDataJson: musicDataJson); - } - case MusicDataType.playlists: - if (context.mounted) { - await importPlaylistJson(context, - musicDataJson: musicDataJson); - } - case MusicDataType.musicAggregators: - if (context.mounted) { - await importMusicAggrgegatorJson(context, - musicDataJson: musicDataJson); + LogToast.success("数据库设置", "数据库设置成功", + "[storageConfig.moveDatabase] success"); + } catch (e) { + LogToast.error("数据库设置", "数据库设置失败: $e", + "[storageConfig.moveDatabase] failed: $e"); + } finally { + if (context.mounted) { + popPage(context, widget.isDesktop); + } } - } - } catch (e) { - LogToast.error( - "导入Json文件", "$e", "[storageConfig.importJson] $e"); - } - }, - child: const Icon(CupertinoIcons.arrow_down_doc_fill), - ), - ), - ]), - CupertinoFormSection.insetGrouped( - header: Text('清理空间', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text( - '清理未使用Db数据', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - try { - await MusicAggregator.clearUnused(); - LogToast.success("清理空间", "清理未使用Db数据成功", - "[storageConfig.clearDb] success"); - } catch (e) { - LogToast.error("清理空间", "清理未使用Db数据失败: $e", - "[storageConfig.clearDb] $e"); - } - }, - child: const Icon(CupertinoIcons.clear_circled_solid), - ), - ), - CupertinoFormRow( - prefix: Text( - '清理缓存', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能将会清理所有缓存数据, 请确保你不再需要这些数据\n" - "是否继续?"); - if (confirm == null || !confirm) return; - try { - await delOldCacheData(documentPath: globalDocumentPath); - LogToast.success("清理空间", "清理缓存成功", - "[storageConfig.clearCache] success"); - } catch (e) { - LogToast.error("清理空间", "清理缓存失败: $e", - "[storageConfig.clearCache] $e"); - } - }, - child: const Icon(CupertinoIcons.clear_circled_solid), + }, + child: const Icon(CupertinoIcons.tray_2_fill), + ), + ), + ], ), - ), - ]) - ], - ), - ); + CupertinoFormSection.insetGrouped( + header: + Text('数据库Json设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text( + '导出json文件', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能可以将歌单数据库完整导出为json文件, 包含所有歌单和其中的歌曲\n" + "请选择要保存到的目标文件夹\n" + "是否继续?"); + if (confirm == null || !confirm) return; + String? directory = await pickDirectory(); + if (directory == null) return; + if (!context.mounted) return; + String? filename = await showFileNameDialog( + context, "json", + defaultFileName: "app_rhyme_database"); + if (filename == null) return; + String filePath = "$directory/$filename"; + try { + var databaseJson = + await MusicDataJsonWrapper.fromDatabase(); + await databaseJson.saveTo(path: filePath); + LogToast.success( + "数据库导出", + "数据库导出为json成功: $filePath", + "[storageConfig.exportDatabase] success: $filePath"); + } catch (e) { + LogToast.error("数据库导出", "数据库导出为json失败: $e", + "[storageConfig.exportDatabase] failed: $e"); + } finally { + setState(() {}); + } + }, + child: const Icon(CupertinoIcons.share_solid), + ), + ), + CupertinoFormRow( + prefix: Text( + '导入Json文件', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + await importDatabaseJson( + context, widget.isDesktop); + }, + child: + const Icon(CupertinoIcons.arrow_down_doc_fill), + ), + ), + ]), + CupertinoFormSection.insetGrouped( + header: + Text('导入Json文件', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text( + '导入任意json文件', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var file = await pickFile(); + if (file == null) return; + try { + var musicDataJson = + await MusicDataJsonWrapper.loadFrom( + path: file); + switch (await musicDataJson.getType()) { + case MusicDataType.database: + if (context.mounted) { + await importDatabaseJson( + context, widget.isDesktop, + musicDataJson: musicDataJson); + } + case MusicDataType.playlists: + if (context.mounted) { + await importPlaylistJson(context, + musicDataJson: musicDataJson); + } + case MusicDataType.musicAggregators: + if (context.mounted) { + await importMusicAggrgegatorJson(context, + musicDataJson: musicDataJson); + } + } + } catch (e) { + LogToast.error("导入Json文件", "$e", + "[storageConfig.importJson] $e"); + } + }, + child: + const Icon(CupertinoIcons.arrow_down_doc_fill), + ), + ), + ]), + CupertinoFormSection.insetGrouped( + header: Text('清理空间', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text( + '清理未使用Db数据', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + try { + await MusicAggregator.clearUnused(); + LogToast.success("清理空间", "清理未使用Db数据成功", + "[storageConfig.clearDb] success"); + } catch (e) { + LogToast.error("清理空间", "清理未使用Db数据失败: $e", + "[storageConfig.clearDb] $e"); + } + }, + child: + const Icon(CupertinoIcons.clear_circled_solid), + ), + ), + CupertinoFormRow( + prefix: Text( + '清理缓存', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能将会清理所有缓存数据, 请确保你不再需要这些数据\n" + "是否继续?"); + if (confirm == null || !confirm) return; + try { + await delOldCacheData( + documentPath: globalDocumentPath); + LogToast.success("清理空间", "清理缓存成功", + "[storageConfig.clearCache] success"); + } catch (e) { + LogToast.error("清理空间", "清理缓存失败: $e", + "[storageConfig.clearCache] $e"); + } + }, + child: + const Icon(CupertinoIcons.clear_circled_solid), + ), + ), + ]) + ], + ), + ) + ], + )); } } @@ -900,186 +986,200 @@ class ExternalApiConfigPageState extends State final textColor = isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - backgroundColor: getSettingPageBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - middle: Text('第三方音源设置', style: TextStyle(color: textColor)), - backgroundColor: getNavigatorBarColor(isDarkMode), - ), - child: ListView( - children: [ - CupertinoFormSection.insetGrouped( - header: Text('音源状态', style: TextStyle(color: textColor)), - children: [ - if (globalConfig.externalApi != null && - globalConfig.externalApi!.url != null) - CupertinoFormRow( - prefix: Text('音源链接', - style: - TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - setClipboard(globalConfig.externalApi!.url!); - }, - child: Text(globalConfig.externalApi!.url!, - style: TextStyle(color: textColor)), - ), - ), - if (globalConfig.externalApi != null) - CupertinoFormRow( - prefix: Text('音源文件', - style: - TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - setClipboard(globalConfig.externalApi!.filePath); - }, - child: Text(globalConfig.externalApi!.filePath, - style: TextStyle(color: textColor)), - ), - ), - if (globalConfig.externalApi == null) - CupertinoFormRow( - prefix: Text('音源状态', - style: - TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - showCupertinoDialog( - context: context, - builder: (context) { - return CupertinoAlertDialog( - title: const Text('未找到第三方音源'), - content: const Text('请导入第三方音源'), - actions: [ - CupertinoDialogAction( - child: const Text('确定'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }); - }, - child: Text('未找到第三方音源', - style: TextStyle(color: activeIconRed)), - ), - ), - ], - ), - CupertinoFormSection.insetGrouped( - header: Text('设置音源', style: TextStyle(color: textColor)), - children: [ - if (globalConfig.externalApi != null) - CupertinoFormRow( - prefix: Text( - '删除音源', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var confirm = await showConfirmationDialog( - context, - "注意!\n" - "该功能将会删除当前使用的第三方音源, 请确保你不再需要该音源\n" - "是否继续?"); - if (confirm == null || !confirm) return; - try { - globalConfig.externalApi = null; - await globalConfig.save( - documentFolder: globalDocumentPath); - globalExternalApiEvaler = null; - LogToast.success( - "第三方音源", "删除第三方音源成功", "[externalApi] success"); - } catch (e) { - LogToast.error( - "第三方音源", "删除第三方音源失败: $e", "[externalApi] $e"); - } finally { - setState(() {}); - } - }, - child: Icon( - CupertinoIcons.delete_solid, - color: activeIconRed, - ), - ), - ), - if (globalConfig.externalApi == null) - CupertinoFormRow( - prefix: Text( - '从文件导入', - style: TextStyle(color: textColor).useSystemChineseFont(), + backgroundColor: getSettingPageBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + middle: Text('第三方音源设置', style: TextStyle(color: textColor)), + backgroundColor: getNavigatorBarColor(isDarkMode), + ), + Expanded( + child: ListView( + children: [ + CupertinoFormSection.insetGrouped( + header: Text('音源状态', style: TextStyle(color: textColor)), + children: [ + if (globalConfig.externalApi != null && + globalConfig.externalApi!.url != null) + CupertinoFormRow( + prefix: Text('音源链接', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + setClipboard(globalConfig.externalApi!.url!); + }, + child: Text(globalConfig.externalApi!.url!, + style: TextStyle(color: textColor)), + ), + ), + if (globalConfig.externalApi != null) + CupertinoFormRow( + prefix: Text('音源文件', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + setClipboard(globalConfig.externalApi!.filePath); + }, + child: Text(globalConfig.externalApi!.filePath, + style: TextStyle(color: textColor)), + ), + ), + if (globalConfig.externalApi == null) + CupertinoFormRow( + prefix: Text('音源状态', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + showCupertinoDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + title: const Text('未找到第三方音源'), + content: const Text('请导入第三方音源'), + actions: [ + CupertinoDialogAction( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); + }, + child: Text('未找到第三方音源', + style: TextStyle(color: activeIconRed)), + ), + ), + ], ), - child: CupertinoButton( - onPressed: () async { - var filePath = await pickFile(); - if (filePath == null) return; - try { - var externalApi = await ExternalApiConfig.fromPath( - path: filePath, documentFolder: globalDocumentPath); + CupertinoFormSection.insetGrouped( + header: Text('设置音源', style: TextStyle(color: textColor)), + children: [ + if (globalConfig.externalApi != null) + CupertinoFormRow( + prefix: Text( + '删除音源', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var confirm = await showConfirmationDialog( + context, + "注意!\n" + "该功能将会删除当前使用的第三方音源, 请确保你不再需要该音源\n" + "是否继续?"); + if (confirm == null || !confirm) return; + try { + globalConfig.externalApi = null; + await globalConfig.save( + documentFolder: globalDocumentPath); + globalExternalApiEvaler = null; + LogToast.success("第三方音源", "删除第三方音源成功", + "[externalApi] success"); + } catch (e) { + LogToast.error("第三方音源", "删除第三方音源失败: $e", + "[externalApi] $e"); + } finally { + setState(() {}); + } + }, + child: Icon( + CupertinoIcons.delete_solid, + color: activeIconRed, + ), + ), + ), + if (globalConfig.externalApi == null) + CupertinoFormRow( + prefix: Text( + '从文件导入', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var filePath = await pickFile(); + if (filePath == null) return; + try { + var externalApi = + await ExternalApiConfig.fromPath( + path: filePath, + documentFolder: globalDocumentPath); - globalConfig.externalApi = externalApi; - await globalConfig.save( - documentFolder: globalDocumentPath); - globalExternalApiEvaler = ExternalApiEvaler( - globalConfig.externalApi!.filePath); + globalConfig.externalApi = externalApi; + await globalConfig.save( + documentFolder: globalDocumentPath); + globalExternalApiEvaler = ExternalApiEvaler( + globalConfig.externalApi!.filePath); - if (context.mounted) { - context - .findAncestorStateOfType() - ?.refresh(); - } - LogToast.success( - "第三方音源", "导入第三方音源成功", "[externalApi] success"); - } catch (e) { - LogToast.error( - "第三方音源", "导入第三方音源失败: $e", "[externalApi] $e"); - } finally { - setState(() {}); - } - }, - child: const Icon( - CupertinoIcons.folder_fill, - ), - ), - ), - if (globalConfig.externalApi == null) - CupertinoFormRow( - prefix: Text( - '从链接导入', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: () async { - var link = await showInputExternalApiLinkDialog(context); - if (link == null) return; - try { - var externalApi = await ExternalApiConfig.fromUrl( - url: link, documentFolder: globalDocumentPath); - globalConfig.externalApi = externalApi; - await globalConfig.save( - documentFolder: globalDocumentPath); - globalExternalApiEvaler = ExternalApiEvaler( - globalConfig.externalApi!.filePath); - LogToast.success( - "第三方音源", "导入第三方音源成功", "[externalApi] success"); - } catch (e) { - LogToast.error( - "第三方音源", "导入第三方音源失败: $e", "[externalApi] $e"); - } finally { - setState(() {}); - } - }, - child: const Icon( - CupertinoIcons.cloud_download_fill, - ), + if (context.mounted) { + context + .findAncestorStateOfType< + SettingPageState>() + ?.refresh(); + } + LogToast.success("第三方音源", "导入第三方音源成功", + "[externalApi] success"); + } catch (e) { + LogToast.error("第三方音源", "导入第三方音源失败: $e", + "[externalApi] $e"); + } finally { + setState(() {}); + } + }, + child: const Icon( + CupertinoIcons.folder_fill, + ), + ), + ), + if (globalConfig.externalApi == null) + CupertinoFormRow( + prefix: Text( + '从链接导入', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: () async { + var link = + await showInputExternalApiLinkDialog(context); + if (link == null) return; + try { + var externalApi = + await ExternalApiConfig.fromUrl( + url: link, + documentFolder: globalDocumentPath); + globalConfig.externalApi = externalApi; + await globalConfig.save( + documentFolder: globalDocumentPath); + globalExternalApiEvaler = ExternalApiEvaler( + globalConfig.externalApi!.filePath); + LogToast.success("第三方音源", "导入第三方音源成功", + "[externalApi] success"); + } catch (e) { + LogToast.error("第三方音源", "导入第三方音源失败: $e", + "[externalApi] $e"); + } finally { + setState(() {}); + } + }, + child: const Icon( + CupertinoIcons.cloud_download_fill, + ), + ), + ), + ], ), - ), - ], - ), - ], - ), - ); + ], + ), + ) + ], + )); } } @@ -1125,176 +1225,203 @@ class WindowConfigPageState extends State } return CupertinoPageScaffold( - backgroundColor: getSettingPageBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - middle: Text('窗口设置(重启后生效)', style: TextStyle(color: textColor)), - backgroundColor: getNavigatorBarColor(isDarkMode), - ), - child: ListView( - children: [ - CupertinoFormSection.insetGrouped( - header: Text('当前窗口大小', style: TextStyle(color: textColor)), - children: [ - if (Platform.isLinux) - CupertinoFormRow( - prefix: Text( - '窗口大小', - style: TextStyle(color: textColor).useSystemChineseFont(), - ), - child: CupertinoButton( - onPressed: openProjectRepoLink, - child: Text( - "${appWindow.size.width} - ${appWindow.size.height}", - style: - TextStyle(color: textColor).useSystemChineseFont(), + backgroundColor: getSettingPageBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + middle: Text('窗口设置(重启后生效)', style: TextStyle(color: textColor)), + backgroundColor: getNavigatorBarColor(isDarkMode), + ), + Expanded( + child: ListView( + children: [ + CupertinoFormSection.insetGrouped( + header: + Text('当前窗口大小', style: TextStyle(color: textColor)), + children: [ + if (Platform.isLinux) + CupertinoFormRow( + prefix: Text( + '窗口大小', + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + child: CupertinoButton( + onPressed: openProjectRepoLink, + child: Text( + "${appWindow.size.width} - ${appWindow.size.height}", + style: TextStyle(color: textColor) + .useSystemChineseFont(), + ), + ), + ), + ]), + CupertinoFormSection.insetGrouped( + header: Text('窗口大小设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text('初始窗口宽度', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, horizontal: 10), + child: SizedBox( + height: 40, + width: 100, + child: CupertinoTextField( + controller: TextEditingController( + text: globalConfig.windowConfig!.width + .toString(), + ), + style: TextStyle(color: textColor), + onSubmitted: (value) { + globalConfig.windowConfig!.width = + int.parse(value); + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + )), + CupertinoFormRow( + prefix: Text('初始窗口高度', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, horizontal: 10), + child: SizedBox( + height: 40, + width: 100, + child: CupertinoTextField( + controller: TextEditingController( + text: globalConfig.windowConfig!.height + .toString()), + style: TextStyle(color: textColor), + onSubmitted: (value) { + globalConfig.windowConfig!.height = + int.parse(value); + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + ), ), - ), - ), - ]), - CupertinoFormSection.insetGrouped( - header: Text('窗口大小设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text('初始窗口宽度', - style: - TextStyle(color: textColor).useSystemChineseFont()), - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 5, horizontal: 10), - child: SizedBox( - height: 40, - width: 100, - child: CupertinoTextField( - controller: TextEditingController( - text: globalConfig.windowConfig!.width.toString(), + CupertinoFormRow( + prefix: Text('窗口最小宽度', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, horizontal: 10), + child: SizedBox( + height: 40, + width: 100, + child: CupertinoTextField( + controller: TextEditingController( + text: globalConfig.windowConfig!.minWidth + .toString()), + style: TextStyle(color: textColor), + onSubmitted: (value) { + globalConfig.windowConfig!.minWidth = + int.parse(value); + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), ), - style: TextStyle(color: textColor), - onSubmitted: (value) { - globalConfig.windowConfig!.width = int.parse(value); - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, ), - ), - )), - CupertinoFormRow( - prefix: Text('初始窗口高度', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 5, horizontal: 10), - child: SizedBox( - height: 40, - width: 100, - child: CupertinoTextField( - controller: TextEditingController( - text: globalConfig.windowConfig!.height.toString()), - style: TextStyle(color: textColor), - onSubmitted: (value) { - globalConfig.windowConfig!.height = int.parse(value); - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), - ), - ), - ), - CupertinoFormRow( - prefix: Text('窗口最小宽度', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 5, horizontal: 10), - child: SizedBox( - height: 40, - width: 100, - child: CupertinoTextField( - controller: TextEditingController( - text: globalConfig.windowConfig!.minWidth.toString()), - style: TextStyle(color: textColor), - onSubmitted: (value) { - globalConfig.windowConfig!.minWidth = int.parse(value); - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), + CupertinoFormRow( + prefix: Text('窗口最小高度', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 5, horizontal: 10), + child: SizedBox( + height: 40, + width: 100, + child: CupertinoTextField( + controller: TextEditingController( + text: globalConfig.windowConfig!.minHeight + .toString()), + style: TextStyle(color: textColor), + onSubmitted: (value) { + globalConfig.windowConfig!.minHeight = + int.parse(value); + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + ), + ), + CupertinoFormRow( + prefix: Text('启动时全屏', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoSwitch( + value: globalConfig.windowConfig!.fullscreen, + onChanged: (value) { + globalConfig.windowConfig!.fullscreen = value; + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + ), + ), + ], ), - ), - ), - CupertinoFormRow( - prefix: Text('窗口最小高度', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 5, horizontal: 10), - child: SizedBox( - height: 40, - width: 100, - child: CupertinoTextField( - controller: TextEditingController( - text: - globalConfig.windowConfig!.minHeight.toString()), - style: TextStyle(color: textColor), - onSubmitted: (value) { - globalConfig.windowConfig!.minHeight = int.parse(value); - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), + CupertinoFormSection.insetGrouped( + header: Text('窗口快捷设置', style: TextStyle(color: textColor)), + children: [ + CupertinoFormRow( + prefix: Text('将当前设为初始窗口大小', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + globalConfig.windowConfig!.width = + appWindow.size.width.toInt(); + globalConfig.windowConfig!.height = + appWindow.size.height.toInt(); + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + child: const Icon(CupertinoIcons.rectangle), + ), + ), + CupertinoFormRow( + prefix: Text('将当前设为最小窗口大小', + style: TextStyle(color: textColor) + .useSystemChineseFont()), + child: CupertinoButton( + onPressed: () { + globalConfig.windowConfig!.minWidth = + appWindow.size.width.toInt(); + globalConfig.windowConfig!.minHeight = + appWindow.size.height.toInt(); + globalConfig.save( + documentFolder: globalDocumentPath); + setState(() {}); + }, + child: const Icon(CupertinoIcons.rectangle), + ), + ), + ], ), - ), - ), - CupertinoFormRow( - prefix: Text('启动时全屏', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoSwitch( - value: globalConfig.windowConfig!.fullscreen, - onChanged: (value) { - globalConfig.windowConfig!.fullscreen = value; - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - ), - ), - ], - ), - CupertinoFormSection.insetGrouped( - header: Text('窗口快捷设置', style: TextStyle(color: textColor)), - children: [ - CupertinoFormRow( - prefix: Text('将当前设为初始窗口大小', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - globalConfig.windowConfig!.width = - appWindow.size.width.toInt(); - globalConfig.windowConfig!.height = - appWindow.size.height.toInt(); - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - child: const Icon(CupertinoIcons.rectangle), - ), - ), - CupertinoFormRow( - prefix: Text('将当前设为最小窗口大小', - style: TextStyle(color: textColor).useSystemChineseFont()), - child: CupertinoButton( - onPressed: () { - globalConfig.windowConfig!.minWidth = - appWindow.size.width.toInt(); - globalConfig.windowConfig!.minHeight = - appWindow.size.height.toInt(); - globalConfig.save(documentFolder: globalDocumentPath); - setState(() {}); - }, - child: const Icon(CupertinoIcons.rectangle), - ), + ], ), - ], - ), - ], - ), - ); + ) + ], + )); } } diff --git a/lib/desktop/comps/control_bar.dart b/lib/desktop/comps/control_bar.dart index 05676e6..64746c2 100644 --- a/lib/desktop/comps/control_bar.dart +++ b/lib/desktop/comps/control_bar.dart @@ -26,7 +26,7 @@ class ControlBar extends StatelessWidget { ? const Color.fromARGB(255, 42, 42, 42) : const Color.fromARGB(255, 247, 247, 247); Color dividerColor = getDividerColor(isDarkMode); - bool isDesktop_ = isDesktop(); + bool isDesktop_ = isDesktopDevice(); final childWidget = GestureDetector( onPanStart: (details) { if (isDesktop_) { diff --git a/lib/desktop/comps/navigation_column.dart b/lib/desktop/comps/navigation_column.dart index fad3b7c..31284b1 100644 --- a/lib/desktop/comps/navigation_column.dart +++ b/lib/desktop/comps/navigation_column.dart @@ -4,8 +4,8 @@ import 'package:app_rhyme/common_pages/db_playlist_collection_page.dart'; import 'package:app_rhyme/common_pages/db_playlist_gridview_page.dart'; import 'package:app_rhyme/desktop/pages/explore_page/music_chart_page.dart'; import 'package:app_rhyme/desktop/pages/explore_page/playlist_tag_page.dart'; -import 'package:app_rhyme/common_pages/search_page/music_aggregator.dart'; -import 'package:app_rhyme/common_pages/search_page/playlist.dart'; +import 'package:app_rhyme/desktop/pages/search_page/music_aggregator.dart'; +import 'package:app_rhyme/desktop/pages/search_page/playlist.dart'; import 'package:app_rhyme/desktop/home.dart'; import 'package:app_rhyme/common_pages/setting_page.dart'; import 'package:app_rhyme/src/rust/api/music_api/mirror.dart'; diff --git a/lib/desktop/comps/popup_comp/volume_slider.dart b/lib/desktop/comps/popup_comp/volume_slider.dart index 518cace..abc120d 100644 --- a/lib/desktop/comps/popup_comp/volume_slider.dart +++ b/lib/desktop/comps/popup_comp/volume_slider.dart @@ -155,8 +155,7 @@ class _VolumeSliderOverlayState extends State<_VolumeSliderOverlay> @override Widget build(BuildContext context) { - return SafeArea( - child: CupertinoPageScaffold( + return CupertinoPageScaffold( backgroundColor: CupertinoColors.systemFill.withOpacity(0.0), child: GestureDetector( onTap: widget.onRemove, @@ -182,6 +181,6 @@ class _VolumeSliderOverlayState extends State<_VolumeSliderOverlay> ], ), ), - )); + ); } } diff --git a/lib/desktop/home.dart b/lib/desktop/home.dart index bca456f..f3e3ca1 100644 --- a/lib/desktop/home.dart +++ b/lib/desktop/home.dart @@ -48,8 +48,7 @@ class DesktopHomeState extends State { @override Widget build(BuildContext context) { return CupertinoPageScaffold( - child: SafeArea( - child: Row( + child: Row( children: [ const MyNavListContainer(), Expanded( @@ -78,7 +77,7 @@ class DesktopHomeState extends State { ), ), ], - )), + ), ); } } diff --git a/lib/desktop/pages/explore_page/music_chart_page.dart b/lib/desktop/pages/explore_page/music_chart_page.dart index 59ae060..b4786cf 100644 --- a/lib/desktop/pages/explore_page/music_chart_page.dart +++ b/lib/desktop/pages/explore_page/music_chart_page.dart @@ -55,36 +55,39 @@ class MusicChartPageState extends State MediaQuery.of(context).platformBrightness == Brightness.dark; return CupertinoPageScaffold( - backgroundColor: getPrimaryBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text( - '音乐排行榜', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - ), - child: SafeArea( - child: isLoading - ? Center(child: CupertinoActivityIndicator()) - : serverMusicChartCollections.isEmpty - ? Center( - child: Text( - '暂无排行榜数据', - style: TextStyle( - fontSize: 18, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - ) - : MusicChartCollectionList( - collections: serverMusicChartCollections, - isDesktop: widget.isDesktop, - ), - ), - ); + backgroundColor: getPrimaryBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text( + '音乐排行榜', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + ), + Expanded( + child: isLoading + ? Center(child: CupertinoActivityIndicator()) + : serverMusicChartCollections.isEmpty + ? Center( + child: Text( + '暂无排行榜数据', + style: TextStyle( + fontSize: 18, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + ) + : MusicChartCollectionList( + collections: serverMusicChartCollections, + isDesktop: widget.isDesktop, + ), + ) + ], + )); } } diff --git a/lib/desktop/pages/explore_page/playlist_tag_page.dart b/lib/desktop/pages/explore_page/playlist_tag_page.dart index e819002..81e1fcc 100644 --- a/lib/desktop/pages/explore_page/playlist_tag_page.dart +++ b/lib/desktop/pages/explore_page/playlist_tag_page.dart @@ -55,36 +55,39 @@ class PlaylistTagPageState extends State MediaQuery.of(context).platformBrightness == Brightness.dark; return CupertinoPageScaffold( - backgroundColor: getPrimaryBackgroundColor(isDarkMode), - navigationBar: CupertinoNavigationBar( - backgroundColor: getNavigatorBarColor(isDarkMode), - middle: Text( - '浏览歌单', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - ), - child: SafeArea( - child: isLoading - ? Center(child: CupertinoActivityIndicator()) - : serverPlaylistTagCollections.isEmpty - ? Center( - child: Text( - '暂无歌单标签', - style: TextStyle( - fontSize: 18, - color: getTextColor(isDarkMode), - ).useSystemChineseFont(), - ), - ) - : PlaylistTagCollectionList( - collections: serverPlaylistTagCollections, - isDesktop: widget.isDesktop, - ), - ), - ); + backgroundColor: getPrimaryBackgroundColor(isDarkMode), + child: Column( + children: [ + CupertinoNavigationBar( + backgroundColor: getNavigatorBarColor(isDarkMode), + middle: Text( + '浏览歌单', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + ), + Expanded( + child: isLoading + ? Center(child: CupertinoActivityIndicator()) + : serverPlaylistTagCollections.isEmpty + ? Center( + child: Text( + '暂无歌单标签', + style: TextStyle( + fontSize: 18, + color: getTextColor(isDarkMode), + ).useSystemChineseFont(), + ), + ) + : PlaylistTagCollectionList( + collections: serverPlaylistTagCollections, + isDesktop: widget.isDesktop, + ), + ) + ], + )); } } diff --git a/lib/common_pages/search_page/music_aggregator.dart b/lib/desktop/pages/search_page/music_aggregator.dart similarity index 76% rename from lib/common_pages/search_page/music_aggregator.dart rename to lib/desktop/pages/search_page/music_aggregator.dart index 9c0f81f..aa0d72f 100644 --- a/lib/common_pages/search_page/music_aggregator.dart +++ b/lib/desktop/pages/search_page/music_aggregator.dart @@ -77,35 +77,39 @@ class MusicAggregatorSearchPageState extends State isDarkMode ? CupertinoColors.black : CupertinoColors.white; return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - backgroundColor: - widget.isDesktop ? getNavigatorBarColor(isDarkMode) : primaryColor, - middle: Text( - '搜索歌曲', - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 24, color: textColor) - .useSystemChineseFont(), - ), - trailing: MusicPlaylistSmartPullDownMenu( - musicAggPageController: pagingControllerMusicAggregator, - builder: (BuildContext context, Future Function() showMenu) => - CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - ), - ), - fetchAllMusicAggregators: _fetchAllMusicAggregators, - isDesktop: widget.isDesktop, - ), - ), backgroundColor: widget.isDesktop ? getPrimaryBackgroundColor(isDarkMode) : primaryColor, child: Column( children: [ + CupertinoNavigationBar( + backgroundColor: widget.isDesktop + ? getNavigatorBarColor(isDarkMode) + : primaryColor, + middle: Text( + '搜索歌曲', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24, + color: textColor) + .useSystemChineseFont(), + ), + trailing: MusicPlaylistSmartPullDownMenu( + musicAggPageController: pagingControllerMusicAggregator, + builder: + (BuildContext context, Future Function() showMenu) => + CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed).useSystemChineseFont(), + ), + ), + fetchAllMusicAggregators: _fetchAllMusicAggregators, + isDesktop: widget.isDesktop, + ), + ), Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 10.0), child: CupertinoSearchTextField( diff --git a/lib/common_pages/search_page/playlist.dart b/lib/desktop/pages/search_page/playlist.dart similarity index 76% rename from lib/common_pages/search_page/playlist.dart rename to lib/desktop/pages/search_page/playlist.dart index 046433b..89b128b 100644 --- a/lib/common_pages/search_page/playlist.dart +++ b/lib/desktop/pages/search_page/playlist.dart @@ -77,34 +77,36 @@ class SearchMusicListState extends State backgroundColor: widget.isDesktop ? getPrimaryBackgroundColor(isDarkMode) : primaryColor, - navigationBar: CupertinoNavigationBar( - backgroundColor: - widget.isDesktop ? getNavigatorBarColor(isDarkMode) : primaryColor, - middle: Text( - '搜索歌单', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24, - color: textColor, - ).useSystemChineseFont(), - ), - trailing: SearchPlaylistPullDownMenu( - builder: (BuildContext context, Future Function() showMenu) => - CupertinoButton( - padding: const EdgeInsets.all(0), - onPressed: showMenu, - child: Text( - '选项', - style: TextStyle(color: activeIconRed).useSystemChineseFont(), - ), - ), - fetchAllMusicAggregators: _fetchAllMusicLists, - pagingController: pagingControllerPlaylist, - isDesktop: widget.isDesktop, - ), - ), child: Column( children: [ + CupertinoNavigationBar( + backgroundColor: widget.isDesktop + ? getNavigatorBarColor(isDarkMode) + : primaryColor, + middle: Text( + '搜索歌单', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24, + color: textColor, + ).useSystemChineseFont(), + ), + trailing: SearchPlaylistPullDownMenu( + builder: + (BuildContext context, Future Function() showMenu) => + CupertinoButton( + padding: const EdgeInsets.all(0), + onPressed: showMenu, + child: Text( + '选项', + style: TextStyle(color: activeIconRed).useSystemChineseFont(), + ), + ), + fetchAllMusicAggregators: _fetchAllMusicLists, + pagingController: pagingControllerPlaylist, + isDesktop: widget.isDesktop, + ), + ), Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 10.0), child: CupertinoSearchTextField( diff --git a/lib/main.dart b/lib/main.dart index 20dd8b9..13525cf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -60,7 +60,7 @@ class MyAppState extends State { .useSystemChineseFont(), ), ), - home: _isWidthGreaterThanHeight || isDesktop() + home: _isWidthGreaterThanHeight || isDesktopDevice() ? const DesktopHome() : const MobileHome(), )); diff --git a/lib/mobile/comps/play_display_comp/music_artpic.dart b/lib/mobile/comps/play_display_comp/music_artpic.dart index b3cf72c..61c9390 100644 --- a/lib/mobile/comps/play_display_comp/music_artpic.dart +++ b/lib/mobile/comps/play_display_comp/music_artpic.dart @@ -19,21 +19,20 @@ class MusicArtPic extends StatefulWidget { class MusicArtPicState extends State { @override Widget build(BuildContext context) { - return SafeArea( - child: Obx(() => Container( - padding: widget.padding, - child: GlassContainer( - shadowColor: Platform.isIOS - ? CupertinoColors.black.withOpacity(0.2) - : CupertinoColors.black.withOpacity(0.4), - shadowStrength: Platform.isIOS ? 3 : 8, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(18.0), - child: imageWithCache( - globalAudioHandler.playingMusic.value?.currentMusic - .getCover(size: 250), - cacheHeight: 250, - cacheWidth: 250), - )))); + return Obx(() => Container( + padding: widget.padding, + child: GlassContainer( + shadowColor: Platform.isIOS + ? CupertinoColors.black.withOpacity(0.2) + : CupertinoColors.black.withOpacity(0.4), + shadowStrength: Platform.isIOS ? 3 : 8, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(18.0), + child: imageWithCache( + globalAudioHandler.playingMusic.value?.currentMusic + .getCover(size: 250), + cacheHeight: 250, + cacheWidth: 250), + ))); } } diff --git a/lib/mobile/comps/play_display_comp/music_control_bar.dart b/lib/mobile/comps/play_display_comp/music_control_bar.dart index 45ca814..f405e44 100644 --- a/lib/mobile/comps/play_display_comp/music_control_bar.dart +++ b/lib/mobile/comps/play_display_comp/music_control_bar.dart @@ -6,8 +6,8 @@ import 'package:app_rhyme/utils/cache_helper.dart'; import 'package:app_rhyme/utils/global_vars.dart'; class MusicControlBar extends StatefulWidget { - final double maxHeight; - const MusicControlBar({super.key, required this.maxHeight}); + final double height; + const MusicControlBar({super.key, required this.height}); @override MusicControlBarState createState() => MusicControlBarState(); @@ -43,10 +43,9 @@ class MusicControlBarState extends State isDarkMode ? CupertinoColors.white : CupertinoColors.black; final Color backgroundColor = isDarkMode ? CupertinoColors.black : CupertinoColors.white; - return ConstrainedBox( - constraints: BoxConstraints( - maxHeight: widget.maxHeight, - ), + + return SizedBox( + height: widget.height, child: GestureDetector( onVerticalDragUpdate: (details) { if (details.delta.dy < 0) { @@ -64,11 +63,16 @@ class MusicControlBarState extends State padding: const EdgeInsets.all(8.0), child: ClipRRect( borderRadius: BorderRadius.circular(6.0), - child: Obx(() => imageWithCache( - globalAudioHandler.playingMusic.value?.currentMusic - .getCover(size: 250), - height: 50, - width: 50)), + child: Obx(() => SizedBox( + width: widget.height - 16, // 确保图片是正方形 + height: widget.height - 16, + child: imageWithCache( + globalAudioHandler.playingMusic.value?.currentMusic + .getCover(size: 250), + height: widget.height - 16, + width: widget.height - 16, + ), + )), ), ), Expanded( diff --git a/lib/mobile/home.dart b/lib/mobile/home.dart index 785d403..227e9e8 100644 --- a/lib/mobile/home.dart +++ b/lib/mobile/home.dart @@ -91,6 +91,7 @@ class MobileHomeState extends State { : const Color.fromARGB(255, 209, 209, 209); return CupertinoPageScaffold( child: Column( + mainAxisSize: MainAxisSize.min, children: [ Expanded( child: IndexedStack( @@ -118,7 +119,7 @@ class MobileHomeState extends State { : Column( mainAxisSize: MainAxisSize.min, children: [ - const MusicControlBar(maxHeight: 60), + const MusicControlBar(height: 60), Center( child: Divider( color: dividerColor, diff --git a/lib/mobile/pages/explore_page.dart b/lib/mobile/pages/explore_page.dart index ced4a0a..7a1d065 100644 --- a/lib/mobile/pages/explore_page.dart +++ b/lib/mobile/pages/explore_page.dart @@ -68,53 +68,56 @@ class MobileExplorePageState extends State { isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text( - _selectedSegment.displayName, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - color: textColor, - ).useSystemChineseFont(), - ), - ), - child: SafeArea( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 10.0), - child: CupertinoSlidingSegmentedControl( - groupValue: _selectedSegment, - onValueChanged: (ExploreSegment? value) { - if (value != null) { - setState(() { - _selectedSegment = value; - }); - } - }, - children: { - ExploreSegment.musicChart: - Text(ExploreSegment.musicChart.displayName), - ExploreSegment.playlistTag: - Text(ExploreSegment.playlistTag.displayName), - }, - ), + child: Column( + children: [ + CupertinoNavigationBar( + middle: Text( + _selectedSegment.displayName, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20, + color: textColor, + ).useSystemChineseFont(), ), - Expanded( - child: isLoading - ? Center(child: CupertinoActivityIndicator()) - : _selectedSegment == ExploreSegment.musicChart - ? MusicChartCollectionList( - collections: musicCharts, - isDesktop: false, - ) - : PlaylistTagCollectionList( - collections: playlistTags, - isDesktop: false, - ), + ), + SizedBox(), + Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: CupertinoSlidingSegmentedControl( + groupValue: _selectedSegment, + onValueChanged: (ExploreSegment? value) { + if (value != null) { + setState(() { + _selectedSegment = value; + }); + } + }, + children: { + ExploreSegment.musicChart: Text( + ExploreSegment.musicChart.displayName, + style: TextStyle(color: textColor).useSystemChineseFont()), + ExploreSegment.playlistTag: Text( + ExploreSegment.playlistTag.displayName, + style: TextStyle(color: textColor).useSystemChineseFont()), + }, ), - ], - ), + ), + Expanded( + child: isLoading + ? Center(child: CupertinoActivityIndicator()) + : _selectedSegment == ExploreSegment.musicChart + ? MusicChartCollectionList( + collections: musicCharts, + isDesktop: false, + ) + : PlaylistTagCollectionList( + collections: playlistTags, + isDesktop: false, + ), + ), + ], ), ); } diff --git a/lib/mobile/pages/search_page.dart b/lib/mobile/pages/search_page.dart index bca8435..2213144 100644 --- a/lib/mobile/pages/search_page.dart +++ b/lib/mobile/pages/search_page.dart @@ -110,21 +110,24 @@ class _SearchPageMobileState extends State { isDarkMode ? CupertinoColors.white : CupertinoColors.black; return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( - middle: Text( - '搜索${_selectedSegment.displayName}', // 使用 displayName 方法展示名称 - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, - color: textColor, - ).useSystemChineseFont(), - ), - trailing: _selectedSegment == SearchSegment.music - ? MusicPlaylistSmartPullDownMenu( - fetchAllMusicAggregators: _fetchAllMusicAggregators, - musicAggPageController: pagingControllerMusicAggregator, - builder: - (BuildContext context, Future Function() showMenu) => + child: Column( + children: [ + CupertinoNavigationBar( + middle: Text( + '搜索${_selectedSegment.displayName}', // 使用 displayName 方法展示名称 + maxLines: 1, overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20, + color: textColor, + ).useSystemChineseFont(), + ), + trailing: _selectedSegment == SearchSegment.music + ? MusicPlaylistSmartPullDownMenu( + fetchAllMusicAggregators: _fetchAllMusicAggregators, + musicAggPageController: pagingControllerMusicAggregator, + builder: (BuildContext context, + Future Function() showMenu) => CupertinoButton( padding: const EdgeInsets.all(0), onPressed: showMenu, @@ -133,12 +136,12 @@ class _SearchPageMobileState extends State { style: TextStyle(color: activeIconRed) .useSystemChineseFont(), )), - isDesktop: false, - ) - : SearchPlaylistPullDownMenu( - pagingController: pagingControllerPlaylist, - builder: - (BuildContext context, Future Function() showMenu) => + isDesktop: false, + ) + : SearchPlaylistPullDownMenu( + pagingController: pagingControllerPlaylist, + builder: (BuildContext context, + Future Function() showMenu) => CupertinoButton( padding: const EdgeInsets.all(0), onPressed: showMenu, @@ -147,60 +150,61 @@ class _SearchPageMobileState extends State { style: TextStyle(color: activeIconRed) .useSystemChineseFont(), )), - fetchAllMusicAggregators: _fetchAllPlaylists, - isDesktop: false, - ), - ), - child: SafeArea( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 10.0), - child: CupertinoSearchTextField( - style: TextStyle(color: textColor).useSystemChineseFont(), - controller: inputContentController, - onSubmitted: (String value) { - if (value.isNotEmpty) { - if (_selectedSegment == SearchSegment.music) { - pagingControllerMusicAggregator.refresh(); - } else { - pagingControllerPlaylist.refresh(); - } - } - }, - ), - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 10.0), - child: CupertinoSlidingSegmentedControl( - groupValue: _selectedSegment, - onValueChanged: (SearchSegment? value) { - if (value != null) { - setState(() { - _selectedSegment = value; - }); + fetchAllMusicAggregators: _fetchAllPlaylists, + isDesktop: false, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 10.0), + child: CupertinoSearchTextField( + style: TextStyle(color: textColor).useSystemChineseFont(), + controller: inputContentController, + onSubmitted: (String value) { + if (value.isNotEmpty) { + if (_selectedSegment == SearchSegment.music) { + pagingControllerMusicAggregator.refresh(); + } else { + pagingControllerPlaylist.refresh(); } - }, - children: { - SearchSegment.music: Text(SearchSegment.music.displayName), - SearchSegment.playlist: - Text(SearchSegment.playlist.displayName), - }, - ), + } + }, ), - Expanded( - child: _selectedSegment == SearchSegment.music - ? PagedMusicAggregatorList( - isDesktop: false, - pagingController: pagingControllerMusicAggregator, - ) - : PagedPlaylistGridview( - isDesktop: false, - pagingController: pagingControllerPlaylist, - ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: CupertinoSlidingSegmentedControl( + groupValue: _selectedSegment, + onValueChanged: (SearchSegment? value) { + if (value != null) { + setState(() { + _selectedSegment = value; + }); + } + }, + children: { + SearchSegment.music: Text( + SearchSegment.music.displayName, + style: TextStyle(color: textColor).useSystemChineseFont(), + ), + SearchSegment.playlist: Text( + SearchSegment.playlist.displayName, + style: TextStyle(color: textColor).useSystemChineseFont(), + ), + }, ), - ], - ), + ), + Expanded( + child: _selectedSegment == SearchSegment.music + ? PagedMusicAggregatorList( + isDesktop: false, + pagingController: pagingControllerMusicAggregator, + ) + : PagedPlaylistGridview( + isDesktop: false, + pagingController: pagingControllerPlaylist, + ), + ), + ], ), ); } diff --git a/lib/src/rust/api/cache/cache_op.dart b/lib/src/rust/api/cache/cache_op.dart index ef51376..cbfea81 100644 --- a/lib/src/rust/api/cache/cache_op.dart +++ b/lib/src/rust/api/cache/cache_op.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/cache/file_cache.dart b/lib/src/rust/api/cache/file_cache.dart index 1487d02..741b442 100644 --- a/lib/src/rust/api/cache/file_cache.dart +++ b/lib/src/rust/api/cache/file_cache.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/cache/music_cache.dart b/lib/src/rust/api/cache/music_cache.dart index 884cf7e..9b841ea 100644 --- a/lib/src/rust/api/cache/music_cache.dart +++ b/lib/src/rust/api/cache/music_cache.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/init.dart b/lib/src/rust/api/init.dart index 8ad660c..f863215 100644 --- a/lib/src/rust/api/init.dart +++ b/lib/src/rust/api/init.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/music_api/fns.dart b/lib/src/rust/api/music_api/fns.dart index 89f2fa6..e167696 100644 --- a/lib/src/rust/api/music_api/fns.dart +++ b/lib/src/rust/api/music_api/fns.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/music_api/mirror.dart b/lib/src/rust/api/music_api/mirror.dart index 30f76a5..507785c 100644 --- a/lib/src/rust/api/music_api/mirror.dart +++ b/lib/src/rust/api/music_api/mirror.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/music_api/plugin_fn.dart b/lib/src/rust/api/music_api/plugin_fn.dart index d8516b6..9702d3f 100644 --- a/lib/src/rust/api/music_api/plugin_fn.dart +++ b/lib/src/rust/api/music_api/plugin_fn.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/music_api/wrapper.dart b/lib/src/rust/api/music_api/wrapper.dart index 9db28d6..bac60e0 100644 --- a/lib/src/rust/api/music_api/wrapper.dart +++ b/lib/src/rust/api/music_api/wrapper.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/types/config.dart b/lib/src/rust/api/types/config.dart index 7dd6be3..b73fac8 100644 --- a/lib/src/rust/api/types/config.dart +++ b/lib/src/rust/api/types/config.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/types/external_api.dart b/lib/src/rust/api/types/external_api.dart index b67c1ca..a9d6ca9 100644 --- a/lib/src/rust/api/types/external_api.dart +++ b/lib/src/rust/api/types/external_api.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/types/playinfo.dart b/lib/src/rust/api/types/playinfo.dart index 8444b3d..022ca8e 100644 --- a/lib/src/rust/api/types/playinfo.dart +++ b/lib/src/rust/api/types/playinfo.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/types/version.dart b/lib/src/rust/api/types/version.dart index ca89585..ab3613e 100644 --- a/lib/src/rust/api/types/version.dart +++ b/lib/src/rust/api/types/version.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/utils/crypto.dart b/lib/src/rust/api/utils/crypto.dart index c3f742e..a6e545c 100644 --- a/lib/src/rust/api/utils/crypto.dart +++ b/lib/src/rust/api/utils/crypto.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/utils/database.dart b/lib/src/rust/api/utils/database.dart index 0a18f60..ae8bffe 100644 --- a/lib/src/rust/api/utils/database.dart +++ b/lib/src/rust/api/utils/database.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/utils/http_helper.dart b/lib/src/rust/api/utils/http_helper.dart index 26a9b9e..8e72c56 100644 --- a/lib/src/rust/api/utils/http_helper.dart +++ b/lib/src/rust/api/utils/http_helper.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/api/utils/path_util.dart b/lib/src/rust/api/utils/path_util.dart index ed4ff03..b97d8bb 100644 --- a/lib/src/rust/api/utils/path_util.dart +++ b/lib/src/rust/api/utils/path_util.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/lib/src/rust/frb_generated.dart b/lib/src/rust/frb_generated.dart index 19b3048..b82345f 100644 --- a/lib/src/rust/frb_generated.dart +++ b/lib/src/rust/frb_generated.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field @@ -80,7 +80,7 @@ class RustLib extends BaseEntrypoint { kDefaultExternalLibraryLoaderConfig; @override - String get codegenVersion => '2.5.0'; + String get codegenVersion => '2.5.1'; @override int get rustContentHash => 539112346; diff --git a/lib/src/rust/frb_generated.io.dart b/lib/src/rust/frb_generated.io.dart index 466aa56..a3c723b 100644 --- a/lib/src/rust/frb_generated.io.dart +++ b/lib/src/rust/frb_generated.io.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field diff --git a/lib/src/rust/frb_generated.web.dart b/lib/src/rust/frb_generated.web.dart index 2f8743c..2794cfd 100644 --- a/lib/src/rust/frb_generated.web.dart +++ b/lib/src/rust/frb_generated.web.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field diff --git a/lib/utils/chore.dart b/lib/utils/chore.dart index e00ecbc..4aa4259 100644 --- a/lib/utils/chore.dart +++ b/lib/utils/chore.dart @@ -44,7 +44,7 @@ Future exitApp() async { bool? globalIsTouchScreenTablet; bool isTouchScreenDesktop(BuildContext context) { - if (isDesktop()) { + if (isDesktopDevice()) { return false; } @@ -58,7 +58,7 @@ bool isTouchScreenDesktop(BuildContext context) { return globalIsTouchScreenTablet!; } -bool isDesktop() { +bool isDesktopDevice() { return Platform.isLinux || Platform.isMacOS || Platform.isWindows; } diff --git a/lib/utils/device_set.dart b/lib/utils/device_set.dart index b0eebb0..b907c71 100644 --- a/lib/utils/device_set.dart +++ b/lib/utils/device_set.dart @@ -7,7 +7,7 @@ import 'package:flutter/services.dart'; Future initDesktopWindowSetting() async { // 初始化桌面窗口设置,仅在桌面平台运行 - if (isDesktop()) { + if (isDesktopDevice()) { doWhenWindowReady(() { if (globalConfig.windowConfig == null) { globalConfig.windowConfig == WindowConfig.default_(); @@ -31,7 +31,7 @@ Future initDesktopWindowSetting() async { } Future initMobileDevice(BuildContext context) async { - if (isDesktop()) { + if (isDesktopDevice()) { return; } diff --git a/pubspec.lock b/pubspec.lock index c401e26..e905509 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -509,10 +509,10 @@ packages: dependency: "direct main" description: name: flutter_rust_bridge - sha256: "0ad5079de35d317650fec59b26cb4d0c116ebc2ce703a29f9367513b8a91c287" + sha256: "5fe868d3cb8cbc4d83091748552e03f00ccfa41b8e44691bc382611f831d5f8b" url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.5.1" flutter_staggered_grid_view: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c9f7264..a33059c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: rust_lib_app_rhyme: path: rust_builder cupertino_icons: ^1.0.6 - flutter_rust_bridge: 2.5.0 + flutter_rust_bridge: 2.5.1 interactive_slider: git: https://github.com/canxin121/interactive_slider dismissible_page: ^1.0.2 diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 827e325..ef281af 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -57,9 +57,9 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" [[package]] name = "allo-isolate" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b6d794345b06592d0ebeed8e477e41b71e5a0a49df4fc0e4184d5938b99509" +checksum = "1f67642eb6773fb42a95dd3b348c305ee18dee6642274c6b412d67e985e3befc" dependencies = [ "anyhow", "atomic", @@ -157,9 +157,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" [[package]] name = "arrayvec" @@ -186,7 +186,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -197,7 +197,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -508,7 +508,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -519,7 +519,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -549,7 +549,7 @@ checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -705,9 +705,9 @@ dependencies = [ [[package]] name = "flutter_rust_bridge" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35a06af75bcc46b5443c2293f99fda22819e816f8a5f5bea04c72f8cb04a106a" +checksum = "2f052ec223b70cbdf2248376a9ad5af9281b3fdf8ea3c7d3f66fff52a9aaf1fa" dependencies = [ "allo-isolate", "android_logger", @@ -735,15 +735,15 @@ dependencies = [ [[package]] name = "flutter_rust_bridge_macros" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9250f0a18500e7825617ddb677bccf1336a2fe4c4edf6c6ce7717967ed67f42e" +checksum = "23414fe526f51870c6d89d27bbffbee52ebe0900164a4147b32caf1d3e131682" dependencies = [ "hex", "md-5", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -828,7 +828,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -1129,7 +1129,7 @@ checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -1305,7 +1305,7 @@ dependencies = [ [[package]] name = "music_api" version = "0.1.0" -source = "git+https://github.com/canxin121/music_api#ea08fb391f0a374f8e954684b72d8afe163463ef" +source = "git+https://github.com/canxin121/music_api#4ea50caf08de6104e61fa89a2a1c3288392ea624" dependencies = [ "aes", "anyhow", @@ -1488,7 +1488,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -1589,7 +1589,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -1675,9 +1675,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -1690,7 +1690,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", "version_check", "yansi", ] @@ -1835,9 +1835,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -1879,9 +1879,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.8" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", @@ -2157,7 +2157,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -2198,7 +2198,7 @@ dependencies = [ "proc-macro2", "quote", "sea-bae", - "syn 2.0.60", + "syn 2.0.86", "unicode-ident", ] @@ -2249,7 +2249,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", "thiserror", ] @@ -2273,34 +2273,34 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] name = "serde_json" -version = "1.0.129" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbcf9b78a125ee667ae19388837dd12294b858d101fdd393cb9d5501ef09eb2" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -2342,7 +2342,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -2524,7 +2524,7 @@ dependencies = [ "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -2547,7 +2547,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.60", + "syn 2.0.86", "tempfile", "tokio", "url", @@ -2697,9 +2697,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c" dependencies = [ "proc-macro2", "quote", @@ -2744,7 +2744,7 @@ checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -2813,9 +2813,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -2837,7 +2837,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -2923,7 +2923,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] @@ -3102,7 +3102,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", "wasm-bindgen-shared", ] @@ -3136,7 +3136,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3427,7 +3427,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.86", ] [[package]] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 3f5b8bc..0cbf56b 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib", "staticlib"] [dependencies] -flutter_rust_bridge = { version = "=2.5.0", features = ["chrono"] } +flutter_rust_bridge = { version = "=2.5.1", features = ["chrono"] } rayon = "1.10.0" futures = "0.3.31" futures-util = "0.3.31" @@ -25,8 +25,8 @@ log = "0.4.22" md-5 = "0.10.6" once_cell = "1.20.2" rand = "0.8.5" -regex = "1.11.0" -reqwest = { version = "0.12.8", features = [ +regex = "1.11.1" +reqwest = { version = "0.12.9", features = [ "json", "rustls-tls", "rustls-tls-webpki-roots", @@ -47,14 +47,14 @@ sea-orm-migration = { version = "1.1.0", features = [ ], default-features = false } sea-query = { version = "0.32.0" } sea-query-binder = { version = "0.7.0", features = ["sqlx-any", "sqlx-sqlite"] } -serde = { version = "1.0.210", features = ["derive"] } -serde_json = "1.0.129" +serde = { version = "1.0.214", features = ["derive"] } +serde_json = "1.0.132" sha2 = "0.10.8" -tokio = { version = "1.40.0", features = ["full"] } +tokio = { version = "1.41.0", features = ["full"] } tracing-subscriber = "0.3.18" urlencoding = "2.1.3" music_api = { git = "https://github.com/canxin121/music_api" } -anyhow = "1.0.89" +anyhow = "1.0.92" [dev-dependencies] serial_test = "3.1.1" diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index 54c852e..d380c0c 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// @generated by `flutter_rust_bridge`@ 2.5.0. +// @generated by `flutter_rust_bridge`@ 2.5.1. #![allow( non_camel_case_types, @@ -37,7 +37,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_opaque = RustOpaqueMoi, default_rust_auto_opaque = RustAutoOpaqueMoi, ); -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.5.0"; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.5.1"; pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 539112346; // Section: executor @@ -6317,7 +6317,7 @@ impl SseEncode for crate::api::types::config::WindowConfig { #[cfg(not(target_family = "wasm"))] mod io { // This file is automatically generated, so please do not edit it. - // @generated by `flutter_rust_bridge`@ 2.5.0. + // @generated by `flutter_rust_bridge`@ 2.5.1. // Section: imports @@ -6354,7 +6354,7 @@ pub use io::*; #[cfg(target_family = "wasm")] mod web { // This file is automatically generated, so please do not edit it. - // @generated by `flutter_rust_bridge`@ 2.5.0. + // @generated by `flutter_rust_bridge`@ 2.5.1. // Section: imports