novo projeto

This commit is contained in:
Reginaldo
2023-05-24 18:43:37 -03:00
parent aa5c2a9423
commit ddacba5525
135 changed files with 4759 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
import 'package:educa_controle_acesso/utils/colors.dart';
import 'package:educa_controle_acesso/widgets/input_text.dart';
import 'package:educa_controle_acesso/widgets/text_custom.dart';
import 'package:flutter/material.dart';
import '../models/aluno_model.dart';
import '../widgets/dados_alunos_container.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
var controllerPesquisa = TextEditingController();
List<AlunoModel> alunos = [];
List resultadoPesquisa = [];
carregarAlunos(){
alunos.add(AlunoModel(nome: 'Maria da Silva', data_nasc: '01/01/2010', ra: '000.000.000-8', escola: 'EMEI Profª Therezinha de Jesus Alguz', serie: '8', turma: 'A'));
alunos.add(AlunoModel(nome: 'Pedro Costa Almeida', data_nasc: '01/01/2015', ra: '111.111.111-5', escola: 'EMEI Profª Enestina Loureiro Miranda', serie: '7', turma: 'C'));
pesquisarAluno();
}
pesquisa(){
pesquisarAluno();
}
pesquisarAluno()async{
resultadoPesquisa =[];
if(controllerPesquisa.text.isNotEmpty){
for (int i =0;alunos.length>i;i++) {
String nome = alunos[i].nome.toUpperCase();
if(nome.contains(controllerPesquisa.text.toUpperCase())){
if(resultadoPesquisa.length<10){
resultadoPesquisa.add(alunos[i]);
}
}
}
}else{
for(int i = 0;i<10;i++){
resultadoPesquisa.add(alunos[i]);
}
}
setState(() {});
}
@override
void initState() {
super.initState();
carregarAlunos();
controllerPesquisa.addListener(pesquisa);
}
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(title: TextCustom(text: 'Cadastrar responsável',color: Colors.white,),backgroundColor: PaletteColors.grey),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: [
SizedBox(height: height*0.05),
Padding(
padding: EdgeInsets.symmetric(horizontal: width>900?width*0.3:width*0.05),
child: InputText(controller: controllerPesquisa, width: width*0.2,title: 'Pesquisar Aluno(a)',)
),
Container(
padding: EdgeInsets.symmetric(horizontal: width>900?width*0.3:width*0.05),
width: width*0.5,
height: height*0.5,
child: ListView.separated(
separatorBuilder: (context,index){
return Divider();
},
itemCount: resultadoPesquisa.length,
itemBuilder:(context,index){
return DadosAlunosContainer(alunoModel: resultadoPesquisa[index],);
}
),
)
],
),
),
);
}
}

View File

@@ -0,0 +1,98 @@
import 'package:educa_controle_acesso/screens/home_screen.dart';
import 'package:educa_controle_acesso/widgets/input_text.dart';
import 'package:flutter/material.dart';
import '../utils/colors.dart';
import '../widgets/buttom_custom.dart';
import '../widgets/snackBars.dart';
import '../widgets/text_custom.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({Key? key}) : super(key: key);
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
final inputEmail = TextEditingController(text: 'teste@gmail.com');
final inputSenha = TextEditingController(text: 'senha123');
verificacao(){
if(inputEmail.text.isNotEmpty){
if(inputSenha.text.isNotEmpty){
if(inputEmail.text == 'teste@gmail.com'){
if(inputSenha.text == 'senha123'){
showSnackBar(context, 'Acesso validado', Colors.green);
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => HomeScreen()),
);
}else{
showSnackBar(context, 'E-mail não cadastrado e/ou senha incorreta', Colors.red);
}
}else{
showSnackBar(context, 'E-mail não cadastrado e/ou senha incorreta', Colors.red);
}
}else{
showSnackBar(context, 'Preencha sua senha', Colors.red);
}
}else{
showSnackBar(context, 'Preencha seu e-mail', Colors.red);
}
}
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: PaletteColors.white,
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
child: Image.asset("assets/image/logo.PNG",width:width * 0.2 ,height: height * 0.12)
),
Container(
width: width>900? width * 0.18:width*0.5,
child: InputText(
controller: inputEmail,
title: 'E-mail',
width: width>900? width * 0.18:width*0.5,
colorBorder: PaletteColors.white,
),
),
SizedBox(height: height * 0.02),
Container(
width: width>900? width * 0.18:width*0.5,
child: InputText(
controller: inputSenha,
title: 'Senha',
obscure: true,
width: width * 0.18,
colorBorder: PaletteColors.white,
),
),
SizedBox(height: height * 0.02),
ButtonCustom(
widthCustom: 0.1,
heightCustom: 0.07,
text: "Entrar",
size: 14.0,
colorText: PaletteColors.white,
colorButton: PaletteColors.primaryColor,
colorBorder: PaletteColors.primaryColor,
onPressed: ()=>verificacao(),
font: 'Nunito',
),
],
),
)
);
}
}