auth_ui_flutter 1.0.1-CAR239.1 auth_ui_flutter: ^1.0.1-CAR239.1 copied to clipboard
A flutter plug-in for the native AuthUI library (Android and iOS).
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")),
],
),
),
),
);
}
}