auth_ui_flutter 2.0.1-CAR1804.2 copy "auth_ui_flutter: ^2.0.1-CAR1804.2" to clipboard
auth_ui_flutter: ^2.0.1-CAR1804.2 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';
import 'package:terra_flutter/terra_app.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 = "carbonmrv";
  late TerraAuthUI _terraAuthUI;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    await TerraApp.initTerraApp(appName: _appName);
    _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")
                          .setEnableAutofillOtp(true)
                          .build();
                      _terraAuthUI.setLanguageCode("en");
                      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
57%
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