diff --git a/lib/main.dart b/lib/main.dart index a443bca..3247659 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,6 +31,13 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, title: 'CONTROLE DE ACESSO', + theme: ThemeData( + scrollbarTheme: ScrollbarThemeData( + thickness: MaterialStateProperty.all(15), + thumbVisibility: MaterialStateProperty.all(true), + thumbColor: MaterialStateProperty.all(Colors.black38), + ) + ), onUnknownRoute: (RouteSettings settings) { return MaterialPageRoute( builder: (context) => Scaffold( diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index ecb6b28..be42995 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -39,9 +39,10 @@ class _HomeScreenState extends State { carregarAlunos()async{ resultadoPesquisa.clear(); alunos.clear(); - String q = inputPesquisa.text.replaceAll(' ', '%20').toUpperCase(); + String aluno = inputPesquisa.text.replaceAll(' ', '%20').toUpperCase(); + String escola = widget.dados[3].replaceAll(' ', '%20').toUpperCase(); // print(q); - final url = '${widget.dados[2]}/aluno?NOME=$q&CIDADE=${widget.dados[0]}'; + final url = '${widget.dados[2]}/aluno?NOME=$aluno&CIDADE=${widget.dados[0]}&ANO=${DateTime.now().year}&ESCOLA=$escola'; print(url); final response = await http.get(Uri.parse(url)); var map = json.decode(response.body); @@ -214,21 +215,36 @@ class _HomeScreenState extends State { child: showEscola?ListView( children: [ SizedBox(height: height*0.05), - Padding( - padding: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), + Container( + margin: EdgeInsets.symmetric(horizontal: width*0.1), child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ + Container( + height: 35, + width: 70, + alignment: Alignment.center, + child: TextCustom(text: 'BUSCAR',color: Colors.black,size: 12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.only(topLeft: Radius.circular(3.0),bottomLeft: Radius.circular(3.0),), + color: PaletteColors.greySearch, + border: Border.all(color: PaletteColors.grey) + ), + ), InputText( + borderRadius: 0, hint: 'Pesquisar por login do usuário'.toUpperCase(), controller: inputPesquisa, - width: width*0.25, + width: width*0.662, inputFormatters: [], fontSize: 14, colorBackground: Colors.white, ), - SizedBox(width: 10,), ButtonCustom( + borderRadiusbottomLeft: 0, + borderRadiustopLeft: 0, + borderRadiusbottomRight: 0, + borderRadiustopRight: 0, widthCustom: 0.05, text: "PESQUISAR", fontSize: 10.0, @@ -247,14 +263,15 @@ class _HomeScreenState extends State { } }, ), - SizedBox(width: 10,), ButtonCustom( + borderRadiusbottomLeft: 0, + borderRadiustopLeft: 0, widthCustom: 0.05, text: "LIMPAR", fontSize: 10.0, colorText: PaletteColors.white, - colorButton: PaletteColors.primaryColor, - colorBorder: PaletteColors.primaryColor, + colorButton: PaletteColors.grey, + colorBorder: PaletteColors.grey, onPressed: ()=>setState((){ inputPesquisa.clear(); resultadoPesquisa.clear(); @@ -265,15 +282,19 @@ class _HomeScreenState extends State { ) ), Container( - margin: EdgeInsets.symmetric(vertical: 20), - padding: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), + margin: EdgeInsets.only(top: 20,right: width*0.1,left: width*0.1), width: width, + height: 42, alignment: Alignment.center, + decoration: BoxDecoration( + color: PaletteColors.greySearch, + border: Border.all(color: PaletteColors.grey) + ), child: Row( children: [ SizedBox(width: 30,), Container( - width: width*0.1, + width: width*0.15, child: TextCustom(text: 'USUÁRIO',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), ), Container( @@ -292,12 +313,16 @@ class _HomeScreenState extends State { ), ), Container( - padding: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), - height: height*0.7, + decoration: BoxDecoration( + border: Border.all(color: logins.length==0?Colors.white:PaletteColors.grey) + ), + margin: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), + height: height*0.77, child: ListView.builder( itemCount: logins.length, itemBuilder: (context,index){ return ItemAcesso( + index: index, check: logins[index].CHECK, ID_USUARIO: logins[index].ID_USUARIO, CADASTRADO_POR: logins[index].CADASTRADO_POR, @@ -310,19 +335,6 @@ class _HomeScreenState extends State { inserirAcessos(index); } ); - // return Row( - // children: [ - // Checkbox( - // value: logins[index].CHECK, - // onChanged: (v){ - // buscandoDados = true; - // setState(()=>logins[index].CHECK=v!); - // inserirAcessos(index); - // } - // ), - // TextCustom(text: logins[index].ID_USUARIO), - // ], - // ); }, ), ) @@ -330,21 +342,36 @@ class _HomeScreenState extends State { ):ListView( children: [ SizedBox(height: height*0.05), - Padding( - padding: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), + Container( + margin: EdgeInsets.symmetric(horizontal: width*0.1), child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ + Container( + height: 35, + width: 70, + alignment: Alignment.center, + child: TextCustom(text: 'BUSCAR',color: Colors.black,size: 12.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.only(topLeft: Radius.circular(3.0),bottomLeft: Radius.circular(3.0),), + color: PaletteColors.greySearch, + border: Border.all(color: PaletteColors.grey) + ), + ), InputText( hint: 'Pesquisar por nome do aluno(a)'.toUpperCase(), controller: inputPesquisa, - width: width*0.25, + width: width*0.662, inputFormatters: [], fontSize: 14, colorBackground: Colors.white, + borderRadius: 0, ), - SizedBox(width: 10,), ButtonCustom( + borderRadiusbottomLeft: 0, + borderRadiustopLeft: 0, + borderRadiusbottomRight: 0, + borderRadiustopRight: 0, widthCustom: 0.05, text: "PESQUISAR", fontSize: 10.0, @@ -362,14 +389,15 @@ class _HomeScreenState extends State { } }, ), - SizedBox(width: 10,), ButtonCustom( + borderRadiusbottomLeft: 0, + borderRadiustopLeft: 0, widthCustom: 0.05, text: "LIMPAR", fontSize: 10.0, colorText: PaletteColors.white, - colorButton: PaletteColors.primaryColor, - colorBorder: PaletteColors.primaryColor, + colorButton: PaletteColors.grey, + colorBorder: PaletteColors.grey, onPressed: ()=>setState((){ inputPesquisa.clear(); resultadoPesquisa.clear(); @@ -380,16 +408,20 @@ class _HomeScreenState extends State { ) ), Container( - margin: EdgeInsets.symmetric(vertical: 20), - padding: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), + margin: EdgeInsets.only(top: 20,right: width*0.1,left: width*0.1), width: width, alignment: Alignment.center, + decoration: BoxDecoration( + color: PaletteColors.greySearch, + border: Border.all(color: PaletteColors.grey) + ), child: Row( children: [ Container( width: width*0.2, child: Row( children: [ + SizedBox(width: 10,), TextCustom(text: 'ESTUDANTE',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), IconButton( icon: Icon(filtroEstudante?Icons.arrow_drop_up:Icons.arrow_drop_down,color: filtroEstudante?PaletteColors.primaryColor:PaletteColors.grey,), @@ -401,7 +433,7 @@ class _HomeScreenState extends State { filtroTurma = false; filtroEscola = false; }), - ) + ), ], ) ), @@ -420,7 +452,7 @@ class _HomeScreenState extends State { filtroTurma = false; filtroEscola = false; }), - ) + ), ], ) ), @@ -439,15 +471,15 @@ class _HomeScreenState extends State { filtroTurma = false; filtroEscola = false; }), - ) + ), ], ) ), Container( - width: width*0.05, + width: width*0.07, child: Row( children: [ - TextCustom(text: 'Série',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), + TextCustom(text: 'SÉRIE',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), IconButton( icon: Icon(filtroSerie?Icons.arrow_drop_up:Icons.arrow_drop_down,color: filtroSerie?PaletteColors.primaryColor:PaletteColors.grey,), onPressed: ()=>setState((){ @@ -458,15 +490,15 @@ class _HomeScreenState extends State { filtroTurma = false; filtroEscola = false; }), - ) + ), ], ) ), Container( - width: width*0.05, + width: width*0.07, child: Row( children: [ - TextCustom(text: 'Turma',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), + TextCustom(text: 'TURMA',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), IconButton( icon: Icon(filtroTurma?Icons.arrow_drop_up:Icons.arrow_drop_down,color: filtroTurma?PaletteColors.primaryColor:PaletteColors.grey,), onPressed: ()=>setState((){ @@ -477,7 +509,7 @@ class _HomeScreenState extends State { filtroEstudante = false; filtroEscola = false; }), - ) + ), ], ) ), @@ -485,7 +517,7 @@ class _HomeScreenState extends State { width: width*0.2, child: Row( children: [ - TextCustom(text: 'Escola',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), + TextCustom(text: 'ESCOLA',size: 12,fontWeight: FontWeight.bold,color: Colors.black87,), IconButton( icon: Icon(filtroEscola?Icons.arrow_drop_up:Icons.arrow_drop_down,color: filtroEscola?PaletteColors.primaryColor:PaletteColors.grey,), onPressed: ()=>setState((){ @@ -496,7 +528,7 @@ class _HomeScreenState extends State { filtroTurma = false; filtroEstudante = false; }), - ) + ), ], ) ), @@ -504,19 +536,18 @@ class _HomeScreenState extends State { ), ), Container( - padding: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), + decoration: BoxDecoration( + border: Border.all(color: resultadoPesquisa.length==0?Colors.white:PaletteColors.grey) + ), + margin: EdgeInsets.symmetric(horizontal: width>900?width*0.1:width*0.05), width: width*0.75, - height: height*0.8, - child: ListView.separated( - separatorBuilder: (context,index){ - return Divider(); - }, + height: height*0.77, + child: ListView.builder( itemCount: resultadoPesquisa.length, itemBuilder:(context,index){ final items = filtroEstudante||filtroData||filtroRA||filtroSerie||filtroTurma||filtroEscola?resultadoPesquisa.reversed.toList():resultadoPesquisa; - - return DadosAlunosContainer(alunoModel: items[index]); + return DadosAlunosContainer(alunoModel: items[index],index: index,); } ), ) diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index cebd250..e2ebcad 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -23,11 +23,10 @@ class _LoginScreenState extends State { //las1594@@ //SENHAS CRIPTOGRAFADAS PORQUE FORMA ALTERADAS, SENHAS NOVAS USUÁRIO E SENHA SÃO IGUAIS //ibueno - final inputLogin = TextEditingController(text: 'admin'); - final inputSenha = TextEditingController(text: 'las1594@@'); - // final inputCodigo = TextEditingController(text: 'e003'); - // final inputLogin = TextEditingController(); - // final inputSenha = TextEditingController(); + // final inputLogin = TextEditingController(text: 'admin'); + // final inputSenha = TextEditingController(text: 'las1594@@'); + final inputLogin = TextEditingController(); + final inputSenha = TextEditingController(); final inputCodigo = TextEditingController(); bool carregando = false; List listCodigo = []; @@ -45,7 +44,6 @@ class _LoginScreenState extends State { if(inputSenha.text.isNotEmpty){ if(widget.cidade!=''){ if(listCodigo.contains(widget.cidade.toLowerCase())){ - print('vindo da main ${widget.cidade}'); setState(() { carregando = true; }); @@ -107,7 +105,7 @@ class _LoginScreenState extends State { if(map['NO_USERNAME']==map['SENHA']){ if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){ showSnackBar(context, 'Acesso validado', Colors.green); - List dados = [widget.cidade.toUpperCase(),inputLogin.text,urlAPI]; + List dados = [widget.cidade.toUpperCase(),inputLogin.text,urlAPI,map['NO_FANTASIA']??'']; Navigator.pushNamed(context, '/home',arguments: dados); }else{ showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red); @@ -115,7 +113,7 @@ class _LoginScreenState extends State { }else{ if(MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']){ showSnackBar(context, 'Acesso validado', Colors.green); - List dados = [widget.cidade.toUpperCase(),inputLogin.text,urlAPI]; + List dados = [widget.cidade.toUpperCase(),inputLogin.text,urlAPI,map['NO_FANTASIA']??'']; Navigator.pushNamed(context, '/home',arguments: dados); }else{ showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red); diff --git a/lib/utils/colors.dart b/lib/utils/colors.dart index e8936d4..b5513a6 100644 --- a/lib/utils/colors.dart +++ b/lib/utils/colors.dart @@ -9,6 +9,7 @@ class PaletteColors{ static const Color greyInput = Color (0xffE1E1E1); static const Color lightGrey = Color(0xffD0D0D0); static const Color midGrey = Color(0xffC4C4C4); + static const Color greySearch = Color(0xffeaecef); static const Color backGrey = Color(0xffE9E9E9); static const Color green = Color(0xff06790c); } \ No newline at end of file diff --git a/lib/utils/fixos.dart b/lib/utils/fixos.dart index 0320aee..48430f0 100644 --- a/lib/utils/fixos.dart +++ b/lib/utils/fixos.dart @@ -1,5 +1,5 @@ class Fixos{ // static const String AMB_PROD = 'https://controle-educa-api.rkmsistemas.com.br'; static const String AMB_HOMO = 'https://homol-controle-educa-api.rkmsistemas.com.br'; - static const String AMB_DEV = 'http://192.168.0.42:8013'; + static const String AMB_DEV = 'http://192.168.18.2:8000'; } \ No newline at end of file diff --git a/lib/widgets/buttom_custom.dart b/lib/widgets/buttom_custom.dart index fdd08aa..f42dbd6 100644 --- a/lib/widgets/buttom_custom.dart +++ b/lib/widgets/buttom_custom.dart @@ -9,6 +9,10 @@ class ButtonCustom extends StatelessWidget{ final Color colorBorder; final widthCustom; final double height; + double borderRadiustopRight; + double borderRadiusbottomLeft; + double borderRadiustopLeft; + double borderRadiusbottomRight; ButtonCustom({ required this.onPressed, @@ -18,7 +22,11 @@ ButtonCustom({ required this.colorText, required this.colorBorder, this.widthCustom = 1.0, - this.height = 42.0, + this.height = 42.5, + this.borderRadiustopRight = 5.0, + this.borderRadiusbottomLeft = 5.0, + this.borderRadiustopLeft = 5.0, + this.borderRadiusbottomRight = 5.0, }); @override Widget build (BuildContext context) { @@ -29,6 +37,14 @@ ButtonCustom({ primary: colorButton, minimumSize: Size(width*widthCustom! , height), side: BorderSide(width: 2,color : colorBorder,), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topRight: Radius.circular(borderRadiustopRight), + bottomLeft: Radius.circular(borderRadiusbottomLeft), + topLeft: Radius.circular(borderRadiustopLeft), + bottomRight: Radius.circular(borderRadiusbottomRight) + ), + ), ), onPressed: onPressed, child: Text(text, diff --git a/lib/widgets/dados_alunos_container.dart b/lib/widgets/dados_alunos_container.dart index 7792642..974641d 100644 --- a/lib/widgets/dados_alunos_container.dart +++ b/lib/widgets/dados_alunos_container.dart @@ -8,15 +8,18 @@ import 'caixa_texto_container.dart'; class DadosAlunosContainer extends StatelessWidget { AlunoModel alunoModel; + int index; DadosAlunosContainer({ - required this.alunoModel + required this.alunoModel, + required this.index }); @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; + double resto = index%2; return InkWell( hoverColor: PaletteColors.lightGrey, @@ -24,37 +27,39 @@ class DadosAlunosContainer extends StatelessWidget { Navigator.pushNamed(context, '/cadastro',arguments: alunoModel); }, child: Container( - padding: EdgeInsets.symmetric(vertical: 10,horizontal: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + color: resto==0?Colors.white:PaletteColors.greySearch, + height: 50, + alignment: Alignment.centerLeft, + child: Row( children: [ - Row( - children: [ - Container( - width: width*0.2, - child: TextCustom(text: alunoModel.nome.toUpperCase()) - ), - Container( - width: width*0.1, - child: TextCustom(text: alunoModel.data_nasc.toUpperCase()) - ), - Container( - width: width*0.08, - child: TextCustom(text: alunoModel.ra.toUpperCase()) - ), - Container( - width: width*0.05, - child: TextCustom(text: alunoModel.serie.toUpperCase()) - ), - Container( - width: width*0.05, - child: TextCustom(text: alunoModel.turma.toUpperCase(),textAlign: TextAlign.center,) - ), - Container( - width: width*0.25, - child: TextCustom(text: alunoModel.escola.toUpperCase(),size: 14.0,) - ), - ], + Container( + width: width*0.2, + child: Row( + children: [ + SizedBox(width: 10,), + TextCustom(text: alunoModel.nome.toUpperCase()), + ], + ) + ), + Container( + width: width*0.1, + child: TextCustom(text: alunoModel.data_nasc.toUpperCase()) + ), + Container( + width: width*0.08, + child: TextCustom(text: alunoModel.ra.toUpperCase()) + ), + Container( + width: width*0.07, + child: TextCustom(text: alunoModel.serie.toUpperCase()) + ), + Container( + width: width*0.07, + child: TextCustom(text: alunoModel.turma.toUpperCase()) + ), + Container( + width: width*0.25, + child: TextCustom(text: alunoModel.escola.toUpperCase()) ), ], ), diff --git a/lib/widgets/input_text.dart b/lib/widgets/input_text.dart index b792104..a90bfc9 100644 --- a/lib/widgets/input_text.dart +++ b/lib/widgets/input_text.dart @@ -17,6 +17,7 @@ class InputText extends StatelessWidget { var onChanged; bool enable; List inputFormatters; + double borderRadius; InputText({ required this.controller, @@ -31,7 +32,8 @@ class InputText extends StatelessWidget { this.colorBackground = PaletteColors.greyInput, this.onChanged = null, this.enable = true, - required this.inputFormatters + required this.inputFormatters, + this.borderRadius = 3.0, }); @override @@ -63,19 +65,20 @@ class InputText extends StatelessWidget { // fillColor: PaletteColors.primaryColor, // labelText: title, border: OutlineInputBorder( - borderSide: BorderSide(width: 1,color: colorBorder) + borderSide: BorderSide(width: 1,color: colorBorder), + borderRadius: BorderRadius.all(Radius.circular(borderRadius)), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide(width: 1, color: colorBorder), - borderRadius: BorderRadius.circular(3), + borderRadius: BorderRadius.all(Radius.circular(borderRadius)), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide(width: 1, color: colorBorder), - borderRadius: BorderRadius.circular(3), + borderRadius: BorderRadius.all(Radius.circular(borderRadius)), ), disabledBorder: OutlineInputBorder( borderSide: BorderSide(width: 1, color: colorBorder), - borderRadius: BorderRadius.circular(3), + borderRadius: BorderRadius.all(Radius.circular(borderRadius)), ), hintText: hint, hintStyle: TextStyle( diff --git a/lib/widgets/item_acesso.dart b/lib/widgets/item_acesso.dart index 8ecd825..fe2716f 100644 --- a/lib/widgets/item_acesso.dart +++ b/lib/widgets/item_acesso.dart @@ -2,6 +2,8 @@ import 'package:educa_controle_acesso/widgets/text_custom.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import '../utils/colors.dart'; + class ItemAcesso extends StatelessWidget { bool check; String ID_USUARIO; @@ -9,6 +11,7 @@ class ItemAcesso extends StatelessWidget { String CADASTRADO_POR; String CIDADE; var onChanged; + int index; ItemAcesso({ required this.check, @@ -16,7 +19,8 @@ class ItemAcesso extends StatelessWidget { required this.DATA, required this.CADASTRADO_POR, required this.CIDADE, - required this.onChanged + required this.onChanged, + required this.index, }); @override @@ -26,29 +30,36 @@ class ItemAcesso extends StatelessWidget { String formataData = DATA == '00/00/0000'?'00/00/0000': DateFormat('dd/MM/yyyy hh:mm').format(DateTime.parse(DATA)); - return Row( - children: [ - Checkbox( - value: check, - onChanged:onChanged - ), - Container( - width: width*0.1, - child: TextCustom(text: ID_USUARIO) - ), - Container( - width: width*0.1, - child: TextCustom(text: formataData) - ), - Container( - width: width*0.1, - child: TextCustom(text: CADASTRADO_POR) - ), - Container( - width: width*0.1, - child: TextCustom(text: CIDADE) - ), - ], + double resto = index%2; + + return Container( + color: resto==0?Colors.white:PaletteColors.greySearch, + height: 50, + alignment: Alignment.centerLeft, + child: Row( + children: [ + Checkbox( + value: check, + onChanged:onChanged + ), + Container( + width: width*0.15, + child: TextCustom(text: ID_USUARIO) + ), + Container( + width: width*0.1, + child: TextCustom(text: formataData) + ), + Container( + width: width*0.1, + child: TextCustom(text: CADASTRADO_POR) + ), + Container( + width: width*0.1, + child: TextCustom(text: CIDADE) + ), + ], + ), ); } }