Skip to content

Commit ebe0b08

Browse files
authored
Tablet UI (#82)
* upgrade flutter 3.24 * - Remove: - remoteStatUIProvider - statDrawer from DefaultRemoteConfig - all related UI options to the new UI stats * - home UI for tablet * - detail screen horizontal tablet UI * tablet utils to check horizontal size grid has a static extent of 192 and spacing of 8 * listen changes stats in provider * change style of background in stat panel change systemNavigationBarColor to match app bar * empty game list widget * new assets * revert grid to MaxCrossAxisExtent * add new messages and icons * update version * - update amiibos ids - update version in yaml
1 parent dc25f0e commit ebe0b08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+676
-544
lines changed

.github/workflows/qa.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
java_version: '17'
1111
ruby_version: '2.7.2'
12-
flutter_version: '3.22.3'
12+
flutter_version: '3.24.0'
1313

1414
jobs:
1515
android-QA:

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
env:
1111
java_version: '17'
1212
ruby_version: '2.7.2'
13-
flutter_version: '3.22.3'
13+
flutter_version: '3.24.0'
1414

1515
jobs:
1616
android-internal:

assets/databases/amiibos.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -11609,7 +11609,7 @@
1160911609
},
1161011610
{
1161111611
"key": 854,
11612-
"id": null,
11612+
"id": "0801000004360402",
1161311613
"amiiboSeries": "Splatoon",
1161411614
"character": "Callie",
1161511615
"gameSeries": "Splatoon",
@@ -11622,7 +11622,7 @@
1162211622
},
1162311623
{
1162411624
"key": 855,
11625-
"id": null,
11625+
"id": "0802000004370402",
1162611626
"amiiboSeries": "Splatoon",
1162711627
"character": " Marie",
1162811628
"gameSeries": "Splatoon",
@@ -11635,7 +11635,7 @@
1163511635
},
1163611636
{
1163711637
"key": 856,
11638-
"id": null,
11638+
"id": "0803000004380402",
1163911639
"amiiboSeries": "Splatoon",
1164011640
"character": "Pearl",
1164111641
"gameSeries": "Splatoon",
@@ -11648,7 +11648,7 @@
1164811648
},
1164911649
{
1165011650
"key": 857,
11651-
"id": null,
11651+
"id": "0804000004390402",
1165211652
"amiiboSeries": "Splatoon",
1165311653
"character": "Marina",
1165411654
"gameSeries": "Splatoon",
@@ -11660,5 +11660,5 @@
1166011660
"type": "Figure"
1166111661
}
1166211662
],
11663-
"lastUpdated": "2024-08-02T10:00:00.000"
11663+
"lastUpdated": "2024-09-05T10:00:00.000"
1166411664
}
3.89 KB
Binary file not shown.
3.04 KB
Binary file not shown.

assets/game_icons/2.0x/pacman.webp

3.66 KB
Binary file not shown.

assets/game_icons/2.0x/pokeball.webp

5.68 KB
Binary file not shown.

assets/game_icons/2.0x/pokemon.webp

4.94 KB
Binary file not shown.
7.15 KB
Binary file not shown.
8.57 KB
Binary file not shown.
4.15 KB
Binary file not shown.
5.59 KB
Binary file not shown.
4.43 KB
Binary file not shown.

assets/game_icons/3.0x/pacman.webp

5.42 KB
Binary file not shown.

assets/game_icons/3.0x/pokeball.webp

8.25 KB
Binary file not shown.

assets/game_icons/3.0x/pokemon.webp

7.29 KB
Binary file not shown.
10.6 KB
Binary file not shown.
13.1 KB
Binary file not shown.
6.31 KB
Binary file not shown.
7.43 KB
Binary file not shown.
5.91 KB
Binary file not shown.

assets/game_icons/4.0x/pacman.webp

7.14 KB
Binary file not shown.

assets/game_icons/4.0x/pokeball.webp

10.9 KB
Binary file not shown.

assets/game_icons/4.0x/pokemon.webp

9.78 KB
Binary file not shown.
14 KB
Binary file not shown.
18 KB
Binary file not shown.
8.57 KB
Binary file not shown.
2.08 KB
Binary file not shown.

assets/game_icons/pacman-ghost.webp

1.66 KB
Binary file not shown.

assets/game_icons/pacman.webp

1.97 KB
Binary file not shown.

assets/game_icons/pokeball.webp

2.67 KB
Binary file not shown.

assets/game_icons/pokemon.webp

2.58 KB
Binary file not shown.

assets/game_icons/super-mario.webp

3.82 KB
Binary file not shown.
4.27 KB
Binary file not shown.

assets/game_icons/tloz_sword.webp

2.01 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
class RemoteKey {
2-
static const String statDrawer = 'stat_drawer';
32
static const String ownedCategories = 'split_own_categories';
43
}

lib/data/remote_config/model/default_remote_config.dart

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ part 'default_remote_config.g.dart';
77
@freezed
88
class DefaultRemoteConfig with _$DefaultRemoteConfig {
99
const factory DefaultRemoteConfig({
10-
@Default(false) @JsonKey(name: RemoteKey.statDrawer) bool statDrawer,
1110
@Default(false) @JsonKey(name: RemoteKey.ownedCategories) bool ownedCategories,
1211
}) = _DefaultRemoteConfig;
1312

lib/l10n/intl_en.arb

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@
101101
"showGrid": "Grid",
102102
"hide_caution": "Caution, disabling a feature will hide it from all aspects of the app",
103103
"export_complete": "Export completed!",
104-
"select_user_attribute": "Select a category"
104+
"select_user_attribute": "Select a category",
105+
"emptyMessageType": "{choice, select, pokemon {Gotta collect 'em all} pokeball {Gotta collect 'em all} mario {Your collection is in another castle} mushroom {1UP Collection this way} pacman {Hungry for amiibos} pacmanGhost {Hungry for amiibos?} link {Hyaaa!! (No amiibos here)} other {Nothing to see here. . .yet}}"
105106
}

lib/l10n/intl_es.arb

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@
101101
"showGrid": "Cuadrícula",
102102
"hide_caution": "Precaución, deshabilitar una funcionalidad la escondera en toda la app",
103103
"export_complete": "Archivo guardado",
104-
"select_user_attribute": "Seleccione una categoría"
104+
"select_user_attribute": "Seleccione una categoría",
105+
"emptyMessageType": "{choice, select, pokemon {Tengo que atraparlos!} pokeball {Tengo que atraparlos!} mario {Lo lamento, pero tu colección parece estar en otro castillo} mushroom {1 colección extra aquí} pacman {Habmre por amiibos} pacmanGhost {¿Hambre por amiibos?} link {Hyaaa!! (No hay amiibos aquí)} other {No hay nada que mostrar . . . aún}}"
105106
}

lib/l10n/intl_fr.arb

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@
101101
"showGrid": "Grille",
102102
"hide_caution": "Attention, la désactivation d'une caractéristique la masquera dans l'ensemble de l'application",
103103
"export_complete": "Exportation terminée",
104-
"select_user_attribute": "Choisir une catégorie"
104+
"select_user_attribute": "Choisir une catégorie",
105+
"emptyMessageType": "{choice, select, other {Rien à voir ici ... encore}}"
105106
}

lib/repository/theme_repository.dart

+10-2
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,16 @@ class AmiiboTheme3 implements AmiiboTheme {
14501450
statusBarBrightness: inverseBrightness,
14511451
statusBarIconBrightness: inverseBrightness,
14521452
systemNavigationBarIconBrightness: inverseBrightness,
1453-
systemNavigationBarColor: scheme.surface,
1453+
systemNavigationBarColor: ElevationOverlay.applySurfaceTint(
1454+
scheme.surface,
1455+
scheme.surfaceTint,
1456+
2.0,
1457+
),
1458+
systemNavigationBarDividerColor: ElevationOverlay.applySurfaceTint(
1459+
scheme.surface,
1460+
scheme.surfaceTint,
1461+
6.0,
1462+
),
14541463
systemStatusBarContrastEnforced: false,
14551464
statusBarColor: Colors.transparent,
14561465
),
@@ -1503,7 +1512,6 @@ class AmiiboTheme3 implements AmiiboTheme {
15031512

15041513
/// Deprecated in the future
15051514
brightness: scheme.brightness,
1506-
buttonBarTheme: const ButtonBarThemeData(),
15071515
buttonTheme: ButtonThemeData(
15081516
// Deprecated: Used in old RaisedButton/FlatButton
15091517
textTheme: ButtonTextTheme.normal,

lib/resources/game_assets_icons.dart

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
part of 'resources.dart';
2+
3+
class GameIcons {
4+
GameIcons._();
5+
6+
static const String nintendoSwitch = 'assets/game_icons/nintendo-switch.webp';
7+
static const String pacmanGhost = 'assets/game_icons/pacman-ghost.webp';
8+
static const String pacman = 'assets/game_icons/pacman.webp';
9+
static const String pokeball = 'assets/game_icons/pokeball.webp';
10+
static const String pokemon = 'assets/game_icons/pokemon.webp';
11+
static const String superMario = 'assets/game_icons/super-mario.webp';
12+
static const String superMarioToad =
13+
'assets/game_icons/super_mario_toad.webp';
14+
static const String tlozSword = 'assets/game_icons/tloz_sword.webp';
15+
}

lib/resources/resources.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
part 'assets_icons.dart';
2+
3+
part 'game_assets_icons.dart';

lib/riverpod/stat_ui_remote_config_provider.dart

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import 'package:amiibo_network/data/remote_config/constants/remote_constant_key.
22
import 'package:firebase_remote_config/firebase_remote_config.dart';
33
import 'package:hooks_riverpod/hooks_riverpod.dart';
44

5-
final remoteStatUIProvider = Provider<bool>(
6-
(_) => FirebaseRemoteConfig.instance.getBool(RemoteKey.statDrawer),
7-
);
8-
95
final remoteOwnedCategoryProvider = Provider<bool>(
106
(_) => FirebaseRemoteConfig.instance.getBool(RemoteKey.ownedCategories),
117
);
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import 'dart:async';
2+
3+
import 'package:amiibo_network/model/search_result.dart';
4+
import 'package:amiibo_network/model/stat.dart';
5+
import 'package:amiibo_network/riverpod/query_provider.dart';
6+
import 'package:amiibo_network/riverpod/service_provider.dart';
7+
import 'package:hooks_riverpod/hooks_riverpod.dart';
8+
9+
final statsProvider = StreamProvider.autoDispose<List<Stat>>((ref) async* {
10+
final service = ref.watch(serviceProvider.notifier);
11+
final streamController = StreamController<Filter>();
12+
13+
void listen() {
14+
streamController.sink.add(ref.read(filterProvider));
15+
}
16+
17+
service.addListener(listen);
18+
19+
final subscription = ref.listen(
20+
filterProvider,
21+
(previous, next) {
22+
if (next != previous) {
23+
streamController.sink.add(next);
24+
}
25+
},
26+
fireImmediately: true,
27+
);
28+
29+
ref.onDispose(() {
30+
subscription.close();
31+
service.removeListener(listen);
32+
streamController.close();
33+
});
34+
35+
yield* streamController.stream.asyncMap((filter) async => <Stat>[
36+
...await service.fetchStats(
37+
categoryAttributes: filter.categoryAttributes,
38+
searchAttributes: filter.searchAttributes,
39+
hiddenCategories: filter.hiddenType,
40+
),
41+
...await service.fetchStats(
42+
group: true,
43+
categoryAttributes: filter.categoryAttributes,
44+
searchAttributes: filter.searchAttributes,
45+
hiddenCategories: filter.hiddenType,
46+
),
47+
],
48+
);
49+
});

lib/screen/detail_page.dart

+62-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:amiibo_network/resources/resources.dart';
22
import 'package:amiibo_network/riverpod/amiibo_provider.dart';
33
import 'package:amiibo_network/riverpod/preferences_provider.dart';
4+
import 'package:amiibo_network/utils/tablet_utils.dart';
45
import 'package:amiibo_network/widget/amiibo_button_toggle.dart';
56
import 'package:amiibo_network/widget/card_details.dart';
67
import 'package:amiibo_network/widget/detail/amiibo_header_card.dart';
@@ -12,8 +13,9 @@ import 'package:gap/gap.dart';
1213
import 'package:hooks_riverpod/hooks_riverpod.dart';
1314

1415
final _nameAmiiboProvider = Provider.autoDispose
15-
.family<AsyncValue<String?>, int>((ref, key) =>
16-
ref.watch(detailAmiiboProvider(key)).whenData((cb) => cb?.details.name));
16+
.family<AsyncValue<String?>, int>((ref, key) => ref
17+
.watch(detailAmiiboProvider(key))
18+
.whenData((cb) => cb?.details.name));
1719

1820
class DetailPage extends ConsumerWidget {
1921
const DetailPage({Key? key}) : super(key: key);
@@ -22,17 +24,67 @@ class DetailPage extends ConsumerWidget {
2224
Widget build(BuildContext context, WidgetRef ref) {
2325
final key = ref.watch(keyAmiiboProvider);
2426
final showOwnerCategories = ref.watch(ownTypesCategoryProvider);
27+
final isTablet = isHorizontalTablet(MediaQuery.of(context).size);
28+
final Widget body;
29+
if (isTablet) {
30+
final theme = Theme.of(context);
31+
final cardColor = theme.colorScheme.surface;
32+
body = Row(
33+
mainAxisAlignment: MainAxisAlignment.start,
34+
crossAxisAlignment: CrossAxisAlignment.stretch,
35+
children: [
36+
SizedBox(
37+
width: 400.0,
38+
child: Material(
39+
elevation: 2.0,
40+
color: cardColor,
41+
surfaceTintColor: theme.colorScheme.primary,
42+
child: Column(
43+
children: showOwnerCategories
44+
? const [
45+
AmiiboCard(),
46+
Gap(12.0),
47+
UserPreferenceCard(),
48+
]
49+
: const [_AmiiboCard()],
50+
),
51+
),
52+
),
53+
const Expanded(
54+
child: CustomScrollView(
55+
slivers: [GameListWidget()],
56+
),
57+
),
58+
],
59+
);
60+
} else {
61+
body = CustomScrollView(
62+
slivers: [
63+
if (showOwnerCategories) ...const [
64+
SliverToBoxAdapter(child: AmiiboCard()),
65+
SliverGap(12.0),
66+
PreferencesSliver(),
67+
SliverGap(12),
68+
] else
69+
SliverToBoxAdapter(child: _AmiiboCard()),
70+
const SliverPadding(
71+
padding: EdgeInsets.symmetric(vertical: 8.0),
72+
sliver: GameListWidget(),
73+
),
74+
],
75+
);
76+
}
2577
return Scaffold(
2678
appBar: AppBar(
2779
shadowColor: Colors.transparent,
2880
centerTitle: false,
2981
titleSpacing: 0.0,
3082
titleTextStyle: AppBarTheme.of(context).titleTextStyle?.copyWith(
31-
fontSize: 22.0,
32-
fontWeight: FontWeight.normal,
33-
letterSpacing: -0.25,
34-
wordSpacing: -0.15,
35-
),
83+
fontSize: 22.0,
84+
fontWeight: FontWeight.normal,
85+
letterSpacing: -0.25,
86+
wordSpacing: -0.15,
87+
),
3688
title: Consumer(
3789
builder: (context, ref, _) => ref
3890
.watch(_nameAmiiboProvider(key))
@@ -42,21 +94,7 @@ class DetailPage extends ConsumerWidget {
4294
),
4395
),
4496
),
45-
body: CustomScrollView(
46-
slivers: [
47-
if (showOwnerCategories) ...const [
48-
SliverToBoxAdapter(child: AmiiboCard()),
49-
SliverGap(12.0),
50-
PreferencesSliver(),
51-
SliverGap(12),
52-
]
53-
else SliverToBoxAdapter(child: _AmiiboCard()),
54-
const SliverPadding(
55-
padding: EdgeInsets.symmetric(vertical: 8.0),
56-
sliver: GameListWidget(),
57-
),
58-
],
59-
),
97+
body: body,
6098
);
6199
}
62100
}
@@ -153,9 +191,9 @@ class _AmiiboCard extends ConsumerWidget {
153191
mainAxisSize: MainAxisSize.min,
154192
crossAxisAlignment: CrossAxisAlignment.start,
155193
children: <Widget>[
156-
Expanded(flex: 4, child: letf),
194+
Expanded(flex: 2, child: letf),
157195
const VerticalDivider(indent: 0.0, endIndent: 0.0, width: 24.0),
158-
const Expanded(flex: 7, child: _AmiiboInfo()),
196+
const Expanded(flex: 3, child: _AmiiboInfo()),
159197
],
160198
),
161199
),

0 commit comments

Comments
 (0)