Skip to content

Commit

Permalink
Update ui ranking to same as prod current version
Browse files Browse the repository at this point in the history
  • Loading branch information
up2code committed Jan 13, 2021
1 parent 88581d6 commit 8b5a0b6
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions lib/src/pages/ranking_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,28 @@ class _RankingPageState extends State<RankingPage>
List<Widget> contents = [];

if (constRankings.contains('daily')) {
contents.add(Obx(() => SongListView(
contents.add(Obx(() => RankingSongsContent(
songs: _rankingController.daily.toList(),
onSelect: (s) => this._onTabSong(s),
)));
}

if (constRankings.contains('weekly')) {
contents.add(Obx(() => SongListView(
contents.add(Obx(() => RankingSongsContent(
songs: _rankingController.weekly.toList(),
onSelect: (s) => this._onTabSong(s),
)));
}

if (constRankings.contains('monthly')) {
contents.add(Obx(() => SongListView(
contents.add(Obx(() => RankingSongsContent(
songs: _rankingController.monthly.toList(),
onSelect: (s) => this._onTabSong(s),
)));
}

if (constRankings.contains('overall')) {
contents.add(Obx(() => SongListView(
contents.add(Obx(() => RankingSongsContent(
songs: _rankingController.overall.toList(),
onSelect: (s) => this._onTabSong(s),
)));
Expand Down Expand Up @@ -146,3 +146,23 @@ class _RankingPageState extends State<RankingPage>
);
}
}

class RankingSongsContent extends StatelessWidget {
final List<SongModel> songs;

final Function(SongModel) onSelect;

const RankingSongsContent({Key key, this.songs, this.onSelect})
: super(key: key);

@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: songs.length,
itemBuilder: (context, index) {
return SongTile.song(songs[index],
leading: Text((index + 1).toString()));
},
);
}
}

0 comments on commit 8b5a0b6

Please sign in to comment.