supabase_auth_ui 0.0.1-dev.1 supabase_auth_ui: ^0.0.1-dev.1 copied to clipboard
UI library to implement auth forms using Supabase and Flutter
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:supabase_auth_ui/supa_flutter_auth.dart';
import './home.dart';
import './sign_up.dart';
import './sign_in.dart';
import './magic_link.dart';
import './forgot_password.dart';
import './update_password.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await dotenv.load(fileName: ".env");
await SupabaseAuthUi().initSupabase(
dotenv.env['SUPABASE_URL']!,
dotenv.env['SUPABASE_ANON_KEY']!,
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
inputDecorationTheme: const InputDecorationTheme(
border: OutlineInputBorder(),
),
),
initialRoute: '/',
routes: {
'/': (context) => const SignUp(),
'/sign_in': (context) => const SignIn(),
'/magic_link': (context) => const MagicLink(),
'/forgot_password': (context) => const ForgotPassword(),
'/update_password': (context) => const UpdatePassword(),
'/home': (context) => Home(),
},
onUnknownRoute: (RouteSettings settings) {
return MaterialPageRoute<void>(
settings: settings,
builder: (BuildContext context) => const Scaffold(
body: Center(
child: Text(
'Not Found',
style: TextStyle(
fontSize: 42,
fontWeight: FontWeight.bold,
),
),
),
),
);
},
);
}
}