diff --git a/README.md b/README.md index 675b2ad..2463cb7 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ https://github.com/lazycatlabs/flutter_auth_app/assets/1531684/53f880ed-d51e-4bc - Run `flutter run --flavor stg -t lib/main.dart --dart-define-from-file .env.stg.json` for **staging** or - Run `flutter run --flavor prd -t lib/main.dart --dart-define-from-file .env.prd.json` for **production** - Run Test `flutter test` -- To generate launcher icon based on Flavor `dart pub run flutter_launcher_icons:main -f flutter_launcher_icons*` +- To generate launcher icon based on Flavor `dart run flutter_launcher_icons` - To generate mock class `dart pub run build_runner build` diff --git a/android/app/src/main/kotlin/com/lazycatlabs/base/MainActivity.kt b/android/app/src/main/kotlin/com/lazycatlabs/base/MainActivity.kt index 360a446..52efa8c 100644 --- a/android/app/src/main/kotlin/com/lazycatlabs/base/MainActivity.kt +++ b/android/app/src/main/kotlin/com/lazycatlabs/base/MainActivity.kt @@ -1,6 +1,21 @@ package com.lazycatlabs.auth +import android.os.Build +import android.os.Bundle +import androidx.core.view.WindowCompat import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + // Aligns the Flutter view vertically with the window. + WindowCompat.setDecorFitsSystemWindows(getWindow(), false) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + // Disable the Android splash screen fade out animation to avoid + // a flicker before the similar frame is drawn in Flutter. + splashScreen.setOnExitAnimationListener { splashScreenView -> splashScreenView.remove() } + } + + super.onCreate(savedInstanceState) + } } diff --git a/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png deleted file mode 100644 index b03f5a0..0000000 Binary files a/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png deleted file mode 100644 index d9a20c4..0000000 Binary files a/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index b9aeb57..0000000 Binary files a/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 071493b..0000000 Binary files a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 4bb8120..0000000 Binary files a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml index fc58c18..d592cbe 100644 --- a/android/app/src/main/res/drawable/launch_background.xml +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -1,12 +1,14 @@ - - - + android:gravity="fill_horizontal|fill_vertical" + android:src="@drawable/ic_splash"/> + diff --git a/android/app/src/main/res/drawable/launch_background_12.xml b/android/app/src/main/res/drawable/launch_background_12.xml new file mode 100644 index 0000000..3c50e80 --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background_12.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index ab98328..d227e48 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,4 +1,4 @@ - #ffffff + #1E1E2E \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index d74aa35..d82bc6b 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -5,6 +5,17 @@ @drawable/launch_background + false + false + true + @android:color/transparent + true + true + + + @color/ic_launcher_background + @drawable/launch_background_12 + @@ -13,13 +15,15 @@ - + + - + + - + @@ -28,10 +32,10 @@ - + - + diff --git a/lib/features/users/pages/dashboard/dashboard_page.dart b/lib/features/users/pages/dashboard/dashboard_page.dart index 03e34b9..0f4c289 100644 --- a/lib/features/users/pages/dashboard/dashboard_page.dart +++ b/lib/features/users/pages/dashboard/dashboard_page.dart @@ -95,27 +95,30 @@ class _DashboardPageState extends State { ), ), SpacerH(value: Dimens.space16), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _users[index].name ?? "", - style: Theme.of(context) - .textTheme - .titleLargeBold, - ), - Text( - _users[index].email ?? "", - style: Theme.of(context) - .textTheme - .bodySmall - ?.copyWith( - color: Theme.of(context) - .extension()! - .subtitle, - ), - ), - ], + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + _users[index].name ?? "", + style: Theme.of(context) + .textTheme + .titleLargeBold, + ), + Text( + _users[index].email ?? "", + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: Theme.of(context) + .extension()! + .subtitle, + ), + ), + ], + ), ), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index e5dcd1a..bf44df6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,10 +20,6 @@ version: 1.0.0+1 environment: sdk: ^3.0.0 -dependency_overrides: - intl: ^0.18.1 - analyzer: ^6.0.0 - dependencies: flutter: sdk: flutter diff --git a/test/features/auth/pages/login/login_page_test.dart b/test/features/auth/pages/login/login_page_test.dart index 056d3f8..ac9a9d4 100644 --- a/test/features/auth/pages/login/login_page_test.dart +++ b/test/features/auth/pages/login/login_page_test.dart @@ -63,6 +63,7 @@ void main() { (tester) async { when(() => authCubit.state).thenReturn(const AuthState.success(null)); await tester.pumpWidget(rootWidget(const LoginPage())); + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byType(Button), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll @@ -88,7 +89,9 @@ void main() { when(() => authCubit.state).thenReturn(const AuthState.success(null)); await tester.pumpWidget(rootWidget(const LoginPage())); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('email')), email); + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byType(Button), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll @@ -116,9 +119,12 @@ void main() { when(() => authCubit.login(any())).thenAnswer((_) async {}); await tester.pumpWidget(rootWidget(const LoginPage())); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('email')), email); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('password')), password); + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byType(Button), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll diff --git a/test/features/auth/pages/register/register_page_test.dart b/test/features/auth/pages/register/register_page_test.dart index 3eb8fef..a1790f4 100644 --- a/test/features/auth/pages/register/register_page_test.dart +++ b/test/features/auth/pages/register/register_page_test.dart @@ -65,6 +65,7 @@ void main() { when(() => registerCubit.state) .thenReturn(const RegisterState.success(null)); await tester.pumpWidget(rootWidget(const RegisterPage())); + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byKey(const Key('btn_register')), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll @@ -76,7 +77,9 @@ void main() { await tester.pump(const Duration(milliseconds: 100)); expect(find.text("Email is not valid"), findsOneWidget); expect( - find.text("Password must be at least 6 characters"), findsOneWidget,); + find.text("Password must be at least 6 characters"), + findsOneWidget, + ); }, ); @@ -89,7 +92,9 @@ void main() { .thenReturn(const RegisterState.success(null)); await tester.pumpWidget(rootWidget(const RegisterPage())); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('email')), email); + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byKey(const Key('btn_register')), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll @@ -101,7 +106,9 @@ void main() { await tester.pump(const Duration(milliseconds: 100)); expect(find.text("Email is not valid"), findsNothing); expect( - find.text("Password must be at least 6 characters"), findsOneWidget,); + find.text("Password must be at least 6 characters"), + findsOneWidget, + ); }, ); @@ -114,6 +121,7 @@ void main() { when(() => registerCubit.state) .thenReturn(const RegisterState.success(null)); await tester.pumpWidget(rootWidget(const RegisterPage())); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('email')), email); await tester.enterText(find.byKey(const Key('password')), password); @@ -142,10 +150,12 @@ void main() { when(() => registerCubit.state) .thenReturn(const RegisterState.success(null)); await tester.pumpWidget(rootWidget(const RegisterPage())); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('email')), email); await tester.enterText(find.byKey(const Key('password')), password); await tester.enterText(find.byKey(const Key('repeat_password')), ''); + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byKey(const Key('btn_register')), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll @@ -172,13 +182,16 @@ void main() { when(() => registerCubit.register(any())).thenAnswer((_) async {}); await tester.pumpWidget(rootWidget(const RegisterPage())); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('email')), email); + await tester.pumpAndSettle(); await tester.enterText(find.byKey(const Key('password')), password); + await tester.pumpAndSettle(); await tester.enterText( find.byKey(const Key('repeat_password')), password, ); - + await tester.pumpAndSettle(); await tester.dragUntilVisible( find.byKey(const Key('btn_register')), // what you want to find find.byType(SingleChildScrollView), // widget you want to scroll diff --git a/test/features/general/pages/settings/settings_page_test.dart b/test/features/general/pages/settings/settings_page_test.dart index c7d750f..d34480e 100644 --- a/test/features/general/pages/settings/settings_page_test.dart +++ b/test/features/general/pages/settings/settings_page_test.dart @@ -62,6 +62,7 @@ void main() { when(() => settingsCubit.state).thenReturn(DataHelper()); await tester.pumpWidget(rootWidget(const SettingsPage())); + await tester.pumpAndSettle(); final dropdown = find.byKey(const Key("dropdown_theme")).last; await tester.tap(dropdown); @@ -83,6 +84,7 @@ void main() { when(() => settingsCubit.state).thenReturn(DataHelper()); await tester.pumpWidget(rootWidget(const SettingsPage())); + await tester.pumpAndSettle(); final dropdown = find.byKey(const Key("dropdown_language")).last; await tester.tap(dropdown); diff --git a/test/features/users/pages/dashboard/dashboard_page_test.dart b/test/features/users/pages/dashboard/dashboard_page_test.dart index 889b3bf..251dacc 100644 --- a/test/features/users/pages/dashboard/dashboard_page_test.dart +++ b/test/features/users/pages/dashboard/dashboard_page_test.dart @@ -69,6 +69,7 @@ void main() { (tester) async { when(() => usersCubit.state).thenReturn(const UsersState.loading()); await tester.pumpWidget(rootWidget(const DashboardPage())); + await tester.pump(); expect(find.byType(Loading), findsOneWidget); }, ); @@ -78,6 +79,7 @@ void main() { (tester) async { when(() => usersCubit.state).thenReturn(const UsersState.empty()); await tester.pumpWidget(rootWidget(const DashboardPage())); + await tester.pump(); expect(find.byType(Empty), findsOneWidget); }, ); @@ -87,6 +89,7 @@ void main() { (tester) async { when(() => usersCubit.state).thenReturn(const UsersState.failure("")); await tester.pumpWidget(rootWidget(const DashboardPage())); + await tester.pump(); expect(find.byType(Empty), findsOneWidget); }, ); @@ -98,6 +101,7 @@ void main() { UsersState.success(users), ); await tester.pumpWidget(rootWidget(const DashboardPage())); + await tester.pumpAndSettle(); expect(find.byType(ListView), findsOneWidget); }, ); @@ -111,7 +115,7 @@ void main() { when(() => usersCubit.refreshUsers(any())).thenAnswer((_) async {}); await tester.pumpWidget(rootWidget(const DashboardPage())); - + await tester.pumpAndSettle(); await tester.fling( find.text('Michael Lawson'), const Offset(0.0, 500.0),