inserido icone android, logo,ajustada a tela home e login
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:intl/intl.dart';
|
||||
import 'package:rkm/utils/color_palette.dart';
|
||||
import 'package:rkm/utils/const_variable.dart';
|
||||
import 'package:rkm/widgets/button_default.dart';
|
||||
import 'package:rkm/widgets/dropdown_button_city.dart';
|
||||
import 'package:rkm/widgets/input_text.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
|
||||
@@ -20,26 +21,18 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
String error = '';
|
||||
String? now;
|
||||
String? selectCity;
|
||||
bool validatorDropDown= false;
|
||||
|
||||
checkLogin(){
|
||||
if(inputUser.text.isNotEmpty && inputPassword.text.isNotEmpty && inputUser.text == 'teste' && inputPassword.text == '123'){
|
||||
if(selectCity!=null){
|
||||
if(selectCity=='Piracicaba'){
|
||||
setState(() {
|
||||
error = '';
|
||||
inputPassword.clear();
|
||||
inputUser.clear();
|
||||
selectCity = null;
|
||||
});
|
||||
Navigator.pushNamed(context, '/home');
|
||||
}else{
|
||||
setState(() {
|
||||
error = 'Unidade Inválida';
|
||||
});
|
||||
}
|
||||
}else{
|
||||
setState(() {
|
||||
error = 'Selecione sua unidade';
|
||||
error = 'Selecione sua cidade';
|
||||
});
|
||||
}
|
||||
}else{
|
||||
@@ -61,67 +54,80 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: TextDefault(text: 'Login',fontSize: 30,color: ColorPalette.white),
|
||||
centerTitle: true,
|
||||
title: TextDefault(text: 'RKM AB - Carga Inicial',fontSize: ConstVariable().fontSizeTitleAppBar,color: ColorPalette.white),
|
||||
),
|
||||
bottomSheet: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
bottomSheet: Container(
|
||||
color: ColorPalette.secundary,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: TextDefault(
|
||||
text: 'Última sincronização $now',
|
||||
fontSize: 20,
|
||||
color: ColorPalette.black54,
|
||||
fontSize: 15,
|
||||
color: ColorPalette.gray,
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextDefault(text: 'Login',fontSize: 30),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: height*0.2),
|
||||
width: width,
|
||||
height: height,
|
||||
decoration: ConstVariable().backgroundGradient,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset('assets/images/logo.PNG',width: width*0.4),
|
||||
SizedBox(height: 10),
|
||||
Form(
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: Container(
|
||||
width: width*0.6,
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
hint: TextDefault(text: 'Selecione a cidade'),
|
||||
value: selectCity,
|
||||
items: ConstVariable().itensCity.map((value) => DropdownMenuItem(
|
||||
value: value,
|
||||
child: TextDefault(
|
||||
text: value,
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
height: height*0.3,
|
||||
child: ListView(
|
||||
children: [
|
||||
InputText(
|
||||
hint: 'Usuário',
|
||||
label: 'Usuário',
|
||||
error: 'Campo obrigatório',
|
||||
controller: inputUser,
|
||||
width: width*0.6
|
||||
),
|
||||
InputText(
|
||||
hint: 'Senha',
|
||||
label: 'Senha',
|
||||
error: 'Campo obrigatório',
|
||||
obscure: true,
|
||||
controller: inputPassword,
|
||||
width: width*0.6
|
||||
),
|
||||
DropDownButtonCity(
|
||||
error: 'Campo obrigatório',
|
||||
validator: validatorDropDown,
|
||||
select: selectCity,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
selectCity = value!;
|
||||
validatorDropDown = true;
|
||||
});
|
||||
}
|
||||
),
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InputText(
|
||||
hint: 'Usuário',
|
||||
controller: inputUser,
|
||||
width: width*0.6
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
InputText(
|
||||
hint: 'Senha',
|
||||
obscure: true,
|
||||
controller: inputPassword,
|
||||
width: width*0.6
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextDefault(text: error,color: ColorPalette.red),
|
||||
ButtonDefault(
|
||||
onPressed: ()=>checkLogin(),
|
||||
title: 'Entrar'
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
ButtonDefault(
|
||||
onPressed: ()=>checkLogin(),
|
||||
title: 'Carga Inicial',
|
||||
width: width*0.6,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextDefault(text: error,color: ColorPalette.red),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user