inserido icone android, logo,ajustada a tela home e login

This commit is contained in:
Reginaldo
2023-03-22 14:56:39 -03:00
parent 25a5cb6f15
commit 954e5aa2bf
21 changed files with 390 additions and 86 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
assets/images/logo.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -13,7 +13,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primaryColor: ColorPalette.primary, primaryColor: ColorPalette.primary,
appBarTheme: AppBarTheme( appBarTheme: AppBarTheme(
color: ColorPalette.primary color: ColorPalette.appBar
) )
), ),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,

View File

@@ -1,4 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rkm/utils/const_variable.dart';
import 'package:rkm/widgets/icon_button_default.dart';
import 'package:rkm/widgets/input_search_text.dart';
import 'package:rkm/widgets/input_text.dart';
import '../widgets/item_citizen.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key); const HomeScreen({Key? key}) : super(key: key);
@@ -8,13 +14,62 @@ class HomeScreen extends StatefulWidget {
} }
class _HomeScreenState extends State<HomeScreen> { class _HomeScreenState extends State<HomeScreen> {
var inputSearch = TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
appBar: AppBar(title: Text('Home')), appBar: AppBar(title: Text('RKM - Inicial'),centerTitle: true),
body: Container( body: Container(
child: Center( padding: EdgeInsets.all(10),
child: Text('home') width: width,
height: height,
decoration: ConstVariable().backgroundGradient,
child: Column(
children: [
Row(
children: [
InputSearchText(
hint: 'Busca cidadão (Por NOME ou CNS ou PRONTUÁRIO ou DATA NASCIMENTO)',
fontSize: 10,
controller: inputSearch,
width: width*0.72
),
IconButtonDefault(
icon: Icons.person_add,
onPressed: (){}
),
IconButtonDefault(
icon: Icons.article,
onPressed: (){}
),
IconButtonDefault(
icon: Icons.edit_note,
onPressed: (){}
),
],
),
Container(
width: width,
height: height*0.8,
child: ListView.builder(
itemCount: 10,
itemBuilder: (context,index){
return ItemCitizen(
date: '00/00/0000',
name: 'JOÃO DA SILVA',
mother: 'MARIA DA SILVA',
numberCNS: '123456789',
numberMedicalRecord: '012345',
onTap: ()=>Navigator.pushNamed(context, '/register_citizen'),
);
}
)
),
],
), ),
), ),
); );

View File

@@ -3,6 +3,7 @@ import 'package:intl/intl.dart';
import 'package:rkm/utils/color_palette.dart'; import 'package:rkm/utils/color_palette.dart';
import 'package:rkm/utils/const_variable.dart'; import 'package:rkm/utils/const_variable.dart';
import 'package:rkm/widgets/button_default.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/input_text.dart';
import 'package:rkm/widgets/text_default.dart'; import 'package:rkm/widgets/text_default.dart';
@@ -20,26 +21,18 @@ class _LoginScreenState extends State<LoginScreen> {
String error = ''; String error = '';
String? now; String? now;
String? selectCity; String? selectCity;
bool validatorDropDown= false;
checkLogin(){ checkLogin(){
if(inputUser.text.isNotEmpty && inputPassword.text.isNotEmpty && inputUser.text == 'teste' && inputPassword.text == '123'){ if(inputUser.text.isNotEmpty && inputPassword.text.isNotEmpty && inputUser.text == 'teste' && inputPassword.text == '123'){
if(selectCity!=null){ if(selectCity!=null){
if(selectCity=='Piracicaba'){
setState(() { setState(() {
error = ''; error = '';
inputPassword.clear();
inputUser.clear();
selectCity = null;
}); });
Navigator.pushNamed(context, '/home'); Navigator.pushNamed(context, '/home');
}else{
setState(() {
error = 'Unidade Inválida';
});
}
}else{ }else{
setState(() { setState(() {
error = 'Selecione sua unidade'; error = 'Selecione sua cidade';
}); });
} }
}else{ }else{
@@ -61,67 +54,80 @@ class _LoginScreenState extends State<LoginScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
appBar: AppBar( 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( bottomSheet: Container(
padding: const EdgeInsets.all(8.0), color: ColorPalette.secundary,
padding: EdgeInsets.all(8.0),
child: TextDefault( child: TextDefault(
text: 'Última sincronização $now', text: 'Última sincronização $now',
fontSize: 20, fontSize: 15,
color: ColorPalette.black54, color: ColorPalette.gray,
), ),
), ),
body: Container( body: SingleChildScrollView(
child: Center( child: Container(
child: Column( padding: EdgeInsets.only(top: height*0.2),
mainAxisSize: MainAxisSize.min, width: width,
children: [ height: height,
TextDefault(text: 'Login',fontSize: 30), decoration: ConstVariable().backgroundGradient,
SizedBox(height: 10), child: Column(
Container( 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, width: width*0.6,
child: DropdownButtonHideUnderline( height: height*0.3,
child: DropdownButton<String>( child: ListView(
hint: TextDefault(text: 'Selecione a cidade'), children: [
value: selectCity, InputText(
items: ConstVariable().itensCity.map((value) => DropdownMenuItem( hint: 'Usuário',
value: value, label: 'Usuário',
child: TextDefault( error: 'Campo obrigatório',
text: value, controller: inputUser,
), width: width*0.6
) ),
).toList(), 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){ onChanged: (value){
setState(() { setState(() {
selectCity = value!; selectCity = value!;
validatorDropDown = true;
}); });
} },
), ),
],
), ),
), ),
InputText( ),
hint: 'Usuário', ButtonDefault(
controller: inputUser, onPressed: ()=>checkLogin(),
width: width*0.6 title: 'Carga Inicial',
), width: width*0.6,
SizedBox(height: 10), ),
InputText( SizedBox(height: 10),
hint: 'Senha', TextDefault(text: error,color: ColorPalette.red),
obscure: true, ],
controller: inputPassword, ),
width: width*0.6
),
SizedBox(height: 10),
TextDefault(text: error,color: ColorPalette.red),
ButtonDefault(
onPressed: ()=>checkLogin(),
title: 'Entrar'
),
],
)
), ),
), ),
); );

View File

@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:rkm/utils/const_variable.dart';
class RegisterCitizenScreen extends StatefulWidget {
const RegisterCitizenScreen({Key? key}) : super(key: key);
@override
State<RegisterCitizenScreen> createState() => _RegisterCitizenScreenState();
}
class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: ConstVariable().backgroundGradient,
),
);
}
}

View File

@@ -2,7 +2,10 @@ import 'package:flutter/material.dart';
class ColorPalette{ class ColorPalette{
static const Color white = Colors.white; static const Color white = Colors.white;
static const Color red = Colors.red; static const Color red = Colors.red;
static const Color primary = Color(0xff408CB3); static const Color primary = Color(0xff89dbf7);
static const Color border = Color(0xff86B6CD); static const Color appBar = Color(0xff387ef5);
static const Color secundary = Color(0xffcff1fc);
static const Color border = Color(0xff78baf8);
static const Color gray = Color(0xff909090);
static const Color black54 = Colors.black54; static const Color black54 = Colors.black54;
} }

View File

@@ -1,5 +1,12 @@
import 'package:flutter/material.dart';
import 'color_palette.dart';
class ConstVariable{ class ConstVariable{
double radiusBorderInput = 5;
EdgeInsetsGeometry marginHightInput = EdgeInsets.symmetric(vertical: 5);
EdgeInsetsGeometry paddingWidth = EdgeInsets.symmetric(horizontal: 10);
double fontSizeInput = 15;
double fontSizeTitleAppBar = 20;
List<String> itensCity = [ List<String> itensCity = [
'Anhembi', 'Anhembi',
'Aparecida', 'Aparecida',
@@ -28,4 +35,14 @@ class ConstVariable{
'Santo Antonio da Alegria', 'Santo Antonio da Alegria',
'Tapiratiba' 'Tapiratiba'
]; ];
var backgroundGradient = BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
ColorPalette.primary,
ColorPalette.secundary,
],
)
);
} }

View File

@@ -1,6 +1,9 @@
import 'package:rkm/screens/home_screen.dart'; import 'package:rkm/screens/home_screen.dart';
import 'package:rkm/screens/login_screen.dart'; import 'package:rkm/screens/login_screen.dart';
import '../screens/register_citizen_screen.dart';
var routes = { var routes = {
'/home': (context) => const HomeScreen(), '/home': (context) => const HomeScreen(),
'/login': (context) => const LoginScreen(), '/login': (context) => const LoginScreen(),
'/register_citizen': (context) => const RegisterCitizenScreen(),
}; };

View File

@@ -1,29 +1,46 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rkm/utils/color_palette.dart'; import 'package:rkm/utils/color_palette.dart';
import '../utils/const_variable.dart';
class ButtonDefault extends StatelessWidget { class ButtonDefault extends StatelessWidget {
var onPressed; var onPressed;
String title; String title;
Color background; Color background;
Color textColor; Color textColor;
Color borderColor;
double width;
double height;
ButtonDefault({ ButtonDefault({
required this.onPressed, required this.onPressed,
required this.title, required this.title,
this.background = ColorPalette.primary, this.background = Colors.transparent,
this.textColor = ColorPalette.white this.textColor = ColorPalette.border,
this.borderColor = ColorPalette.border,
this.width = 100,
this.height = 50,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextButton( return Container(
onPressed: onPressed, margin: ConstVariable().marginHightInput,
style: TextButton.styleFrom( width: width,
backgroundColor: background, height: height,
foregroundColor: textColor, child: TextButton(
), onPressed: onPressed,
child: Text( style: TextButton.styleFrom(
title backgroundColor: background,
) foregroundColor: textColor,
side: BorderSide(width: 3,color: borderColor),
),
child: Text(
title,
style: TextStyle(
fontSize: ConstVariable().fontSizeInput
),
)
),
); );
} }
} }

View File

@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:rkm/widgets/text_default.dart';
import '../utils/color_palette.dart';
import '../utils/const_variable.dart';
class DropDownButtonCity extends StatelessWidget {
var onChanged;
String? select;
bool validator;
String error;
DropDownButtonCity({
required this.onChanged,
required this.select,
required this.error,
required this.validator
});
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return Column(
children: [
Container(
width: width*0.6,
margin: ConstVariable().marginHightInput,
padding: ConstVariable().paddingWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ConstVariable().radiusBorderInput),
border: Border.all(
color: validator?ColorPalette.white:ColorPalette.red
),
color: ColorPalette.white
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
hint: TextDefault(text: 'Cidade',fontSize: ConstVariable().fontSizeInput),
value: select,
items: ConstVariable().itensCity.map((value) => DropdownMenuItem(
value: value,
child: TextDefault(
text: value,
),
)
).toList(),
onChanged:onChanged
),
),
),
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 15),
child: TextDefault(
text: validator?'':error,
color: ColorPalette.red,
fontSize: 12
)
),
],
);
}
}

View File

@@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
import 'package:rkm/utils/color_palette.dart';
class IconButtonDefault extends StatelessWidget {
var onPressed;
IconData icon;
IconButtonDefault({
required this.icon,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
return IconButton(
onPressed: onPressed,
icon: Icon(icon,color: ColorPalette.black54,size: 30,)
);
}
}

View File

@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:rkm/utils/color_palette.dart';
import '../utils/const_variable.dart';
class InputSearchText extends StatelessWidget {
var controller;
double fontSize;
String hint;
double width;
InputSearchText({
required this.controller,
required this.width,
this.fontSize = 15.0,
this.hint = '',
});
@override
Widget build(BuildContext context) {
return Container(
color: ColorPalette.white,
margin: ConstVariable().marginHightInput,
width: width,
child: TextFormField(
controller: this.controller,
style: TextStyle(
color: ColorPalette.gray,
fontSize: this.fontSize,
),
decoration: InputDecoration(
fillColor: ColorPalette.appBar,
prefixIcon: Icon(Icons.search),
border: OutlineInputBorder(),
hintText: this.hint,
hintStyle: TextStyle(
color: ColorPalette.gray,
fontSize: this.fontSize,
)
)
),
);
}
}

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rkm/utils/color_palette.dart'; import 'package:rkm/utils/color_palette.dart';
import '../utils/const_variable.dart';
class InputText extends StatelessWidget { class InputText extends StatelessWidget {
bool obscure; bool obscure;
@@ -7,36 +8,45 @@ class InputText extends StatelessWidget {
double fontSize; double fontSize;
String hint; String hint;
double width; double width;
String label;
String error;
InputText({ InputText({
required this.controller, required this.controller,
required this.width, required this.width,
this.obscure = false, this.obscure = false,
this.fontSize = 20.0, this.fontSize = 15.0,
this.hint = '', this.hint = '',
this.label = '',
this.error = '',
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 10), color: ColorPalette.white,
decoration: BoxDecoration( margin: ConstVariable().marginHightInput,
borderRadius: BorderRadius.circular(15),
color: ColorPalette.border
),
width: width, width: width,
child: TextFormField( child: TextFormField(
validator: (value) {
if (value!=null && value!.length==0) {
return error;
}
return null;
},
obscureText: this.obscure, obscureText: this.obscure,
controller: this.controller, controller: this.controller,
style: TextStyle( style: TextStyle(
color: ColorPalette.white, color: ColorPalette.gray,
fontSize: this.fontSize, fontSize: this.fontSize,
), ),
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, fillColor: ColorPalette.appBar,
labelText: label,
border: OutlineInputBorder(),
hintText: this.hint, hintText: this.hint,
hintStyle: TextStyle( hintStyle: TextStyle(
color: ColorPalette.white, color: ColorPalette.gray,
fontSize: this.fontSize, fontSize: this.fontSize,
) )
) )

View File

@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:rkm/utils/color_palette.dart';
import 'package:rkm/utils/const_variable.dart';
import 'package:rkm/widgets/text_default.dart';
class ItemCitizen extends StatelessWidget {
String name;
String date;
String mother;
String numberCNS;
String numberMedicalRecord;
var onTap;
ItemCitizen({
required this.name,
required this.date,
required this.mother,
required this.numberCNS,
required this.numberMedicalRecord,
required this.onTap
});
@override
Widget build(BuildContext context) {
return Container(
margin: ConstVariable().marginHightInput,
child: Card(
margin: ConstVariable().marginHightInput,
color: ColorPalette.white,
child: ListTile(
title: TextDefault(text: name,fontWeigth: FontWeight.bold),
subtitle: TextDefault(text: '$numberCNS - $numberMedicalRecord - $date - $mother',fontSize: 16),
trailing: Icon(Icons.assignment_outlined),
onTap: onTap,
),
),
);
}
}

View File

@@ -6,11 +6,13 @@ class TextDefault extends StatelessWidget {
String text; String text;
double fontSize; double fontSize;
Color color; Color color;
FontWeight fontWeigth;
TextDefault({ TextDefault({
required this.text, required this.text,
this.fontSize = 20.0, this.fontSize = 20.0,
this.color = ColorPalette.border this.color = ColorPalette.gray,
this.fontWeigth = FontWeight.normal
}); });
@override @override
@@ -19,7 +21,8 @@ class TextDefault extends StatelessWidget {
text, text,
style: TextStyle( style: TextStyle(
fontSize: fontSize, fontSize: fontSize,
color: color fontWeight: fontWeigth,
color: color,
), ),
); );
} }

View File

@@ -23,3 +23,6 @@ dev_dependencies:
flutter: flutter:
uses-material-design: true uses-material-design: true
assets:
- assets/images/