aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.32k stars 248 forks source link

Authenticator.builder() on MaterialApp bugs Hero transitions #2332

Open ghi8GPA opened 1 year ago

ghi8GPA commented 1 year ago

Description

Hello,

we are trying to implement a Flutter App using Amplify. We are integrating Authenticator component. It seems to work fine, but it is breaking all our Hero transition, when adding Authenticator.builder() to our Material App.

without Authenticator.builder() Simulator Screen Recording - iPhone 13 Pro Max - 2022-11-09 at 10 15 16

with Authenticator.builder() Simulator Screen Recording - iPhone 13 Pro Max - 2022-11-09 at 10 15 44

This is our code for the Authenticator Component: @override Widget build(BuildContext context) { return Authenticator( child: MaterialApp( title: 'title'.tr(), debugShowCheckedModeBanner: false, localizationsDelegates: context.localizationDelegates, supportedLocales: context.supportedLocales, locale: context.locale, builder: Authenticator.builder(), home: Theme( data: Theme.of(context).copyWith( splashColor: Colors.transparent, highlightColor: Colors.transparent, textTheme: GoogleFonts.openSansTextTheme(Theme.of(context).textTheme), ), child: const MyStatefulWidget(), )) ); }

This is our code for the page transition: onTap: () { HapticFeedback.selectionClick(); Navigator.push( context, PageRouteBuilder( transitionDuration: const Duration(milliseconds: 100), pageBuilder: ( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) { return VoucherDetailsScreen(_voucherList[i].id, _voucherList[i].image); }, transitionsBuilder: ( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) { return Align( child: FadeTransition( opacity: animation, child: child, ), ); }, ), );

Is is possibile that Authenticator.builder() breaks every Page transition using Heroes class?

Categories

Steps to Reproduce

Add - remove builder: Authenticator.builder(), with a Page transition using a Hero class

Screenshots

Simulator Screen Recording - iPhone 13 Pro Max - 2022-11-09 at 10 15 44 ![Uploading Simulator Screen Recording - iPhone 13 Pro Max - 2022-11-09 at 10.15.16.gif…]()

Platforms

Android Device/Emulator API Level

No response

Environment

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.7, on macOS 12.3 21E230 darwin-arm, locale en-IT)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.73.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 2 categories.

Dependencies

Dart SDK 2.18.4
Flutter SDK 3.3.7

dependencies:
- amplify_api 0.6.9 [amplify_api_android amplify_api_ios amplify_core amplify_flutter aws_common collection flutter meta plugin_platform_interface]
- amplify_auth_cognito 0.6.9 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_core aws_common collection flutter meta plugin_platform_interface]
- amplify_authenticator 0.2.3 [amplify_auth_cognito amplify_core amplify_flutter async aws_common collection flutter flutter_localizations intl stream_transform]
- amplify_flutter 0.6.9 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios aws_common collection flutter meta plugin_platform_interface]
- cupertino_icons 1.0.5
- easy_localization 3.0.1 [flutter shared_preferences intl args path easy_logger flutter_localizations]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- google_fonts 3.0.1 [flutter http path_provider crypto]
- infinite_scroll_pagination 3.2.0 [flutter sliver_tools]
- pull_to_refresh 2.0.0 [flutter]
- skeletons 0.0.3 [flutter]

transitive dependencies:
- amplify_api_android 0.6.9 [flutter]
- amplify_api_ios 0.6.9 [amplify_core flutter]
- amplify_auth_cognito_android 0.6.9 [flutter]
- amplify_auth_cognito_ios 0.6.9 [amplify_core flutter]
- amplify_core 0.6.9 [aws_common collection flutter intl json_annotation meta plugin_platform_interface uuid]
- amplify_datastore_plugin_interface 0.6.9 [amplify_core collection flutter meta]
- amplify_flutter_android 0.6.9 [flutter]
- amplify_flutter_ios 0.6.9 [amplify_core flutter]
- args 2.3.1
- async 2.9.0 [collection meta]
- aws_common 0.1.1 [async collection http meta stream_transform uuid]
- characters 1.2.1
- clock 1.1.1
- collection 1.16.0
- crypto 3.0.2 [typed_data]
- easy_logger 0.0.2 [flutter]
- ffi 2.0.1
- file 6.1.4 [meta path]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- http 0.13.5 [async http_parser meta path]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- intl 0.17.0 [clock path]
- js 0.6.4
- json_annotation 4.7.0 [meta]
- material_color_utilities 0.1.5
- meta 1.8.0
- path 1.8.2
- path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.21 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.11 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.5 [flutter platform plugin_platform_interface]
- path_provider_windows 2.1.3 [ffi flutter path path_provider_platform_interface win32]
- platform 3.1.0
- plugin_platform_interface 2.1.3 [meta]
- process 4.2.4 [file path platform]
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- shared_preferences_android 2.0.14 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sky_engine 0.0.99
- sliver_tools 0.2.8 [flutter]
- source_span 1.9.0 [collection path term_glyph]
- stream_transform 2.1.0
- string_scanner 1.1.1 [source_span]
- term_glyph 1.2.1
- typed_data 1.3.1 [collection]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- win32 3.1.1 [ffi]
- xdg_directories 0.2.0+2 [meta path process]

Device

Iphone 13 Pro MaX (iOS simulator)

OS

iOs 15

Deployment Method

Amplify CLI + Custom Pipeline

CLI Version

10.3.2

Additional Context

No response

Amplify Config

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
"auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "XXX",
                            "Region": "XXX"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "XXX",
                        "AppClientId": "XXX",
                        "Region": "XXX"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [],
                        "usernameAttributes": [
                            "EMAIL"
                        ],
                        "signupAttributes": [
                            "EMAIL"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                },
                "AppSync": {
                    "Default": {
                        "ApiUrl": "XXX",
                        "Region": "XXX",
                        "AuthMode": "AMAZON_COGNITO_USER_POOLS",
                        "ClientDatabasePrefix": "XXX"
                    },
                    "dolceparadisoapp_AWS_IAM": {
                        "ApiUrl": "XXX",
                        "Region": "XXX",
                        "AuthMode": "AWS_IAM",
                        "ClientDatabasePrefix": "XXX"
                    }
                }
            }
        }
    },
    "api": {
        "plugins": {
            "awsAPIPlugin": {
                "dolceparadisoapp": {
                    "endpointType": "GraphQL",
                    "endpoint": "XXX",
                    "region": "XXX",
                    "authorizationType": "AMAZON_COGNITO_USER_POOLS"
                }
            }
        }
    }
}
Jordan-Nelson commented 1 year ago

@ghi8GPA - Thanks for opening the issue. I was able to reproduce this. I will take a look and see if this is something we can resolve.

Jordan-Nelson commented 1 year ago

@ghi8GPA - We have merged a fix for this for those using Authenticator.builder(), which will be included in the next authenticator release.

For anyone using AuthenticatedView() to guard only a subset of the views in the app, solving this may require a fix for https://github.com/flutter/flutter/issues/115159

Jordan-Nelson commented 1 year ago

FYI - the fix for Authenticator.builder() was released. I will keep this open to track the fix for AuthenticatedView