-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from tusharlock10/develop
Develop
- Loading branch information
Showing
13 changed files
with
413 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export './champions.dart'; | ||
export './player_champions.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class PlayerChampionsSortData { | ||
final String iconUrl; | ||
final int sortedIndex; | ||
|
||
PlayerChampionsSortData({ | ||
required this.iconUrl, | ||
required this.sortedIndex, | ||
}); | ||
|
||
int compareTo(PlayerChampionsSortData other) { | ||
return sortedIndex - other.sortedIndex; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export './player_champions.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_hooks/flutter_hooks.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
import 'package:paladinsedge/providers/index.dart' as providers; | ||
import 'package:paladinsedge/screens/player_champions/player_champions_data_source.dart'; | ||
import 'package:paladinsedge/widgets/index.dart' as widgets; | ||
import 'package:syncfusion_flutter_datagrid/datagrid.dart'; | ||
|
||
class PlayerChampions extends HookConsumerWidget { | ||
static const routeName = '/playerChampions'; | ||
|
||
const PlayerChampions({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
// Providers | ||
final playerChampions = ref.watch( | ||
providers.champions.select((_) => _.playerChampions), | ||
); | ||
final championsProvider = ref.read(providers.champions); | ||
|
||
// Variables | ||
final champions = championsProvider.champions; | ||
|
||
// State | ||
final _playerChampionsDataSource = | ||
useState<PlayerChampionsDataSource?>(null); | ||
|
||
// Effects | ||
useEffect( | ||
() { | ||
if (playerChampions == null) return null; | ||
|
||
_playerChampionsDataSource.value = PlayerChampionsDataSource( | ||
champions: champions, | ||
playerChampions: playerChampions, | ||
); | ||
|
||
return null; | ||
}, | ||
[playerChampions], | ||
); | ||
|
||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Player Champions'), | ||
), | ||
body: _playerChampionsDataSource.value == null | ||
? const Center( | ||
child: widgets.LoadingIndicator( | ||
size: 32, | ||
), | ||
) | ||
: SfDataGrid( | ||
allowSorting: true, | ||
rowHeight: 60, | ||
source: _playerChampionsDataSource.value!, | ||
columnWidthMode: ColumnWidthMode.fitByColumnName, | ||
headerGridLinesVisibility: GridLinesVisibility.both, | ||
gridLinesVisibility: GridLinesVisibility.both, | ||
columns: [ | ||
GridColumn( | ||
columnName: 'Champ', | ||
label: const Center( | ||
child: Text('Champs'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Matches', | ||
label: const Center( | ||
child: Text('Matches'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Kills', | ||
label: const Center( | ||
child: Text('Kills'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Deaths', | ||
label: const Center( | ||
child: Text('Deaths'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'KDA', | ||
label: const Center( | ||
child: Text('KDA'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Win Rate', | ||
label: const Center( | ||
child: Text('Win Rate'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Play Time', | ||
autoFitPadding: const EdgeInsets.symmetric(horizontal: 10), | ||
label: const Center( | ||
child: Text('Play Time'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Level', | ||
label: const Center( | ||
child: Text('Level'), | ||
), | ||
), | ||
GridColumn( | ||
columnName: 'Last Played', | ||
label: const Center( | ||
child: Text('Last Played'), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.