inserido icone android, logo,ajustada a tela home e login
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 6.5 KiB |
BIN
assets/images/logo.PNG
Normal file
|
After Width: | Height: | Size: 54 KiB |
@@ -13,7 +13,7 @@ class MyApp extends StatelessWidget {
|
||||
theme: ThemeData(
|
||||
primaryColor: ColorPalette.primary,
|
||||
appBarTheme: AppBarTheme(
|
||||
color: ColorPalette.primary
|
||||
color: ColorPalette.appBar
|
||||
)
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
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 {
|
||||
const HomeScreen({Key? key}) : super(key: key);
|
||||
@@ -8,13 +14,62 @@ class HomeScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
var inputSearch = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Home')),
|
||||
appBar: AppBar(title: Text('RKM - Inicial'),centerTitle: true),
|
||||
body: Container(
|
||||
child: Center(
|
||||
child: Text('home')
|
||||
padding: EdgeInsets.all(10),
|
||||
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'),
|
||||
);
|
||||
}
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
19
lib/screens/register_citizen_screen.dart
Normal 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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,10 @@ import 'package:flutter/material.dart';
|
||||
class ColorPalette{
|
||||
static const Color white = Colors.white;
|
||||
static const Color red = Colors.red;
|
||||
static const Color primary = Color(0xff408CB3);
|
||||
static const Color border = Color(0xff86B6CD);
|
||||
static const Color primary = Color(0xff89dbf7);
|
||||
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;
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'color_palette.dart';
|
||||
|
||||
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 = [
|
||||
'Anhembi',
|
||||
'Aparecida',
|
||||
@@ -28,4 +35,14 @@ class ConstVariable{
|
||||
'Santo Antonio da Alegria',
|
||||
'Tapiratiba'
|
||||
];
|
||||
var backgroundGradient = BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
ColorPalette.primary,
|
||||
ColorPalette.secundary,
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'package:rkm/screens/home_screen.dart';
|
||||
import 'package:rkm/screens/login_screen.dart';
|
||||
|
||||
import '../screens/register_citizen_screen.dart';
|
||||
var routes = {
|
||||
'/home': (context) => const HomeScreen(),
|
||||
'/login': (context) => const LoginScreen(),
|
||||
'/register_citizen': (context) => const RegisterCitizenScreen(),
|
||||
};
|
||||
@@ -1,29 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/utils/color_palette.dart';
|
||||
|
||||
import '../utils/const_variable.dart';
|
||||
class ButtonDefault extends StatelessWidget {
|
||||
var onPressed;
|
||||
String title;
|
||||
Color background;
|
||||
Color textColor;
|
||||
Color borderColor;
|
||||
double width;
|
||||
double height;
|
||||
|
||||
ButtonDefault({
|
||||
required this.onPressed,
|
||||
required this.title,
|
||||
this.background = ColorPalette.primary,
|
||||
this.textColor = ColorPalette.white
|
||||
this.background = Colors.transparent,
|
||||
this.textColor = ColorPalette.border,
|
||||
this.borderColor = ColorPalette.border,
|
||||
this.width = 100,
|
||||
this.height = 50,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: background,
|
||||
foregroundColor: textColor,
|
||||
),
|
||||
child: Text(
|
||||
title
|
||||
)
|
||||
return Container(
|
||||
margin: ConstVariable().marginHightInput,
|
||||
width: width,
|
||||
height: height,
|
||||
child: TextButton(
|
||||
onPressed: onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: background,
|
||||
foregroundColor: textColor,
|
||||
side: BorderSide(width: 3,color: borderColor),
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: ConstVariable().fontSizeInput
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
65
lib/widgets/dropdown_button_city.dart
Normal 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
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
20
lib/widgets/icon_button_default.dart
Normal 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,)
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/widgets/input_search_text.dart
Normal 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,
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/utils/color_palette.dart';
|
||||
import '../utils/const_variable.dart';
|
||||
|
||||
class InputText extends StatelessWidget {
|
||||
bool obscure;
|
||||
@@ -7,36 +8,45 @@ class InputText extends StatelessWidget {
|
||||
double fontSize;
|
||||
String hint;
|
||||
double width;
|
||||
String label;
|
||||
String error;
|
||||
|
||||
InputText({
|
||||
required this.controller,
|
||||
required this.width,
|
||||
this.obscure = false,
|
||||
this.fontSize = 20.0,
|
||||
this.fontSize = 15.0,
|
||||
this.hint = '',
|
||||
this.label = '',
|
||||
this.error = '',
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: ColorPalette.border
|
||||
),
|
||||
color: ColorPalette.white,
|
||||
margin: ConstVariable().marginHightInput,
|
||||
width: width,
|
||||
child: TextFormField(
|
||||
validator: (value) {
|
||||
if (value!=null && value!.length==0) {
|
||||
return error;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
obscureText: this.obscure,
|
||||
controller: this.controller,
|
||||
style: TextStyle(
|
||||
color: ColorPalette.white,
|
||||
color: ColorPalette.gray,
|
||||
fontSize: this.fontSize,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: ColorPalette.appBar,
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(),
|
||||
hintText: this.hint,
|
||||
hintStyle: TextStyle(
|
||||
color: ColorPalette.white,
|
||||
color: ColorPalette.gray,
|
||||
fontSize: this.fontSize,
|
||||
)
|
||||
)
|
||||
|
||||
40
lib/widgets/item_citizen.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,13 @@ class TextDefault extends StatelessWidget {
|
||||
String text;
|
||||
double fontSize;
|
||||
Color color;
|
||||
FontWeight fontWeigth;
|
||||
|
||||
TextDefault({
|
||||
required this.text,
|
||||
required this.text,
|
||||
this.fontSize = 20.0,
|
||||
this.color = ColorPalette.border
|
||||
this.color = ColorPalette.gray,
|
||||
this.fontWeigth = FontWeight.normal
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -19,7 +21,8 @@ class TextDefault extends StatelessWidget {
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize,
|
||||
color: color
|
||||
fontWeight: fontWeigth,
|
||||
color: color,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,4 +22,7 @@ dev_dependencies:
|
||||
|
||||
flutter:
|
||||
|
||||
uses-material-design: true
|
||||
uses-material-design: true
|
||||
|
||||
assets:
|
||||
- assets/images/
|
||||