auth_ui_flutter 2.0.0 copy "auth_ui_flutter: ^2.0.0" to clipboard
auth_ui_flutter: ^2.0.0 copied to clipboard

A flutter plug-in for the native AuthUI library (Android and iOS).

example/lib/main.dart

import 'dart:async';

import 'package:auth_ui_flutter/terra_auth_ui.dart';
import 'package:auth_ui_flutter/builder/login_ui_config_builder.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _appName = "Test";
  late TerraAuthUI _terraAuthUI;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    _terraAuthUI = await TerraAuthUI.getInstance(_appName);
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              ElevatedButton(
                  onPressed: () async {
                    try {
                      var config = LoginUIConfigBuilder()
                          .withLocalAssetFilename("assets/bitcoin.png")
                      // .withLocalAssetFilename("ethereum.png")
                          .withAuthenticationCancellable(true)
                      //.withAccount("thanh.bm@teko.vn")
                          .build();
                      _terraAuthUI.setLanguageCode("fr");
                      await _terraAuthUI.startLogin(config);
                      print("[flutter] success");
                    } catch (e) {
                      print("[flutter] exception" + e.toString());
                    }
                  },
                  child: const Text("Start Login UI")),
            ],
          ),
        ),
      ),
    );
  }

}
0
likes
130
pub points
64%
popularity

Publisher

unverified uploader

A flutter plug-in for the native AuthUI library (Android and iOS).

Repository

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on auth_ui_flutter