melhorar o sensor de calor
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../controllers/register_controller.dart';
|
||||
import '../utils/size_extension.dart'; // 👇 O NOSSO SUPERPODER!
|
||||
import '../utils/size_extension.dart';
|
||||
import 'dart:math' as math; // 👇 IMPORTANTE
|
||||
|
||||
class RegisterHeader extends StatelessWidget {
|
||||
const RegisterHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Icon(Icons.person_add_outlined, size: 100 * context.sf, color: const Color(0xFFE74C3C)),
|
||||
SizedBox(height: 10 * context.sf),
|
||||
Icon(Icons.person_add_outlined, size: 100 * safeSf, color: const Color(0xFFE74C3C)),
|
||||
SizedBox(height: 10 * safeSf),
|
||||
Text(
|
||||
'Nova Conta',
|
||||
style: TextStyle(fontSize: 36 * context.sf, fontWeight: FontWeight.bold, color: Colors.grey[900]),
|
||||
style: TextStyle(fontSize: 36 * safeSf, fontWeight: FontWeight.bold, color: Colors.grey[900]),
|
||||
),
|
||||
SizedBox(height: 5 * context.sf),
|
||||
SizedBox(height: 5 * safeSf),
|
||||
Text(
|
||||
'Cria o teu perfil no BasketTrack',
|
||||
style: TextStyle(fontSize: 16 * context.sf, color: Colors.grey[600], fontWeight: FontWeight.w500),
|
||||
style: TextStyle(fontSize: 16 * safeSf, color: Colors.grey[600], fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -39,71 +42,76 @@ class _RegisterFormFieldsState extends State<RegisterFormFields> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Form(
|
||||
key: widget.controller.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: widget.controller.nameController,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome Completo',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.person_outline, size: 22 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.emailController,
|
||||
validator: widget.controller.validateEmail,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-mail',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.email_outlined, size: 22 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validatePassword,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.lock_outlined, size: 22 * context.sf),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscurePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined, size: 22 * context.sf),
|
||||
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: 450 * safeSf), // LIMITA A LARGURA NO TABLET
|
||||
child: Form(
|
||||
key: widget.controller.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: widget.controller.nameController,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome Completo',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.person_outline, size: 22 * safeSf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
SizedBox(height: 20 * safeSf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.confirmPasswordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validateConfirmPassword,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Confirmar Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.lock_clock_outlined, size: 22 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
TextFormField(
|
||||
controller: widget.controller.emailController,
|
||||
validator: widget.controller.validateEmail,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-mail',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.email_outlined, size: 22 * safeSf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 20 * safeSf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validatePassword,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.lock_outlined, size: 22 * safeSf),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscurePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined, size: 22 * safeSf),
|
||||
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * safeSf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.confirmPasswordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validateConfirmPassword,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Confirmar Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.lock_clock_outlined, size: 22 * safeSf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -115,23 +123,25 @@ class RegisterButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 58 * context.sf,
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO
|
||||
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: 450 * safeSf), // LIMITA LARGURA
|
||||
height: 58 * safeSf,
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.isLoading ? null : () => controller.signUp(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * context.sf)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * safeSf)),
|
||||
elevation: 3,
|
||||
),
|
||||
child: controller.isLoading
|
||||
? SizedBox(
|
||||
width: 28 * context.sf, height: 28 * context.sf,
|
||||
width: 28 * safeSf, height: 28 * safeSf,
|
||||
child: const CircularProgressIndicator(strokeWidth: 3, valueColor: AlwaysStoppedAnimation<Color>(Colors.white)),
|
||||
)
|
||||
: Text('Criar Conta', style: TextStyle(fontSize: 18 * context.sf, fontWeight: FontWeight.bold)),
|
||||
: Text('Criar Conta', style: TextStyle(fontSize: 18 * safeSf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user