flutter_firebase_extra 0.2.1
flutter_firebase_extra: ^0.2.1 copied to clipboard
Manage authentication with firebase in an extremely simple way
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_firebase_extra/flutter_firebase_extra.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<AuthState>(
child: MaterialApp(
home: ParentPage(),
),
create: (_) => AuthState(splashScreenDurationMillis: 2000),
);
}
}
class ParentPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AuthManagerWidget(
splashScreen: Scaffold(
backgroundColor: Colors.black,
body: Center(child: Text("Splash Screen", style: TextStyle(fontSize: 40, color: Colors.white),),),
),
loginScreen: LoginScreen(
backgroundColor: Colors.purple,
expandedWidget: Center(
child: Container(
height: 200,
width: 300,
color: Colors.red,
),
),
emailLogin: (context) {
return EmailLoginScreen(
appBar: AppBar(
title: Text("MyApp Login"),
),
mainColor: Colors.blue,
privacyUrl: "https://www.myprivacyurl.com",
termsUrl: "https://mytermsurl.com",
);
},
),
mainScreen: Builder(
builder: (BuildContext context) {
AuthState authState = Provider.of(context);
return Scaffold(
backgroundColor: Colors.blue,
body: Center(
child: RaisedButton(
onPressed: () {
authState.signOut();
},
child: Text('Sign out'),
),
),
);
},
),
);
}
}