diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index db77bb4..e7a0e51 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 17987b7..648a82f 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 09d4391..9d37e46 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d..d0e4eb4 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..5a50487 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/assets/images/logo.PNG b/assets/images/logo.PNG new file mode 100644 index 0000000..c312954 Binary files /dev/null and b/assets/images/logo.PNG differ diff --git a/lib/main.dart b/lib/main.dart index b3e0528..3a21748 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,7 +13,7 @@ class MyApp extends StatelessWidget { theme: ThemeData( primaryColor: ColorPalette.primary, appBarTheme: AppBarTheme( - color: ColorPalette.primary + color: ColorPalette.appBar ) ), debugShowCheckedModeBanner: false, diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 3dce65f..6097506 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -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 { + + 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'), + ); + } + ) + ), + ], ), ), ); diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index b6f39ef..58a6b49 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -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 { 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 { 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( - 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), + ], + ), ), ), ); diff --git a/lib/screens/register_citizen_screen.dart b/lib/screens/register_citizen_screen.dart new file mode 100644 index 0000000..68f2294 --- /dev/null +++ b/lib/screens/register_citizen_screen.dart @@ -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 createState() => _RegisterCitizenScreenState(); +} + +class _RegisterCitizenScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + decoration: ConstVariable().backgroundGradient, + ), + ); + } +} diff --git a/lib/utils/color_palette.dart b/lib/utils/color_palette.dart index 8e1364a..17a160f 100644 --- a/lib/utils/color_palette.dart +++ b/lib/utils/color_palette.dart @@ -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; } \ No newline at end of file diff --git a/lib/utils/const_variable.dart b/lib/utils/const_variable.dart index 3f08034..9adda49 100644 --- a/lib/utils/const_variable.dart +++ b/lib/utils/const_variable.dart @@ -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 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, + ], + ) + ); } \ No newline at end of file diff --git a/lib/utils/routes.dart b/lib/utils/routes.dart index 089ae46..497cd09 100644 --- a/lib/utils/routes.dart +++ b/lib/utils/routes.dart @@ -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(), }; \ No newline at end of file diff --git a/lib/widgets/button_default.dart b/lib/widgets/button_default.dart index 9744faf..35b78cd 100644 --- a/lib/widgets/button_default.dart +++ b/lib/widgets/button_default.dart @@ -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 + ), + ) + ), ); } } diff --git a/lib/widgets/dropdown_button_city.dart b/lib/widgets/dropdown_button_city.dart new file mode 100644 index 0000000..2049b52 --- /dev/null +++ b/lib/widgets/dropdown_button_city.dart @@ -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( + 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 + ) + ), + ], + ); + } +} diff --git a/lib/widgets/icon_button_default.dart b/lib/widgets/icon_button_default.dart new file mode 100644 index 0000000..d4d1fcc --- /dev/null +++ b/lib/widgets/icon_button_default.dart @@ -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,) + ); + } +} diff --git a/lib/widgets/input_search_text.dart b/lib/widgets/input_search_text.dart new file mode 100644 index 0000000..344df6f --- /dev/null +++ b/lib/widgets/input_search_text.dart @@ -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, + ) + ) + ), + ); + } +} diff --git a/lib/widgets/input_text.dart b/lib/widgets/input_text.dart index 2a55042..4789e95 100644 --- a/lib/widgets/input_text.dart +++ b/lib/widgets/input_text.dart @@ -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, ) ) diff --git a/lib/widgets/item_citizen.dart b/lib/widgets/item_citizen.dart new file mode 100644 index 0000000..3db6912 --- /dev/null +++ b/lib/widgets/item_citizen.dart @@ -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, + ), + ), + ); + } +} diff --git a/lib/widgets/text_default.dart b/lib/widgets/text_default.dart index 5c4bde4..29710bb 100644 --- a/lib/widgets/text_default.dart +++ b/lib/widgets/text_default.dart @@ -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, ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 298dd5b..58bf5bd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,4 +22,7 @@ dev_dependencies: flutter: - uses-material-design: true \ No newline at end of file + uses-material-design: true + + assets: + - assets/images/ \ No newline at end of file