passwordlezz 0.0.1+1 passwordlezz: ^0.0.1+1 copied to clipboard
A Simple login for users. A new way to let user login to the apps they love. Easy to use no password login. Users can log in via a qr-code or filling out their email and clicking the correct number on [...]
import 'package:flutter/material.dart';
import 'package:passwordlezz/passwordlezz.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String message;
String token;
bool isDark = false;
_dark(bool dark) {
setState(() {
isDark = dark;
});
}
_result(AuthResult result) {
setState(() {
if(result.getToken() != null) {
this.token = result.getToken();
this.message = 'You are verified!';
} else if(result.rejected) {
this.token = null;
this.message = 'You were rejected!';
} else {
this.token = null;
this.message = null;
}
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: isDark ? ThemeData.dark() : ThemeData.light(),
home: Scaffold(
body: SizedBox.expand(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
if(message != null) Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
message,
style: Theme.of(context).textTheme.display1.copyWith(
color: isDark ? Colors.white : Colors.grey[700]),
),
),
if(token != null || message != null) SizedBox(height: 30,),
PasswordlezzButton(
callback: (r) => _result(r),
appId: 'rxjfXzFUwpUBkT1oPJV4',
),
SizedBox(height: 20,),
Switch(
value: isDark,
onChanged: _dark,
),
],
),
),
),
);
}
}