Skip to content

Commit

Permalink
1.7.2 - Moving to mobx from provider. Fixing issue with expansions no…
Browse files Browse the repository at this point in the history
…t reflected in the collection list when refreshed (#142)

* moving search board games from provider to mobx

* progress on moving to mobx on the players and player page

* fixing issues on the player page

* fixing mass delete of players

* removnig change notifier on the playthrough player

* progress on removing provider from board game details

* fixing isInCollection flag

* fixing highest/lowest scores

* small fix

* fixing issue with importing overriding existing game details

* removing provider reference
  • Loading branch information
mkieres authored Nov 13, 2022
1 parent 7d95802 commit deb2fd3
Show file tree
Hide file tree
Showing 74 changed files with 4,497 additions and 2,188 deletions.
10 changes: 5 additions & 5 deletions board_games_companion/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import 'pages/edit_playthrough/edit_playthrough_view_model.dart';
import 'pages/edit_playthrough/playthrough_note_view_model.dart';
import 'pages/home/home_page.dart';
import 'pages/home/home_view_model.dart';
import 'pages/players/player_page.dart';
import 'pages/players/players_view_model.dart';
import 'pages/player/player_page.dart';
import 'pages/player/player_view_model.dart';
import 'pages/playthroughs/playthroughs_page.dart';
import 'pages/playthroughs/playthroughs_view_model.dart';
import 'pages/settings/settings_page.dart';
Expand Down Expand Up @@ -84,13 +84,13 @@ class BoardGamesCompanionAppState extends State<BoardGamesCompanionApp> {

case PlayerPage.pageRoute:
final arguments = routeSettings.arguments as PlayerPageArguments;
final playersViewModel = getIt<PlayersViewModel>();
final playersViewModel = getIt<PlayerViewModel>();

playersViewModel.setPlayer(player: arguments.player);
playersViewModel.setPlayer(arguments.player);

return MaterialPageRoute<dynamic>(
settings: routeSettings,
builder: (BuildContext context) => PlayerPage(playersViewModel: playersViewModel),
builder: (BuildContext context) => PlayerPage(viewModel: playersViewModel),
);

case PlaythroughsPage.pageRoute:
Expand Down
3 changes: 3 additions & 0 deletions board_games_companion/lib/common/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class AppColors {
static const Color selectedTabIconColor = accentColor;
static const Color deselectedTabIconColor = Color(0x46FFFFFF);

static const Color enabledIconIconColor = accentColor;
static const Color disabledIconIconColor = Color(0x46FFFFFF);

static const Color startDefaultPageBackgroundColorGradient = primaryColorLight;
static const Color endDefaultPageBackgroundColorGradient = primaryColor;

Expand Down
2 changes: 2 additions & 0 deletions board_games_companion/lib/common/app_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class AppText {
static const searchBoardGamesPageHotBoardGamesErrorPartOne =
'''Sorry, we couldn't retrieve hot board games at this time. Please check your Internet connectivity and try again.''';
static const searchBoardGamesPageHotBoardGamesErrorRetryButtonText = 'Retry';
static const searchBoardGamesSearchBarHint = 'Search...';
static const searchBoardGamesSearchRetry = 'Retry';
static const hotBoardGamesSliverSectionTitle = 'Hot Board Games';

static const gamesPageMainGamesSliverSectionTitleFormat = 'Main Games (%s)';
Expand Down
4 changes: 1 addition & 3 deletions board_games_companion/lib/common/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ class AppTheme {
buttonColor: AppColors.accentColor,
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: AppColors.accentColor,
),
style: TextButton.styleFrom(foregroundColor: AppColors.accentColor),
),
textTheme: originalTextTheme.copyWith(
bodyText1: originalBodyText1.copyWith(
Expand Down
2 changes: 1 addition & 1 deletion board_games_companion/lib/extensions/route_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../pages/board_game_details/board_game_details_page.dart';
import '../pages/edit_playthrough/edit_playthrough_page.dart';
import '../pages/edit_playthrough/playthrough_note_page.dart';
import '../pages/home/home_page.dart';
import '../pages/players/player_page.dart';
import '../pages/player/player_page.dart';
import '../pages/playthroughs/playthroughs_page.dart';
import '../pages/settings/settings_page.dart';

Expand Down
127 changes: 65 additions & 62 deletions board_games_companion/lib/injectable.config.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 1 addition & 31 deletions board_games_companion/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:provider/provider.dart';

import 'app.dart';
import 'common/enums/order_by.dart';
Expand All @@ -31,12 +30,7 @@ import 'models/hive/playthrough.dart';
import 'models/hive/score.dart';
import 'models/hive/user.dart';
import 'models/sort_by.dart';
import 'pages/players/players_view_model.dart';
import 'services/analytics_service.dart';
import 'services/board_games_geek_service.dart';
import 'services/preferences_service.dart';
import 'stores/search_bar_board_games_store.dart';
import 'stores/search_board_games_store.dart';

Future<void> main() async {
Fimber.plantTree(DebugTree());
Expand Down Expand Up @@ -104,30 +98,6 @@ class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
preferencesService.setAppLaunchDate();
return MultiProvider(
providers: [
ChangeNotifierProvider<SearchBarBoardGamesStore>(
create: (context) => SearchBarBoardGamesStore(),
),
ChangeNotifierProvider<SearchBoardGamesStore>(
create: (context) {
final BoardGamesGeekService boardGamesGeekService = getIt<BoardGamesGeekService>();
final AnalyticsService analyticsService = getIt<AnalyticsService>();
return SearchBoardGamesStore(
boardGamesGeekService,
Provider.of<SearchBarBoardGamesStore>(
context,
listen: false,
),
analyticsService,
);
},
),
ChangeNotifierProvider<PlayersViewModel>(
create: (context) => getIt<PlayersViewModel>(),
),
],
child: const BoardGamesCompanionApp(),
);
return const BoardGamesCompanionApp();
}
}
5 changes: 0 additions & 5 deletions board_games_companion/lib/models/board_game.dart

This file was deleted.

4 changes: 2 additions & 2 deletions board_games_companion/lib/models/board_game_statistics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BoardGameStatistics {
}

@freezed
abstract class PlayerWinsStatistics with _$PlayerWinsStatistics {
class PlayerWinsStatistics with _$PlayerWinsStatistics {
const factory PlayerWinsStatistics({
required Player player,
required int numberOfWins,
Expand All @@ -51,7 +51,7 @@ abstract class PlayerWinsStatistics with _$PlayerWinsStatistics {
}

@freezed
abstract class PlayerCountStatistics with _$PlayerCountStatistics {
class PlayerCountStatistics with _$PlayerCountStatistics {
const factory PlayerCountStatistics({
required int numberOfPlayers,
required int numberOfGamesPlayed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ abstract class $PlayerWinsStatisticsCopyWith<$Res> {
$Res Function(PlayerWinsStatistics) then) =
_$PlayerWinsStatisticsCopyWithImpl<$Res>;
$Res call({Player player, int numberOfWins, double winsPercentage});

$PlayerCopyWith<$Res> get player;
}

/// @nodoc
Expand Down Expand Up @@ -63,6 +65,13 @@ class _$PlayerWinsStatisticsCopyWithImpl<$Res>
as double,
));
}

@override
$PlayerCopyWith<$Res> get player {
return $PlayerCopyWith<$Res>(_value.player, (value) {
return _then(_value.copyWith(player: value));
});
}
}

/// @nodoc
Expand All @@ -73,6 +82,9 @@ abstract class _$$_PlayerWinsStatisticsCopyWith<$Res>
__$$_PlayerWinsStatisticsCopyWithImpl<$Res>;
@override
$Res call({Player player, int numberOfWins, double winsPercentage});

@override
$PlayerCopyWith<$Res> get player;
}

/// @nodoc
Expand Down
Loading

0 comments on commit deb2fd3

Please sign in to comment.