flutter_amplify_auth_ui 1.1.0 copy "flutter_amplify_auth_ui: ^1.1.0" to clipboard
flutter_amplify_auth_ui: ^1.1.0 copied to clipboard

Flutter plugin that automatically generates authentication widget templates based on your Amplify CLI Authentication configuration.

example/README.md

Flutter Amplify Auth UI #

Execute the following command in your project's root folder in order to generate authentication widgets based on your Amplify configuration:

flutter packages pub run flutter_amplify_auth_ui:main

Easily integrate the generated authentication widgets in your project, e.g.:

import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:amplify_flutter/amplify.dart';
import 'package:flutter/material.dart';

import 'generated_auth_classes/sign_in/sign_in_page.dart'; // <-- Import the generated widget

import 'amplifyconfiguration.dart';

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  initState() {
    super.initState();
    _configureAmplify();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Amplify Auth UI Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      home: SignInPage( // <-- Include the generated widget in your widget tree
        onSignIn: (context) => Navigator.push(  //TODO Define what to do after sign in
          context,
          MaterialPageRoute(
            builder: (context) =>
                const MyHomePage(title: 'Flutter Demo Home Page'),
          ),
        ),
      ),
    );
  }

  void _configureAmplify() async {
    if (!mounted) return;

    Amplify.addPlugins([
      AmplifyAuthCognito(),
    ]);

    try {
      await Amplify.configure(amplifyconfig);
    } on AmplifyAlreadyConfiguredException {
      print("Tried to reconfigure Amplify; this can occur when your app restarts on Android.");
    }
  }
}
5
likes
130
points
65
downloads

Documentation

Documentation
API reference

Publisher

verified publisherfinkmoritz.de

Weekly Downloads

Flutter plugin that automatically generates authentication widget templates based on your Amplify CLI Authentication configuration.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

amplify_auth_cognito, amplify_flutter, flutter, path

More

Packages that depend on flutter_amplify_auth_ui