diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d261653..a0e3f5b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,17 @@ + + + + + + + + + + + + @@ -29,20 +41,4 @@ android:name="flutterEmbedding" android:value="2"/> - - - - - - - - 329 - - - - - - \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 69d1938..cbd9673 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,10 +2,6 @@ - LSApplicationQueriesSchemes - - youtube - CADisableMinimumFrameDurationOnPhone CFBundleDevelopmentRegion @@ -50,5 +46,9 @@ UIViewControllerBasedStatusBarAppearance + LSApplicationQueriesSchemes + + youtube + diff --git a/lib/core/common/result.dart b/lib/core/common/result.dart index a37695b..be97f09 100644 --- a/lib/core/common/result.dart +++ b/lib/core/common/result.dart @@ -1,5 +1,7 @@ // ignore_for_file: no-object-declaration +import 'dart:async'; + import 'package:equatable/equatable.dart'; // Code: https://gist.githubusercontent.com/CassiusPacheco/409e66e220ce563440df00385f39ac98/raw/d0506e4b3dadbcf5a21d9cc23b300ecbcc8c57d6/data_result.dart @@ -29,6 +31,14 @@ abstract class Result extends Equatable { } } + static Future> from(Future Function() computation) async { + try { + return Result.success(await computation()); + } catch (e) { + return Result.failure(e); + } + } + /// Get [error] value, returns null when the value is actually [data] Object? get error => fold((error) => error, (data) => null); diff --git a/lib/ui/about/about_screen.dart b/lib/ui/about/about_screen.dart index a29a594..2bfed79 100644 --- a/lib/ui/about/about_screen.dart +++ b/lib/ui/about/about_screen.dart @@ -95,14 +95,14 @@ class _TermsAndPolicySection extends StatelessWidget { children: [ AppPrimaryButton( text: context.localizations.about_button_terms, - action: () => context + onPressed: () => context .read() .onTermsAndConditionsButtonPressed(), ), SizedBox(width: 15.w), AppPrimaryButton( text: context.localizations.about_button_privacy, - action: () => + onPressed: () => context.read().onPrivacyPolicyButtonPressed(), ), ], diff --git a/lib/ui/catalog/catalog_screen.dart b/lib/ui/catalog/catalog_screen.dart index cb21428..63579a8 100644 --- a/lib/ui/catalog/catalog_screen.dart +++ b/lib/ui/catalog/catalog_screen.dart @@ -51,7 +51,7 @@ class CatalogScreenState extends State { ), AppPrimaryButton( text: 'hello', - action: controllerAppButton.clear, + onPressed: controllerAppButton.clear, ), Fab( state: const FabState.notSelected(), diff --git a/lib/ui/common/app_base_button.dart b/lib/ui/common/app_base_button.dart index 58f64d5..e834729 100644 --- a/lib/ui/common/app_base_button.dart +++ b/lib/ui/common/app_base_button.dart @@ -5,14 +5,14 @@ import 'package:fluttips/ui/theme/app_theme.dart'; class AppBaseButton extends StatelessWidget { final String text; - final VoidCallback action; + final VoidCallback onPressed; final Color backgroundColor; final Color textColor; final Image? image; const AppBaseButton({ required this.text, - required this.action, + required this.onPressed, required this.backgroundColor, required this.textColor, this.image, @@ -30,7 +30,7 @@ class AppBaseButton extends StatelessWidget { elevation: 5, color: backgroundColor, textColor: textColor, - onPressed: action, + onPressed: onPressed, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceEvenly, diff --git a/lib/ui/common/app_primary_button.dart b/lib/ui/common/app_primary_button.dart index a012bbf..16dc2ec 100644 --- a/lib/ui/common/app_primary_button.dart +++ b/lib/ui/common/app_primary_button.dart @@ -5,12 +5,12 @@ import 'package:fluttips/ui/theme/app_theme.dart'; class AppPrimaryButton extends StatelessWidget { final String text; - final VoidCallback action; + final VoidCallback onPressed; final Image? image; const AppPrimaryButton({ required this.text, - required this.action, + required this.onPressed, this.image, Key? key, }) : super(key: key); @@ -18,7 +18,7 @@ class AppPrimaryButton extends StatelessWidget { @override Widget build(BuildContext context) => AppBaseButton( text: text, - action: action, + onPressed: onPressed, image: image, backgroundColor: context.theme.colors.primary.shade100, textColor: context.theme.colors.primary, diff --git a/lib/ui/common/app_secondary_button.dart b/lib/ui/common/app_secondary_button.dart index 1979b83..a1c74be 100644 --- a/lib/ui/common/app_secondary_button.dart +++ b/lib/ui/common/app_secondary_button.dart @@ -16,7 +16,7 @@ class AppSecondaryButton extends StatelessWidget { @override Widget build(BuildContext context) => AppBaseButton( text: text, - action: action, + onPressed: action, backgroundColor: Colors.transparent, textColor: context.theme.colors.surface, ); diff --git a/lib/ui/main/main_screen.dart b/lib/ui/main/main_screen.dart index deb3e61..e5ff618 100644 --- a/lib/ui/main/main_screen.dart +++ b/lib/ui/main/main_screen.dart @@ -27,6 +27,7 @@ class _SplashContentScreen extends StatelessWidget { @override Widget build(BuildContext context) => BlocBuilder( builder: (context, state) => MaterialApp.router( + debugShowCheckedModeBanner: false, theme: AppTheme.provideAppTheme(context), routerDelegate: AutoRouterDelegate.declarative( router, diff --git a/lib/ui/videos/videos.dart b/lib/ui/videos/videos.dart index 4c28ac1..8a34353 100644 --- a/lib/ui/videos/videos.dart +++ b/lib/ui/videos/videos.dart @@ -1,5 +1,8 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:fluttips/core/common/logger.dart'; import 'package:fluttips/ui/common/app_primary_button.dart'; import 'package:fluttips/ui/common/context_extensions.dart'; import 'package:fluttips/ui/helper/launch_helper.dart'; @@ -44,8 +47,14 @@ class _VideosContentScreen extends StatelessWidget { AppPrimaryButton( image: Assets.images.icYoutubeLogo.image(), text: context.localizations.videos_button, - action: () => - openYoutubePlaylist(Config.widgetOfTheWeekPlaylistId), + onPressed: () { + unawaited( + openYoutubePlaylist(Config.widgetOfTheWeekPlaylistId).onError( + (error, stackTrace) => + Logger.w("Error opening youtube", error, stackTrace), + ), + ); + }, ), ], ),