Skip to content

Commit

Permalink
chore: Resolve comments (#75)
Browse files Browse the repository at this point in the history
* Resolve comments

* resolve comments again
  • Loading branch information
SolMendiola authored Jan 26, 2023
1 parent 15ad3af commit 5787a72
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 32 deletions.
28 changes: 12 additions & 16 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xmartlabs.flutter_template">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
</queries>

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
Expand Down Expand Up @@ -29,20 +41,4 @@
android:name="flutterEmbedding"
android:value="2"/>
</application>
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />329
</intent>
</queries>
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

</manifest>
8 changes: 4 additions & 4 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>youtube</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
Expand Down Expand Up @@ -50,5 +46,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>youtube</string>
</array>
</dict>
</plist>
10 changes: 10 additions & 0 deletions lib/core/common/result.dart
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -29,6 +31,14 @@ abstract class Result<S> extends Equatable {
}
}

static Future<Result<S>> from<S>(Future<S> 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<Object?>((error) => error, (data) => null);

Expand Down
4 changes: 2 additions & 2 deletions lib/ui/about/about_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ class _TermsAndPolicySection extends StatelessWidget {
children: [
AppPrimaryButton(
text: context.localizations.about_button_terms,
action: () => context
onPressed: () => context
.read<AboutCubit>()
.onTermsAndConditionsButtonPressed(),
),
SizedBox(width: 15.w),
AppPrimaryButton(
text: context.localizations.about_button_privacy,
action: () =>
onPressed: () =>
context.read<AboutCubit>().onPrivacyPolicyButtonPressed(),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/catalog/catalog_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CatalogScreenState extends State<CatalogScreen> {
),
AppPrimaryButton(
text: 'hello',
action: controllerAppButton.clear,
onPressed: controllerAppButton.clear,
),
Fab(
state: const FabState.notSelected(),
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/common/app_base_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/common/app_primary_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ 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);

@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,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/common/app_secondary_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
1 change: 1 addition & 0 deletions lib/ui/main/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class _SplashContentScreen extends StatelessWidget {
@override
Widget build(BuildContext context) => BlocBuilder<MainCubit, MainBaseState>(
builder: (context, state) => MaterialApp.router(
debugShowCheckedModeBanner: false,
theme: AppTheme.provideAppTheme(context),
routerDelegate: AutoRouterDelegate.declarative(
router,
Expand Down
13 changes: 11 additions & 2 deletions lib/ui/videos/videos.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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),
),
);
},
),
],
),
Expand Down

0 comments on commit 5787a72

Please sign in to comment.