-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
300 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:organizei/Controller/LoginController.dart'; | ||
import 'package:organizei/Repository/LoginRepository.dart'; | ||
import 'package:organizei/components/botao.dart'; | ||
import 'package:organizei/components/dialog_personalizado.dart'; | ||
import 'package:organizei/components/input.dart'; | ||
import 'package:organizei/home_page.dart'; | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
|
||
Future<dynamic> entrar(BuildContext context) { | ||
late LoginController loginController; | ||
|
||
loginController = LoginController(LoginRepository(), context); | ||
|
||
return showDialog( | ||
barrierDismissible: false, | ||
barrierColor: Colors.white.withOpacity(0), | ||
context: context, | ||
builder: (context) { | ||
return Scaffold( | ||
backgroundColor: Colors.transparent, | ||
body: SingleChildScrollView( | ||
scrollDirection: Axis.vertical, | ||
child: Material( | ||
type: MaterialType.transparency, | ||
child: Material( | ||
type: MaterialType.transparency, | ||
child: Form( | ||
key: loginController.formKey, | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 24.0), | ||
child: ConstrainedBox( | ||
constraints: BoxConstraints( | ||
minHeight: MediaQuery.of(context).size.height, | ||
), | ||
child: DialogPersonalizado( | ||
nome: 'Login', | ||
//minHeight: MediaQuery.of(context).size.height * 0.8, | ||
child: <Widget>[ | ||
Padding( | ||
padding: EdgeInsets.only(bottom: 16), | ||
child: input( | ||
onSaved: loginController.loginUsuario, | ||
textController: | ||
loginController.controllerUsuario, | ||
label: 'e-mail', | ||
), | ||
), | ||
Padding( | ||
padding: EdgeInsets.only(bottom: 16), | ||
child: input( | ||
onSaved: loginController.loginSenha, | ||
textController: | ||
loginController.controllerSenha, | ||
label: 'senha', | ||
senha: true), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 16.0), | ||
child: Botao( | ||
texto: 'Entrar', | ||
cor: const Color(0xFF6BC8E4), | ||
clicar: () async { | ||
bool succes = | ||
await loginController.autentica(); | ||
SharedPreferences prefs = | ||
await SharedPreferences.getInstance(); | ||
|
||
if (succes) { | ||
Navigator.of(context).push<void>( | ||
MaterialPageRoute<void>( | ||
builder: (BuildContext context) => | ||
const HomePage(), | ||
), | ||
); | ||
} | ||
; | ||
}, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
), | ||
), | ||
), | ||
)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:organizei/Controller/LoginController.dart'; | ||
import 'package:organizei/Model/Tarefa/TarefaModel.dart'; | ||
import 'package:organizei/Model/Usuario/UsuarioModel.dart'; | ||
import 'package:organizei/Repository/LoginRepository.dart'; | ||
import 'package:organizei/Repository/TarefaRepository.dart'; | ||
import 'package:organizei/components/botao.dart'; | ||
import 'package:organizei/components/dialog_personalizado.dart'; | ||
import 'package:organizei/components/dialogs/login/usuarioCadastroDialog.dart'; | ||
import 'package:organizei/components/dialogs/tarefas/tarefaCadastroDialog.dart'; | ||
import 'package:organizei/start_page.dart'; | ||
import '../../../Controller/TarefaController.dart'; | ||
|
||
Future<dynamic> sair(BuildContext context, {Function? fecharDialog}) { | ||
UsuarioModel? usuario; | ||
|
||
late LoginController loginController; | ||
|
||
loginController = LoginController(LoginRepository(), context); | ||
return showDialog( | ||
barrierDismissible: false, | ||
barrierColor: Colors.white.withOpacity(0), | ||
context: context, | ||
builder: (context) { | ||
return StatefulBuilder(builder: (context, StateSetter setState) { | ||
return Scaffold( | ||
backgroundColor: Colors.transparent, | ||
body: SingleChildScrollView( | ||
scrollDirection: Axis.vertical, | ||
child: Material( | ||
type: MaterialType.transparency, | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 24.0), | ||
child: ConstrainedBox( | ||
constraints: BoxConstraints( | ||
minHeight: MediaQuery.of(context).size.height, | ||
), | ||
child: DialogPersonalizado( | ||
nome: '', | ||
cor: '', | ||
child: <Widget>[ | ||
Botao( | ||
texto: 'Editar perfil', | ||
cor: const Color(0xFF6385C3), | ||
clicar: () async { | ||
cadastrarUsuario(context, | ||
usuario: usuario, fecharDialog: fecharDialog); | ||
}, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 16, top: 16), | ||
child: Botao( | ||
texto: 'Sair', | ||
cor: const Color(0xFFEF7E69), | ||
clicar: () async { | ||
await loginController.limpaPreferencesLogin(); | ||
|
||
Navigator.pushAndRemoveUntil( | ||
context, | ||
MaterialPageRoute( | ||
builder: (_) => const StartPage()), | ||
(route) => false); | ||
|
||
// if (succes == true) { | ||
// Navigator.pop(context); | ||
// fecharDialog!(); | ||
// } | ||
}, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:organizei/Controller/UsuarioController.dart'; | ||
import 'package:organizei/Model/Usuario/UsuarioModel.dart'; | ||
import 'package:organizei/Repository/UsuarioRepository.dart'; | ||
import 'package:organizei/components/botao.dart'; | ||
import 'package:organizei/components/dialog_personalizado.dart'; | ||
import 'package:organizei/components/dialogs/login/entrarDialog.dart'; | ||
import 'package:organizei/components/input.dart'; | ||
|
||
Future<dynamic> cadastrarUsuario(BuildContext context, | ||
{UsuarioModel? usuario, Function? fecharDialog}) { | ||
late UsuarioController usuarioController; | ||
usuarioController = UsuarioController(UsuarioRepository(), context); | ||
|
||
return showDialog( | ||
barrierDismissible: false, | ||
barrierColor: Colors.white.withOpacity(0), | ||
context: context, | ||
builder: (context) { | ||
return Scaffold( | ||
backgroundColor: Colors.transparent, | ||
body: SingleChildScrollView( | ||
scrollDirection: Axis.vertical, | ||
child: Material( | ||
type: MaterialType.transparency, | ||
child: Form( | ||
key: usuarioController.formKey, | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 24.0), | ||
child: ConstrainedBox( | ||
constraints: BoxConstraints( | ||
minHeight: MediaQuery.of(context).size.height, | ||
), | ||
child: DialogPersonalizado( | ||
nome: 'Cadastro', | ||
//minHeight: MediaQuery.of(context).size.height * 0.8, | ||
child: <Widget>[ | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 16), | ||
child: input( | ||
onSaved: usuarioController.usuarioNome, | ||
textController: usuarioController.controllerNome, | ||
label: 'nome', | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 16), | ||
child: input( | ||
onSaved: usuarioController.usuarioApelido, | ||
textController: usuarioController.controllerApelido, | ||
label: 'apelido', | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 16), | ||
child: input( | ||
onSaved: usuarioController.usuarioEmail, | ||
textController: usuarioController.controllerEmail, | ||
label: 'e-mail', | ||
), | ||
//child: Input(label: 'e-mail'), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(bottom: 16), | ||
child: input( | ||
onSaved: usuarioController.usuarioSenha, | ||
textController: usuarioController.controllerSenha, | ||
label: 'senha', | ||
senha: true), | ||
//child: Input(label: 'senha'), | ||
), | ||
Botao( | ||
texto: 'Cadastrar', | ||
cor: const Color(0xFF6BC8E4), | ||
clicar: () async { | ||
bool succes = await usuarioController.saveUsuario(); | ||
|
||
if (succes == true) { | ||
Navigator.pop(context); | ||
entrar(context); | ||
} | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.