ajustes de layout

This commit is contained in:
Reginaldo
2023-08-11 17:12:50 -03:00
parent 1ffaa70fed
commit 4500ee04aa
9 changed files with 197 additions and 125 deletions

View File

@@ -31,6 +31,13 @@ class MyApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'CONTROLE DE ACESSO',
theme: ThemeData(
scrollbarTheme: ScrollbarThemeData(
thickness: MaterialStateProperty.all<double>(15),
thumbVisibility: MaterialStateProperty.all<bool>(true),
thumbColor: MaterialStateProperty.all<Color>(Colors.black38),
)
),
onUnknownRoute: (RouteSettings settings) {
return MaterialPageRoute(
builder: (context) => Scaffold(

View File

@@ -39,9 +39,10 @@ class _HomeScreenState extends State<HomeScreen> {
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<HomeScreen> {
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<HomeScreen> {
}
},
),
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<HomeScreen> {
)
),
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<HomeScreen> {
),
),
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<HomeScreen> {
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<HomeScreen> {
):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<HomeScreen> {
}
},
),
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<HomeScreen> {
)
),
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<HomeScreen> {
filtroTurma = false;
filtroEscola = false;
}),
)
),
],
)
),
@@ -420,7 +452,7 @@ class _HomeScreenState extends State<HomeScreen> {
filtroTurma = false;
filtroEscola = false;
}),
)
),
],
)
),
@@ -439,15 +471,15 @@ class _HomeScreenState extends State<HomeScreen> {
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<HomeScreen> {
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<HomeScreen> {
filtroEstudante = false;
filtroEscola = false;
}),
)
),
],
)
),
@@ -485,7 +517,7 @@ class _HomeScreenState extends State<HomeScreen> {
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<HomeScreen> {
filtroTurma = false;
filtroEstudante = false;
}),
)
),
],
)
),
@@ -504,19 +536,18 @@ class _HomeScreenState extends State<HomeScreen> {
),
),
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,);
}
),
)

View File

@@ -23,11 +23,10 @@ class _LoginScreenState extends State<LoginScreen> {
//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<LoginScreen> {
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<LoginScreen> {
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<LoginScreen> {
}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);

View File

@@ -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);
}

View File

@@ -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';
}

View File

@@ -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,

View File

@@ -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())
),
],
),

View File

@@ -17,6 +17,7 @@ class InputText extends StatelessWidget {
var onChanged;
bool enable;
List<TextInputFormatter> 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(

View File

@@ -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)
),
],
),
);
}
}