criada a tela seleciona_filho_screen.dart e situacao_escolar_screen.dart
This commit is contained in:
@@ -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,),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user