criada a tela seleciona_filho_screen.dart e situacao_escolar_screen.dart
This commit is contained in:
42
lib/controllers/main_controllers.dart
Normal file
42
lib/controllers/main_controllers.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:gainer_crypto/crypto.dart';
|
||||
|
||||
class MainControllers{
|
||||
encrypt(String senhaDigitada,String senhaUsuario) {
|
||||
// Deixa e senha digitada em maiuscula
|
||||
var senha = senhaDigitada.toUpperCase();
|
||||
// Faz a criptografia da senha inserida
|
||||
String senhaMD5 = grHashString(GRCryptoType.md5, senha);
|
||||
// Retira o tipo (1, 2 ou 3) da senha do Usuário
|
||||
int tipo = int.parse(senhaUsuario.substring(0, 1));
|
||||
// Define a possição inicial da quebra da senha
|
||||
int posicaoInicialMin = 0;
|
||||
int posicaoInicialMax= 0;
|
||||
int posicaoFinalMin = 0;
|
||||
int posicaoFinalMax = 0;
|
||||
// Pra cada tipo (1, 2 ou 3) define a posição inicial da quebra da senha
|
||||
if(tipo == 1){
|
||||
posicaoInicialMin = 0;
|
||||
posicaoInicialMax = 16;
|
||||
posicaoFinalMin = 16;
|
||||
posicaoFinalMax = 32;
|
||||
} else if(tipo == 2){
|
||||
posicaoInicialMin = 16;
|
||||
posicaoInicialMax = 32;
|
||||
posicaoFinalMin = 0;
|
||||
posicaoFinalMax = 16;
|
||||
} else if(tipo == 3){
|
||||
posicaoInicialMin = 0;
|
||||
posicaoInicialMax = 1;
|
||||
posicaoFinalMin = 31;
|
||||
posicaoFinalMax = 32;
|
||||
}
|
||||
|
||||
String inicio = senhaMD5.substring(posicaoInicialMin, posicaoInicialMax);
|
||||
String fim = senhaMD5.substring(posicaoFinalMin, posicaoFinalMax);
|
||||
|
||||
// Faz a criptografia e concatena ela com sha1 e md5
|
||||
String senhaCriptogradafa = tipo.toString() + '\$'+ grHashString(GRCryptoType.sha1, inicio + senha + fim);
|
||||
// Retorna a senha criptografada
|
||||
return senhaCriptogradafa;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,17 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/screens/login_screen.dart';
|
||||
|
||||
class PostHttpOverrides extends HttpOverrides{
|
||||
@override
|
||||
HttpClient createHttpClient( context){
|
||||
return super.createHttpClient(context)
|
||||
..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
HttpOverrides.global = new PostHttpOverrides();
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/screens/seleciona_filho_screen.dart';
|
||||
import '../controllers/main_controllers.dart';
|
||||
import '../utils/colors.dart';
|
||||
import '../widgets/buttom_custom.dart';
|
||||
import '../widgets/input_text.dart';
|
||||
import '../widgets/snackBars.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../widgets/text_custom.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({Key? key}) : super(key: key);
|
||||
@@ -14,33 +20,63 @@ class LoginScreen extends StatefulWidget {
|
||||
|
||||
class _LoginScreenState extends State<LoginScreen> {
|
||||
|
||||
final inputLogin = TextEditingController(text: 'teste');
|
||||
final inputSenha = TextEditingController(text: 'senha123');
|
||||
final inputLogin = TextEditingController(text: 'mmatos');
|
||||
final inputSenha = TextEditingController(text: 'mmatos');
|
||||
bool loading = false;
|
||||
|
||||
verificacao(){
|
||||
if(inputLogin.text.isNotEmpty){
|
||||
if(inputSenha.text.isNotEmpty){
|
||||
if(inputLogin.text == 'teste'){
|
||||
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);
|
||||
}
|
||||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
conectAPI();
|
||||
}else{
|
||||
showSnackBar(context, 'Preencha sua senha', Colors.red);
|
||||
}
|
||||
}else{
|
||||
showSnackBar(context, 'Preencha seu e-mail', Colors.red);
|
||||
showSnackBar(context, 'Preencha seu Login', Colors.red);
|
||||
}
|
||||
}
|
||||
|
||||
conectAPI()async{
|
||||
final url = 'http://192.168.18.2/projeto/api_educa/index.php/?NO_USERNAME=${inputLogin.text.toUpperCase()}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
print(map);
|
||||
if(map==false){
|
||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||
}else{
|
||||
if(map['NO_USERNAME']==map['SENHA']){
|
||||
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SelecionaFilhoScreen()),
|
||||
);
|
||||
}else{
|
||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||
}
|
||||
}else{
|
||||
print(MainControllers().encrypt(inputSenha.text,map['SENHA']));
|
||||
if(MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']){
|
||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SelecionaFilhoScreen()),
|
||||
);
|
||||
}else{
|
||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||
}
|
||||
// MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -56,7 +92,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Container(
|
||||
child: Image.asset("assets/images/logoEduca.png",width:width * 0.4,height: height * 0.12)
|
||||
),
|
||||
Container(
|
||||
loading?Container():Container(
|
||||
width: width>900? width * 0.18:width*0.7,
|
||||
child: InputText(
|
||||
inputFormatters: [],
|
||||
@@ -66,7 +102,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
colorBorder: PaletteColors.white,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
loading?Container():Container(
|
||||
width: width>900? width * 0.18:width*0.7,
|
||||
child: InputText(
|
||||
inputFormatters: [],
|
||||
@@ -78,7 +114,14 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: height * 0.02),
|
||||
ButtonCustom(
|
||||
loading?Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(width: 20,),
|
||||
TextCustom(text: 'VALIDANDO ACESSO...')
|
||||
],
|
||||
):ButtonCustom(
|
||||
widthCustom: 0.7,
|
||||
heightCustom: 0.07,
|
||||
text: "Entrar",
|
||||
|
||||
114
lib/screens/seleciona_filho_screen.dart
Normal file
114
lib/screens/seleciona_filho_screen.dart
Normal file
@@ -0,0 +1,114 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/screens/situacao_escolar_screen.dart';
|
||||
import 'package:rkm_educa_app/widgets/appbar_custom.dart';
|
||||
import '../controllers/main_controllers.dart';
|
||||
import '../utils/colors.dart';
|
||||
import '../widgets/buttom_custom.dart';
|
||||
import '../widgets/input_text.dart';
|
||||
import '../widgets/snackBars.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../widgets/text_custom.dart';
|
||||
|
||||
class SelecionaFilhoScreen extends StatefulWidget {
|
||||
const SelecionaFilhoScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SelecionaFilhoScreen> createState() => _SelecionaFilhoScreenState();
|
||||
}
|
||||
|
||||
class _SelecionaFilhoScreenState extends State<SelecionaFilhoScreen> {
|
||||
|
||||
String? select;
|
||||
List<String> alunos = [
|
||||
"Maria da Silva",
|
||||
"João da Silva"
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: PaletteColors.white,
|
||||
appBar: AppBarCustom().appbar(context, 'SELECIONAR FILHO'),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: Image.asset("assets/images/logoEduca.png",width:width * 0.4,height: height * 0.12)
|
||||
),
|
||||
SizedBox(height: height * 0.02),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextCustom(text: 'Estudantes',fontWeight: FontWeight.bold,size: 14.0,),
|
||||
Container(
|
||||
width: width*0.8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.white
|
||||
),
|
||||
color: PaletteColors.greyInput
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton(
|
||||
hint: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextCustom(text: 'Selecione'),
|
||||
),
|
||||
value: select,
|
||||
items: alunos.map((value) => DropdownMenuItem(
|
||||
value: value,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextCustom(
|
||||
text: value,
|
||||
color: Colors.black54,
|
||||
),
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
select = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: height * 0.02),
|
||||
ButtonCustom(
|
||||
widthCustom: 0.7,
|
||||
heightCustom: 0.07,
|
||||
text: "Avançar",
|
||||
size: 14.0,
|
||||
colorText: PaletteColors.white,
|
||||
colorButton: PaletteColors.primaryColor,
|
||||
colorBorder: PaletteColors.primaryColor,
|
||||
onPressed: () {
|
||||
if(select!=null){
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SituacaoEscolarScreen()),
|
||||
);
|
||||
}else{
|
||||
showSnackBar(context, 'Selecione um estudante para avançar', Colors.red);
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: height * 0.02),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/screens/situacao_escolar_screen.dart
Normal file
43
lib/screens/situacao_escolar_screen.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/utils/colors.dart';
|
||||
import 'package:rkm_educa_app/widgets/text_custom.dart';
|
||||
|
||||
import '../widgets/drawer_custom.dart';
|
||||
|
||||
class SituacaoEscolarScreen extends StatefulWidget {
|
||||
const SituacaoEscolarScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SituacaoEscolarScreen> createState() => _SituacaoEscolarScreenState();
|
||||
}
|
||||
|
||||
class _SituacaoEscolarScreenState extends State<SituacaoEscolarScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: PaletteColors.backPage,
|
||||
appBar: AppBar(
|
||||
iconTheme: IconThemeData(color: PaletteColors.grey),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: IconButton(
|
||||
onPressed: (){},
|
||||
icon: Icon(Icons.notifications_outlined,size: 32),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
drawer: DrawerCustom(),
|
||||
body: ListView(
|
||||
children: [
|
||||
Center(
|
||||
child: TextCustom(text: 'Situção Escolar',fontWeight: FontWeight.bold,size: 20.0,),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,14 @@ class PaletteColors{
|
||||
static const Color white = Colors.white;
|
||||
static const Color primaryColor = Color(0xffBB0202);
|
||||
static const Color secundColor = Color(0xffFF9E75);
|
||||
static const Color backPage = Color(0xffdfdfdf);
|
||||
static const Color bgColor = Color(0xff3A3A3A);
|
||||
static const Color grey = Color (0xff757575);
|
||||
static const Color divider = Color (0xffc9c9c9);
|
||||
static const Color greyInput = Color (0xffE1E1E1);
|
||||
static const Color lightGrey = Color(0xffD0D0D0);
|
||||
static const Color midGrey = Color(0xffC4C4C4);
|
||||
static const Color backGrey = Color(0xffE9E9E9);
|
||||
static const Color green = Color(0xff06790c);
|
||||
static const Color appBar = Color(0xff3A3A3A);
|
||||
}
|
||||
19
lib/widgets/appbar_custom.dart
Normal file
19
lib/widgets/appbar_custom.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/widgets/text_custom.dart';
|
||||
|
||||
import '../utils/colors.dart';
|
||||
|
||||
class AppBarCustom{
|
||||
@override
|
||||
PreferredSize appbar(BuildContext context,String title) {
|
||||
|
||||
return PreferredSize(
|
||||
preferredSize: Size.fromHeight(50),
|
||||
child: AppBar(
|
||||
backgroundColor: PaletteColors.appBar,
|
||||
centerTitle: true,
|
||||
title: TextCustom(text: title,color: Colors.white,fontWeight: FontWeight.bold,size: 20.0,),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
75
lib/widgets/drawer_custom.dart
Normal file
75
lib/widgets/drawer_custom.dart
Normal file
@@ -0,0 +1,75 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
import 'package:rkm_educa_app/screens/login_screen.dart';
|
||||
import 'package:rkm_educa_app/utils/colors.dart';
|
||||
import 'package:rkm_educa_app/widgets/text_custom.dart';
|
||||
|
||||
import 'item_drawer.dart';
|
||||
|
||||
class DrawerCustom extends StatelessWidget {
|
||||
const DrawerCustom({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: width*0.8,
|
||||
color: Colors.white,
|
||||
child: ListView(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 70,
|
||||
child: ClipRRect(
|
||||
borderRadius:BorderRadius.circular(70),
|
||||
child: Image.asset("assets/images/aluna.jpeg"),
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextCustom(text: 'Maria da Silva',fontWeight: FontWeight.bold,size: 16.0,textAlign: TextAlign.center),
|
||||
),
|
||||
Container(
|
||||
height: height*0.5,
|
||||
child: ListView(
|
||||
children: [
|
||||
ItemDrawer(icone: LineIcons.userCircle,texto: 'Perfil',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.clipboardList,texto: 'Boletim Escolar',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.fileContract,texto: 'Histórico Escolar',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.checkSquareAlt,texto: 'Chamadas / Presenças',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.calendarAlt,texto: 'Agenda Escolar',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.calendarTimes,texto: 'Eventos Escolares',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.mobilePhone,texto: 'Contatos',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
ItemDrawer(icone: LineIcons.bus,texto: 'Passe',),
|
||||
Container(height: 1,color: PaletteColors.divider,margin: EdgeInsets.symmetric(horizontal: 20),),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: height*0.15,),
|
||||
SafeArea(
|
||||
child: Container(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: IconButton(
|
||||
icon: Icon(LineIcons.alternateSignOut,size: 30),
|
||||
onPressed: (){
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LoginScreen()),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
28
lib/widgets/item_drawer.dart
Normal file
28
lib/widgets/item_drawer.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/widgets/text_custom.dart';
|
||||
|
||||
import '../utils/colors.dart';
|
||||
|
||||
class ItemDrawer extends StatelessWidget {
|
||||
IconData icone;
|
||||
String texto;
|
||||
|
||||
ItemDrawer({
|
||||
required this.texto,
|
||||
required this.icone
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: width*0.07),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: TextButton.icon(
|
||||
onPressed: (){},
|
||||
icon: Icon(icone,color: PaletteColors.grey,),
|
||||
label: TextCustom(text: texto,size: 16.0,)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
42
lib/widgets/text_custom.dart
Normal file
42
lib/widgets/text_custom.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../utils/colors.dart';
|
||||
|
||||
class TextCustom extends StatelessWidget {
|
||||
final text;
|
||||
final size;
|
||||
final color;
|
||||
final fontWeight;
|
||||
final textAlign;
|
||||
final maxLines;
|
||||
final underscore;
|
||||
|
||||
TextCustom({
|
||||
required this.text,
|
||||
this.size = 16.0,
|
||||
this.color = PaletteColors.grey,
|
||||
this.fontWeight = FontWeight.normal,
|
||||
this.textAlign = TextAlign.start,
|
||||
this.maxLines = 1,
|
||||
this.underscore,
|
||||
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(
|
||||
text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: textAlign,
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: size,
|
||||
fontWeight: fontWeight,
|
||||
decoration: underscore,
|
||||
decorationThickness: 4,
|
||||
fontFamily: 'Nunito'
|
||||
),
|
||||
maxLines: maxLines,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user