201 lines
7.7 KiB
Dart
201 lines
7.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:tacban/assets/theme/colors.dart';
|
|
import 'package:tacban/src/app/auth/screens/codigoverifica.dart';
|
|
import 'package:tacban/src/shared/utils/responsive/responsive_metrics.dart';
|
|
import 'package:tacban/src/shared/widgets/back_button.dart';
|
|
import 'package:tacban/src/shared/widgets/buttons/simple_button.dart';
|
|
import 'package:tacban/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: [
|
|
const BackButtonWidget(),
|
|
const 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
|
|
// );
|
|
// }
|
|
// }
|
|
}
|
|
} |