109 lines
3.4 KiB
Dart
109 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:le_kiosque_by_gcs/services/auth/auth.dart';
|
|
|
|
import 'custom/custom_elevated_button.dart';
|
|
|
|
class AuthView extends StatelessWidget {
|
|
const AuthView({Key key, this.auth}) : super(key: key);
|
|
final Auth auth;
|
|
|
|
Future<void> _signWithGoogle() async {
|
|
try {
|
|
await auth.signInWithGoogle();
|
|
} catch (e) {
|
|
print("Error $e");
|
|
}
|
|
}
|
|
|
|
Future<void> _signInWithFacebook() async {
|
|
try {
|
|
await auth.signInWithFacebook();
|
|
} catch (e) {
|
|
print("Error $e");
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.grey[200],
|
|
resizeToAvoidBottomInset: false,
|
|
body: ListView(
|
|
children: [
|
|
Container(
|
|
height: 470,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("assets/images/login_back.png"),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Transform.translate(
|
|
offset: Offset(0, -50),
|
|
child: Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[200],
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(30),
|
|
topRight: Radius.circular(30),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 32,
|
|
left: 24,
|
|
right: 24,
|
|
bottom: 24,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Text(
|
|
"S'identifier",
|
|
style: TextStyle(
|
|
fontSize: 26,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black,
|
|
inherit: false),
|
|
),
|
|
SizedBox(height: 32),
|
|
CustomElevatedButton(
|
|
imageAsset: "assets/images/google_logo.png",
|
|
color: Colors.white,
|
|
textColor: Colors.black,
|
|
onPressed: _signWithGoogle,
|
|
text: "Se connecter avec Google",
|
|
),
|
|
SizedBox(height: 24),
|
|
CustomElevatedButton(
|
|
imageAsset: "assets/images/facebook_logo.png",
|
|
color: Color(0xFF334D92),
|
|
textColor: Colors.white,
|
|
onPressed: _signInWithFacebook,
|
|
text: "Se connecter avec Facebook",
|
|
),
|
|
SizedBox(
|
|
height: 24,
|
|
),
|
|
Text(
|
|
"En vous connectant, vous acceptez nos conditions et termes d'utilisation.",
|
|
style: TextStyle(
|
|
inherit: false,
|
|
color: Colors.black87,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|