From 690d7fd21a995065175582d2c1b9f7695216ee7f Mon Sep 17 00:00:00 2001 From: up2up Date: Wed, 13 Jan 2021 19:11:34 +0700 Subject: [PATCH] Add play button for navigate from song list page to pv playlist page --- lib/src/pages/favorite_song_page.dart | 37 ++++++++++++++++----------- lib/src/pages/ranking_page.dart | 28 ++++++++++---------- lib/src/pages/song_search_page.dart | 36 +++++++++++++++----------- 3 files changed, 58 insertions(+), 43 deletions(-) diff --git a/lib/src/pages/favorite_song_page.dart b/lib/src/pages/favorite_song_page.dart index 6f9093df..f60d611c 100644 --- a/lib/src/pages/favorite_song_page.dart +++ b/lib/src/pages/favorite_song_page.dart @@ -49,20 +49,27 @@ class FavoriteSongPage extends GetView { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: _buildTitle(context), actions: [ - _buildSearchAction(context), - IconButton( - icon: Icon(Icons.tune), - onPressed: () => Get.to(FavoriteSongFilterPage())) - ]), - body: Obx( - () => (controller.initialLoading.value) - ? CenterLoading() - : SongListView( - songs: controller.results().map((e) => e.song).toList(), - onSelect: this._onTapSong, - onReachLastItem: controller.onReachLastItem, - ), - )); + appBar: AppBar(title: _buildTitle(context), actions: [ + _buildSearchAction(context), + IconButton( + icon: Icon(Icons.tune), + onPressed: () => Get.to(FavoriteSongFilterPage())) + ]), + body: Obx( + () => (controller.initialLoading.value) + ? CenterLoading() + : SongListView( + songs: controller.results().map((e) => e.song).toList(), + onSelect: this._onTapSong, + onReachLastItem: controller.onReachLastItem, + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () => AppPages.openPVPlayListPage( + controller.results().map((e) => e.song).toList(), + title: 'favoriteSongs'.tr), + child: Icon(Icons.play_arrow), + ), + ); } } diff --git a/lib/src/pages/ranking_page.dart b/lib/src/pages/ranking_page.dart index 8d8386e1..d2664cf4 100644 --- a/lib/src/pages/ranking_page.dart +++ b/lib/src/pages/ranking_page.dart @@ -124,19 +124,21 @@ class _RankingPageState extends State final theme = Theme.of(context); return SafeArea( child: Scaffold( - appBar: TabBar( - controller: _tabController, - tabs: _generateTabs(), - labelColor: theme.textSelectionColor, - unselectedLabelColor: theme.textTheme.headline6.color, - ), - body: TabBarView( - controller: _tabController, - children: _generateRankingContent(), - ), - floatingActionButton: FloatingActionButton( - onPressed: () => this._onTapPlaylist(), - child: Icon(Icons.play_arrow))), + appBar: TabBar( + controller: _tabController, + tabs: _generateTabs(), + labelColor: theme.textSelectionColor, + unselectedLabelColor: theme.textTheme.headline6.color, + ), + body: TabBarView( + controller: _tabController, + children: _generateRankingContent(), + ), + floatingActionButton: FloatingActionButton( + onPressed: () => this._onTapPlaylist(), + child: Icon(Icons.play_arrow), + ), + ), ); } } diff --git a/lib/src/pages/song_search_page.dart b/lib/src/pages/song_search_page.dart index 636b3d88..2bcbd391 100644 --- a/lib/src/pages/song_search_page.dart +++ b/lib/src/pages/song_search_page.dart @@ -49,20 +49,26 @@ class SongSearchPage extends GetView { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: _buildTitle(context), actions: [ - _buildSearchAction(context), - IconButton( - icon: Icon(Icons.tune), - onPressed: () => Get.to(SongSearchFilterPage())) - ]), - body: Obx( - () => (controller.initialLoading.value) - ? CenterLoading() - : SongListView( - songs: controller.results.toList(), - onSelect: this._onSelect, - onReachLastItem: controller.onReachLastItem, - ), - )); + appBar: AppBar(title: _buildTitle(context), actions: [ + _buildSearchAction(context), + IconButton( + icon: Icon(Icons.tune), + onPressed: () => Get.to(SongSearchFilterPage())) + ]), + body: Obx( + () => (controller.initialLoading.value) + ? CenterLoading() + : SongListView( + songs: controller.results.toList(), + onSelect: this._onSelect, + onReachLastItem: controller.onReachLastItem, + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () => AppPages.openPVPlayListPage(controller.results(), + title: 'songs'.tr), + child: Icon(Icons.play_arrow), + ), + ); } }