Created
August 26, 2022 15:07
-
-
Save salihgueler/44dd4ebc0b99614fcb7b70ebc69f1f34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FutureBuilder<List<AuthUserAttribute>>( | |
| (1) | |
| future: Amplify.Auth.fetchUserAttributes(), | |
| builder: (context, snapshots) { | |
| if (snapshots.hasData) { | |
| final data = snapshots.data; | |
| return Column( | |
| mainAxisSize: MainAxisSize.min, | |
| (2) | |
| children: data!.map( | |
| (element) { | |
| (3) | |
| if (element.userAttributeKey == CognitoUserAttributeKey.emailVerified) { | |
| if (element.value == 'false') { | |
| return Padding( | |
| padding: const EdgeInsets.all(8.0), | |
| child: ElevatedButton( | |
| onPressed: () { | |
| Amplify.Auth.resendUserAttributeConfirmationCode( | |
| userAttributeKey: CognitoUserAttributeKey.email, | |
| ); | |
| context.go('/confirm-user'); | |
| }, | |
| child: const AppButton( | |
| buttonText: 'Confirm Email Change', | |
| isLoading: false, | |
| ), | |
| ), | |
| ); | |
| } else { | |
| return Padding( | |
| padding: const EdgeInsets.all(8.0), | |
| child: Text( | |
| 'key: ${element.userAttributeKey}; value: ${element.value}', | |
| ), | |
| ); | |
| } | |
| } else { | |
| (4) | |
| return Padding( | |
| padding: const EdgeInsets.all(8.0), | |
| child: Text( | |
| 'key: ${element.userAttributeKey}; value: ${element.value}', | |
| ), | |
| ); | |
| } | |
| }, | |
| ).toList(growable: false), | |
| ); | |
| } else { | |
| (5) | |
| return const SizedBox( | |
| height: 100, | |
| child: Center( | |
| child: CircularProgressIndicator(), | |
| ), | |
| ); | |
| } | |
| }, | |
| ), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment