This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 261
/
app.dart
38 lines (36 loc) · 1.4 KB
/
app.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import 'package:app/constants.dart';
import 'package:app/l10n/delegate.dart';
import 'package:app/ui/app_theme.dart';
import 'package:app/ui/component/loading.dart';
import 'package:app/ui/detail/datail_page.dart';
import 'package:app/ui/home/home_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
class App extends HookWidget {
@override
Widget build(BuildContext context) {
final appTheme = useProvider(appThemeNotifierProvider);
final themeData = useMemoized(() => appTheme.themeData, [appTheme.setting]);
final snapshot = useFuture(themeData);
return snapshot.hasData
? MaterialApp(
title: 'Flutter Architecture Blueprints',
theme: snapshot.data ?? lightTheme,
darkTheme: darkTheme,
home: HomePage(),
localizationsDelegates: const [
L10nDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: const [Locale('en'), Locale('ja')],
routes: {
Constants.PAGE_HOME: (context) => HomePage(),
Constants.PAGE_DETAIL: (context) => DetailPage(),
},
)
: const Center(child: Loading());
}
}