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/cadastro.dart'; import 'package:tacban/src/app/home/screens/home_screen.dart'; import 'package:tacban/src/shared/utils/enums.dart'; import 'package:tacban/src/shared/utils/responsive/responsive_metrics.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 LoginScreen extends ConsumerStatefulWidget { static String path = '/login'; const LoginScreen({ Key? key }) : super(key: key); @override ConsumerState createState() => _LoginScreenState(); } class _LoginScreenState extends ConsumerState { final GlobalKey _scaffoldKey = GlobalKey(); bool showpass = false; TextEditingController emailController = TextEditingController(); TextEditingController senhaController = TextEditingController(); final GlobalKey _formKey = GlobalKey(); bool isloading = false; @override void initState() { // Future.delayed(const Duration(seconds: 1)).then((value)async{ // SharedPreferences prefs = ref.watch(sharedPreferencesProvider); // if(prefs.containsKey('token') && prefs.getString('token') != null){ // // ref.read(profileController).getInfoProfile().then((value) =>{ // // NavigationService.navigateReplacementTo('/homebase', arguments: 0) // // }) // context.go('/home/dashboard'); // } // }); super.initState(); } @override Widget build(BuildContext context) { Radius radius = const Radius.circular(20); return 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: const DecorationImage( image: AssetImage('lib/assets/images/bg_header.png'), fit: BoxFit.cover, ) ), child: Column( children: [ const SizedBox(height: 25), SizedBox( height: Metrics.height(context)/3, child: Center( child: SizedBox( child: Image.asset( 'lib/assets/logos/logo_letra_branca.png', fit: BoxFit.fill, width: 250 ) ) ), ), ClipRRect( borderRadius: BorderRadius.only( topLeft: radius, topRight: radius ), child: Container( padding: const EdgeInsets.symmetric(horizontal: 35), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor ), child: Form( key: _formKey, child: Center( child: Column( children: [ const SizedBox(height: 30), SizedBox( width: double.infinity, child: Text( "Fazer Login", textAlign: TextAlign.start, 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, 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: (){ context.push(HomeScreen.path); } ), const SizedBox(height: 20), ButtonWidget( label: 'Não possui conta? Cadastre-se', type: TypeButton.secondary, onTap: (){ context.push(CadastroScreen.path); } ), 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 // ); // } // } } }