diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f7..f2872cf 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 9.0 diff --git a/lib/app.dart b/lib/app.dart index 28c938a..8b98aa7 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -5,13 +5,13 @@ import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class App extends HookWidget { +class App extends HookConsumerWidget { const App({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); - final themeMode = useProvider(appThemeModeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); + final themeMode = ref.watch(appThemeModeProvider); final appRouter = useMemoized(() => AppRouter()); return MaterialApp.router( theme: theme.data, diff --git a/lib/ui/component/loading/container_with_loading.dart b/lib/ui/component/loading/container_with_loading.dart index 3a6667d..025fe3b 100644 --- a/lib/ui/component/loading/container_with_loading.dart +++ b/lib/ui/component/loading/container_with_loading.dart @@ -1,10 +1,9 @@ import 'package:app/ui/component/loading/loading.dart'; import 'package:app/ui/loading_state_view_model.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class ContainerWithLoading extends HookWidget { +class ContainerWithLoading extends ConsumerWidget { const ContainerWithLoading({ Key? key, required this.child, @@ -13,8 +12,8 @@ class ContainerWithLoading extends HookWidget { final Widget child; @override - Widget build(BuildContext context) { - final state = useProvider(loadingStateProvider); + Widget build(BuildContext context, WidgetRef ref) { + final state = ref.watch(loadingStateProvider); return Stack(children: [ child, state.isLoading ? const Loading() : const SizedBox(), diff --git a/lib/ui/component/loading/loading.dart b/lib/ui/component/loading/loading.dart index 2408447..4dc472a 100644 --- a/lib/ui/component/loading/loading.dart +++ b/lib/ui/component/loading/loading.dart @@ -1,14 +1,13 @@ import 'package:app/ui/theme/app_theme.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class Loading extends HookWidget { +class Loading extends ConsumerWidget { const Loading({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); return Center( child: CircularProgressIndicator( valueColor: AlwaysStoppedAnimation(theme.appColors.accent), diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 65a70ad..864c12c 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -4,15 +4,14 @@ import 'package:app/ui/route/app_route.gr.dart'; import 'package:app/ui/theme/app_theme.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class HomePage extends HookWidget { +class HomePage extends HookConsumerWidget { const HomePage({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); final l10n = useL10n(); return AutoTabsScaffold( routes: const [ diff --git a/lib/ui/news/article_item.dart b/lib/ui/news/article_item.dart index c27f880..a507e0d 100644 --- a/lib/ui/news/article_item.dart +++ b/lib/ui/news/article_item.dart @@ -6,10 +6,9 @@ import 'package:app/ui/route/app_route.dart'; import 'package:app/ui/theme/app_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class ArticleItem extends HookWidget { +class ArticleItem extends HookConsumerWidget { const ArticleItem({ Key? key, required this.article, @@ -26,8 +25,8 @@ class ArticleItem extends HookWidget { ); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); final router = useRouter(); final l10n = useL10n(); return Card( diff --git a/lib/ui/news/connected_new_page.dart b/lib/ui/news/connected_new_page.dart index 69c4a34..eccb8a4 100644 --- a/lib/ui/news/connected_new_page.dart +++ b/lib/ui/news/connected_new_page.dart @@ -7,20 +7,18 @@ import 'package:app/ui/route/app_route.dart'; import 'package:app/ui/theme/app_theme.dart'; import 'package:app/ui/user_view_model.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class ConnectedNewsPage extends HookWidget { +class ConnectedNewsPage extends HookConsumerWidget { const ConnectedNewsPage({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); final l10n = useL10n(); final router = useRouter(); - final user = - useProvider(userViewModelProvider.select((value) => value.user)); + final user = ref.watch(userViewModelProvider.select((value) => value.user)); return Scaffold( appBar: AppBar( diff --git a/lib/ui/news/news_page.dart b/lib/ui/news/news_page.dart index ece94da..0b7f736 100644 --- a/lib/ui/news/news_page.dart +++ b/lib/ui/news/news_page.dart @@ -8,19 +8,18 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class NewsPage extends HookWidget { +class NewsPage extends HookConsumerWidget { const NewsPage({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { final l10n = useL10n(); - final homeViewModel = context.read(newsViewModelProvider); - final news = - useProvider(newsViewModelProvider.select((value) => value.news)); + final homeViewModel = ref.read(newsViewModelProvider); + final news = ref.watch(newsViewModelProvider.select((value) => value.news)); final snapshot = useFuture( useMemoized(() { - return context + return ref .read(loadingStateProvider) .whileLoading(homeViewModel.fetchNews); }, [news?.toString()]), diff --git a/lib/ui/signIn/sign_in_page.dart b/lib/ui/signIn/sign_in_page.dart index 60b03d4..07aab3a 100644 --- a/lib/ui/signIn/sign_in_page.dart +++ b/lib/ui/signIn/sign_in_page.dart @@ -6,21 +6,19 @@ import 'package:app/ui/loading_state_view_model.dart'; import 'package:app/ui/theme/app_theme.dart'; import 'package:app/ui/user_view_model.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:gap/gap.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -class SignInPage extends HookWidget { +class SignInPage extends HookConsumerWidget { const SignInPage({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); final l10n = useL10n(); - final user = - useProvider(userViewModelProvider.select((value) => value.user)); - final userViewModel = context.read(userViewModelProvider); - final loading = context.read(loadingStateProvider); + final user = ref.watch(userViewModelProvider.select((value) => value.user)); + final userViewModel = ref.read(userViewModelProvider); + final loading = ref.read(loadingStateProvider); return Scaffold( appBar: AppBar( @@ -91,7 +89,7 @@ class SignInPage extends HookWidget { ), onPressed: () { loading.whileLoading(() async { - return context.read(userViewModelProvider).signIn(); + return ref.read(userViewModelProvider).signIn(); }); }, icon: Assets.svgs.firebase.svg(width: 24), diff --git a/lib/ui/video/video_page.dart b/lib/ui/video/video_page.dart index 5f12a36..a7bf81c 100644 --- a/lib/ui/video/video_page.dart +++ b/lib/ui/video/video_page.dart @@ -3,16 +3,15 @@ import 'package:app/ui/hook/use_asset_vide_player_controller.dart'; import 'package:app/ui/hook/use_l10n.dart'; import 'package:app/ui/theme/app_theme.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:video_player/video_player.dart'; -class VideoPage extends HookWidget { +class VideoPage extends HookConsumerWidget { const VideoPage({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final theme = useProvider(appThemeProvider); + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(appThemeProvider); final l10n = useL10n(); final videoController = useAssetVideoController( asset: Assets.videos.bigbuckbunny, diff --git a/pubspec.lock b/pubspec.lock index fd63412..36cc3a4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -369,7 +369,7 @@ packages: name: flutter_hooks url: "https://pub.dartlang.org" source: hosted - version: "0.17.0" + version: "0.18.0" flutter_lints: dependency: "direct dev" description: @@ -388,7 +388,7 @@ packages: name: flutter_riverpod url: "https://pub.dartlang.org" source: hosted - version: "0.14.0+3" + version: "1.0.0-dev.11" flutter_svg: dependency: "direct main" description: @@ -419,7 +419,7 @@ packages: name: freezed_annotation url: "https://pub.dartlang.org" source: hosted - version: "0.14.3" + version: "0.15.0" frontend_server_client: dependency: transitive description: @@ -482,7 +482,7 @@ packages: name: hooks_riverpod url: "https://pub.dartlang.org" source: hosted - version: "0.14.0+4" + version: "1.0.0-dev.11" html: dependency: transitive description: @@ -748,7 +748,7 @@ packages: name: riverpod url: "https://pub.dartlang.org" source: hosted - version: "0.14.0+3" + version: "1.0.0-dev.10" shelf: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c4a1945..13c5488 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,8 +22,8 @@ dependencies: firebase_performance: ^0.7.1+2 # For Architecture - flutter_hooks: ^0.17.0 - hooks_riverpod: ^0.14.0+4 + flutter_hooks: ^0.18.0 + hooks_riverpod: ^1.0.0-dev.10 # For Networking dio: ^4.0.1 @@ -34,7 +34,7 @@ dependencies: # For Model json_serializable: ^5.0.2 - freezed_annotation: ^0.14.0 + freezed_annotation: ^0.15.0 # For Navigation auto_route: ^3.0.4