Select Git revision
kitchen.vagrant.yml
-
Imran Iqbal authored
* Automated using https://github.com/myii/ssf-formula/pull/316
Imran Iqbal authored* Automated using https://github.com/myii/ssf-formula/pull/316
widgets.dart 2.38 KiB
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'login.dart';
//Widgets für den Login/Registrations Screen
Container loginRegisterButton(
BuildContext context, bool isLogin, Function onTap) {
return Container(
width: MediaQuery.of(context).size.width,
height: 50,
margin: EdgeInsets.fromLTRB(0, 10, 0, 20),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
child: ElevatedButton(
onPressed: (){
onTap();
},
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith((states){
if(states.contains(MaterialState.pressed)){
return Colors.black;
}
return Colors.white;
}),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)))),
child: Text(
isLogin? 'Login' : 'Registrate',
style: const TextStyle(
color: Colors.black),
),
)
);
}
Container signOutButton(
BuildContext context) {
return Container(
width: MediaQuery
.of(context)
.size
.width,
height: 50,
margin: EdgeInsets.fromLTRB(0, 10, 0, 20),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
child: ElevatedButton(
onPressed: () {
FirebaseAuth.instance.signOut().then((value) {
Navigator.push(context, MaterialPageRoute(builder:
(context) => LoginPage()));
});
},
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith((states) {
if (states.contains(MaterialState.pressed)) {
return Colors.black;
}
return Colors.white;
}),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30)))),
child: const Text(
"Sign Out",
style: TextStyle(
color: Colors.black),
),
)
);
}