Changes to be committed:

modified:   lib/assets/logos/logo_letra_branca.png
	modified:   lib/assets/logos/logo_letra_primary.png
	new file:   lib/src/app/auth/screens/cadastro.dart
	new file:   lib/src/app/auth/screens/codigoverifica.dart
	modified:   lib/src/app/auth/screens/login.dart
	modified:   lib/src/router.dart
This commit is contained in:
steeve 2024-01-27 17:19:03 -03:00
parent 382a2a4255
commit 1b1d633732
6 changed files with 514 additions and 121 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -0,0 +1,211 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:recomendagro/assets/theme/colors.dart';
import 'package:recomendagro/src/app/auth/screens/codigoverifica.dart';
import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart';
import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart';
import 'package:recomendagro/src/shared/widgets/inputs/password_input.dart';
import '../../../shared/widgets/inputs/simple_input.dart';
class CadastroScreen extends ConsumerStatefulWidget {
static String path = '/cadastro';
const CadastroScreen({ Key? key }) : super(key: key);
@override
ConsumerState<CadastroScreen> createState() => _CadastroScreenState();
}
class _CadastroScreenState extends ConsumerState<CadastroScreen> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
bool showpass = false;
TextEditingController emailController = TextEditingController();
TextEditingController senhaController = TextEditingController();
TextEditingController codeController = TextEditingController();
TextEditingController nomeCompletoController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<FormState> _form2Key = GlobalKey<FormState>();
bool firstStep = true;
bool isloading = false;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Radius radius = const Radius.circular(20);
return WillPopScope(
onWillPop: () async {
return Future.value(false);
},
child: Scaffold(
key: _scaffoldKey,
extendBodyBehindAppBar: true,
appBar: const PreferredSize(child: SizedBox(), preferredSize: Size.fromHeight(0)),
body: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
image: DecorationImage(
image: AssetImage('lib/assets/images/bg_header.png'),
fit: BoxFit.cover,
)
),
child: Column(
children: [
const SizedBox(height: 30),
SizedBox(
height: Metrics.height(context)/6,
child: Center(
child: SizedBox(
child: Image.asset(
'lib/assets/logos/logo_branca.png',
fit: BoxFit.fill,
width: 100
)
)
),
),
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: radius,
topRight: radius
),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 35),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor
),
child:
Center(
child: Form(
key: _formKey,
child: FocusTraversalGroup(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 30),
Row(
children: [
GestureDetector(
onTap: (){
context.pop();
},
child: Container(
decoration: BoxDecoration(
border: Border.all(width: 1, color: AppColorLight.text04Color),
borderRadius: BorderRadius.circular(10)
),
child: Icon(Icons.chevron_left)
),
),
SizedBox(width: 10),
SizedBox(
child: Text(
"Cadastro",
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: AppColorLight.text01Color,
fontSize: 26
)
)
),
],
),
const SizedBox(height: 20),
// SizedBox(
// width: double.infinity,
// child: Text(
// "Dados de acesso",
// textAlign: TextAlign.start,
// style: Theme.of(context).textTheme.bodyMedium?.copyWith(
// fontWeight: FontWeight.w600,
// color: AppColorLight.text01Color,
// fontSize: 17
// )
// )
// ),
// const SizedBox(height: 20),
SimpleInput(
hintText: '',
title: 'Nome completo*',
controller: nomeCompletoController,
validator: true,
),
const SizedBox(height: 20),
SimpleInput(
title: 'Email',
hintText: 'Informe seu email',
typeInput: TypInputText.EMAIL,
controller: emailController,
validator: true,
),
const SizedBox(height: 20),
PasswordInput(
title: 'Senha',
hintText: 'Informe sua senha',
controller: senhaController,
validator: true,
),
const SizedBox(height: 20),
ButtonWidget(
label: 'Criar conta',
isloading: isloading,
onTap: (){
context.push(CodigoVerificacaoScreen.path);
}
),
// const SizedBox(height: 20),
// ButtonWidget(
// label: 'Fazer Login',
// type: TypeButton.secondary,
// onTap: (){
// }
// ),
const SizedBox(height: 30),
]
)
)
)
),
)
)
],
),
),
)
));
}
void doLogin() async {
// if(_formKey.currentState!.validate()){
// setState(() {
// isloading = true;
// });
// await ref.read(authController.notifier).fazerLogin({
// 'email': emailController.text,
// 'senha': senhaController.text
// });
// setState(() {
// isloading = false;
// });
// if(!mounted)return;
// if((ref.read(authController).hasError == false)){
// context.go(ListDocumentosScreen.path);
// }else{
// dialogToastMessage(
// context,
// message: 'Usuário ou senha inválidos.',
// dialogColorType: DialogColorType.WARNING
// );
// }
// }
}
}

View File

@ -0,0 +1,182 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:recomendagro/assets/theme/colors.dart';
import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart';
import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart';
import '../../../shared/widgets/inputs/simple_input.dart';
class CodigoVerificacaoScreen extends ConsumerStatefulWidget {
static String path = '/verificacodigo';
const CodigoVerificacaoScreen({ Key? key }) : super(key: key);
@override
ConsumerState<CodigoVerificacaoScreen> createState() => _CodigoVerificacaoScreenState();
}
class _CodigoVerificacaoScreenState extends ConsumerState<CodigoVerificacaoScreen> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
bool showpass = false;
TextEditingController emailController = TextEditingController();
TextEditingController senhaController = TextEditingController();
TextEditingController codeController = TextEditingController();
TextEditingController nomeCompletoController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<FormState> _form2Key = GlobalKey<FormState>();
bool firstStep = true;
bool isloading = false;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Radius radius = const Radius.circular(20);
return WillPopScope(
onWillPop: () async {
return Future.value(false);
},
child: Scaffold(
key: _scaffoldKey,
extendBodyBehindAppBar: true,
appBar: const PreferredSize(child: SizedBox(), preferredSize: Size.fromHeight(0)),
body: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
image: DecorationImage(
image: AssetImage('lib/assets/images/bg_header.png'),
fit: BoxFit.cover,
)
),
child: Column(
children: [
const SizedBox(height: 30),
SizedBox(
height: Metrics.height(context)/6,
child: Center(
child: SizedBox(
child: Image.asset(
'lib/assets/logos/logo_branca.png',
fit: BoxFit.fill,
width: 100
)
)
),
),
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: radius,
topRight: radius
),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 35),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor
),
child:Center(
child: Form(
key: _form2Key,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: double.infinity,
child: Text(
"Confirmação de conta",
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: AppColorLight.text01Color,
fontSize: 21
)
)
),
const SizedBox(height: 30),
SizedBox(
width: double.infinity,
child: RichText(
textAlign: TextAlign.start,
maxLines: 3,
text: TextSpan(
text: 'Verifique sua conta usando o código de ativação enviado ao seu e-mail ',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
height: 1.7,
color: AppColorLight.text03Color,
fontSize: 16
),
children: <TextSpan>[
TextSpan(
text: emailController.text,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: AppColorLight.text01Color,
fontSize: 16
),
),
]
)
)
),
const SizedBox(height: 30),
SimpleInput(
title: 'Código',
hintText: 'Informe código',
controller: codeController,
validator: true,
),
// CodeInputController(
// controller: codeController,
// ),
const SizedBox(height: 30),
ButtonWidget(
label: 'Verificar conta',
isloading: isloading,
onTap: (){
}
)
]
)
),
)
),
)
],
),
),
)
));
}
void doLogin() async {
// if(_formKey.currentState!.validate()){
// setState(() {
// isloading = true;
// });
// await ref.read(authController.notifier).fazerLogin({
// 'email': emailController.text,
// 'senha': senhaController.text
// });
// setState(() {
// isloading = false;
// });
// if(!mounted)return;
// if((ref.read(authController).hasError == false)){
// context.go(ListDocumentosScreen.path);
// }else{
// dialogToastMessage(
// context,
// message: 'Usuário ou senha inválidos.',
// dialogColorType: DialogColorType.WARNING
// );
// }
// }
}
}

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:recomendagro/assets/theme/colors.dart'; import 'package:recomendagro/assets/theme/colors.dart';
import 'package:recomendagro/src/app/auth/screens/cadastro.dart';
import 'package:recomendagro/src/shared/utils/enums.dart'; import 'package:recomendagro/src/shared/utils/enums.dart';
import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart'; import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart';
import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart'; import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart';
@ -42,130 +44,126 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Radius radius = const Radius.circular(20); Radius radius = const Radius.circular(20);
return WillPopScope( return Scaffold(
onWillPop: () async { key: _scaffoldKey,
return Future.value(false); extendBodyBehindAppBar: true,
}, appBar: const PreferredSize(child: SizedBox(), preferredSize: Size.fromHeight(0)),
child: Scaffold( body: SingleChildScrollView(
key: _scaffoldKey, child: Container(
extendBodyBehindAppBar: true, decoration: BoxDecoration(
appBar: const PreferredSize(child: SizedBox(), preferredSize: Size.fromHeight(0)), color: Theme.of(context).primaryColor,
body: SingleChildScrollView( image: const DecorationImage(
child: Container( image: AssetImage('lib/assets/images/bg_header.png'),
decoration: BoxDecoration( fit: BoxFit.cover,
color: Theme.of(context).primaryColor, )
image: const DecorationImage( ),
image: AssetImage('lib/assets/images/bg_header.png'), child: Column(
fit: BoxFit.cover, children: [
) const SizedBox(height: 25),
), SizedBox(
child: Column( height: Metrics.height(context)/3,
children: [ child: Center(
const SizedBox(height: 25), child: SizedBox(
SizedBox( child: Image.asset(
height: Metrics.height(context)/3, 'lib/assets/logos/logo_letra_branca.png',
child: Center( fit: BoxFit.fill,
child: SizedBox( width: 250
child: Image.asset(
'lib/assets/logos/logo_letra_branca.png',
fit: BoxFit.fill,
width: 200
)
) )
), )
), ),
ClipRRect( ),
borderRadius: BorderRadius.only( ClipRRect(
topLeft: radius, borderRadius: BorderRadius.only(
topRight: radius topLeft: radius,
topRight: radius
),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 35),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor
), ),
child: Container( child: Form(
padding: const EdgeInsets.symmetric(horizontal: 35), key: _formKey,
decoration: BoxDecoration( child: Center(
color: Theme.of(context).scaffoldBackgroundColor child: Column(
), children: [
child: Form( const SizedBox(height: 30),
key: _formKey, SizedBox(
child: Center( width: double.infinity,
child: Column( child: Text(
children: [ "Fazer Login",
const SizedBox(height: 30), textAlign: TextAlign.start,
SizedBox( style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: AppColorLight.text01Color,
fontSize: 26
)
)
),
const SizedBox(height: 20),
SimpleInput(
title: 'Email',
hintText: 'Informe seu email',
typeInput: TypInputText.EMAIL,
controller: emailController,
validator: true,
),
const SizedBox(height: 30),
PasswordInput(
title: 'Senha',
hintText: 'Informe sua senha',
controller: senhaController,
validator: true,
onFieldSubmitted: (value) {
// onTapLogin();
}
),
const SizedBox(height: 20),
InkWell(
onTap: (){
},
child: SizedBox(
width: double.infinity, width: double.infinity,
child: Text( child: Text(
"Fazer Login", 'Esqueceu a senha?',
textAlign: TextAlign.start, textAlign: TextAlign.end,
style: Theme.of(context).textTheme.bodyMedium?.copyWith( style: Theme.of(context).textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w400,
color: AppColorLight.text01Color, decoration: TextDecoration.underline,
fontSize: 26 color: Theme.of(context).primaryColor,
fontSize: AppFontSize.fontSize15
) )
) )
), ),
const SizedBox(height: 20), ),
SimpleInput( const SizedBox(height: 20),
title: 'Email', ButtonWidget(
hintText: 'Informe seu email', label: 'Fazer login',
typeInput: TypInputText.EMAIL, isloading: isloading,
controller: emailController, onTap: (){
validator: true,
), }
const SizedBox(height: 30), ),
PasswordInput( const SizedBox(height: 20),
title: 'Senha', ButtonWidget(
hintText: 'Informe sua senha', label: 'Não possui conta? Cadastre-se',
controller: senhaController, type: TypeButton.secondary,
validator: true, onTap: (){
onFieldSubmitted: (value) { context.push(CadastroScreen.path);
// onTapLogin(); }
} ),
), const SizedBox(height: 30),
const SizedBox(height: 20), ]
InkWell(
onTap: (){
},
child: SizedBox(
width: double.infinity,
child: Text(
'Esqueceu a senha?',
textAlign: TextAlign.end,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w400,
decoration: TextDecoration.underline,
color: Theme.of(context).primaryColor,
fontSize: AppFontSize.fontSize15
)
)
),
),
const SizedBox(height: 20),
ButtonWidget(
label: 'Fazer login',
isloading: isloading,
onTap: (){
}
),
const SizedBox(height: 20),
ButtonWidget(
label: 'Não possui conta? Cadastre-se',
type: TypeButton.secondary,
onTap: (){
// context.push(CadastreseScreen.path);
}
),
const SizedBox(height: 30),
]
)
) )
) )
) )
) )
], )
), ],
), ),
) ),
)); )
);
} }
void doLogin() async { void doLogin() async {

View File

@ -1,3 +1,5 @@
import 'package:recomendagro/src/app/auth/screens/cadastro.dart';
import 'package:recomendagro/src/app/auth/screens/codigoverifica.dart';
import 'package:recomendagro/src/app/auth/screens/login.dart'; import 'package:recomendagro/src/app/auth/screens/login.dart';
import 'package:recomendagro/src/app/base/screens/splash.dart'; import 'package:recomendagro/src/app/base/screens/splash.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -18,21 +20,21 @@ final routerProvider = Provider<GoRouter>((ref) {
parentNavigatorKey: _rootNavigatorKey, parentNavigatorKey: _rootNavigatorKey,
builder: (_, state) => const SlapshScreen() builder: (_, state) => const SlapshScreen()
), ),
// // GoRoute(
// // path: PageEditProfileMobile.path,
// // parentNavigatorKey: _rootNavigatorKey,
// // builder: (_, state) => const PageEditProfileMobile()
// // ),
GoRoute( GoRoute(
path: LoginScreen.path, path: LoginScreen.path,
parentNavigatorKey: _rootNavigatorKey, parentNavigatorKey: _rootNavigatorKey,
builder: (_, state) => const LoginScreen() builder: (_, state) => const LoginScreen()
), ),
// GoRoute( GoRoute(
// path: CadastreseScreen.path, path: CadastroScreen.path,
// parentNavigatorKey: _rootNavigatorKey, parentNavigatorKey: _rootNavigatorKey,
// builder: (_, state) => const CadastreseScreen() builder: (_, state) => const CadastroScreen()
// ), ),
GoRoute(
path: CodigoVerificacaoScreen.path,
parentNavigatorKey: _rootNavigatorKey,
builder: (_, state) => const CodigoVerificacaoScreen()
),
// GoRoute( // GoRoute(
// path: RecuperarContaScreen.path, // path: RecuperarContaScreen.path,
// parentNavigatorKey: _rootNavigatorKey, // parentNavigatorKey: _rootNavigatorKey,