atualização
This commit is contained in:
@@ -1,106 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../constants/app_colors.dart';
|
||||
import '../services/supabase_service.dart';
|
||||
import '../screens/logado_inicial_screen.dart';
|
||||
|
||||
class AnimatedButton extends StatefulWidget {
|
||||
final String text;
|
||||
final VoidCallback onPressed;
|
||||
final Color backgroundColor;
|
||||
final Color textColor;
|
||||
final bool isLoading;
|
||||
|
||||
const AnimatedButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.onPressed,
|
||||
required this.backgroundColor,
|
||||
required this.textColor,
|
||||
this.isLoading = false,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AnimatedButton> createState() => _AnimatedButtonState();
|
||||
}
|
||||
|
||||
class _AnimatedButtonState extends State<AnimatedButton>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _scaleAnimation;
|
||||
late Animation<double> _bounceAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
duration: const Duration(milliseconds: 150),
|
||||
vsync: this,
|
||||
);
|
||||
_scaleAnimation = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: 0.92,
|
||||
).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));
|
||||
_bounceAnimation = Tween<double>(begin: 0.0, end: -3.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(0.3, 0.8, curve: Curves.elasticOut),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _handleTap() {
|
||||
_controller.forward().then((_) {
|
||||
_controller.reverse().then((_) {
|
||||
widget.onPressed();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) {
|
||||
return Transform.translate(
|
||||
offset: Offset(0, _bounceAnimation.value),
|
||||
child: Transform.scale(
|
||||
scale: _scaleAnimation.value,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
onPressed: widget.isLoading ? null : _handleTap,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.backgroundColor,
|
||||
foregroundColor: widget.textColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
elevation: 5,
|
||||
),
|
||||
child: widget.isLoading
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: Text(
|
||||
widget.text,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../constants/app_colors.dart';
|
||||
import '../screens/logado_screen.dart';
|
||||
|
||||
class RegistrarSheet extends StatefulWidget {
|
||||
const RegistrarSheet({super.key});
|
||||
@@ -144,11 +45,9 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
),
|
||||
);
|
||||
|
||||
// Then navigate to LogadoInicialScreen
|
||||
// Navigate to LogadoScreen
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const LogadoInicialScreen(),
|
||||
),
|
||||
MaterialPageRoute(builder: (context) => const LogadoScreen()),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -193,7 +92,7 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
color: AppColors.backgroundGrey,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, -5),
|
||||
),
|
||||
@@ -254,7 +153,7 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white.withOpacity(0.1),
|
||||
fillColor: AppColors.white.withValues(alpha: 0.5),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
@@ -285,7 +184,7 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
controller: _emailController,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white.withOpacity(0.1),
|
||||
fillColor: AppColors.white.withValues(alpha: 0.5),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
@@ -317,7 +216,7 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white.withOpacity(0.1),
|
||||
fillColor: AppColors.white.withValues(alpha: 0.5),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
@@ -349,7 +248,7 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white.withOpacity(0.1),
|
||||
fillColor: AppColors.white.withValues(alpha: 0.5),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
@@ -371,12 +270,29 @@ class _RegistrarSheetState extends State<RegistrarSheet> {
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Register button
|
||||
AnimatedButton(
|
||||
text: 'Registrar',
|
||||
onPressed: _handleRegister,
|
||||
backgroundColor: AppColors.buttonColor,
|
||||
textColor: AppColors.white,
|
||||
isLoading: _isLoading,
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
onPressed: _isLoading ? null : _handleRegister,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.buttonColor,
|
||||
foregroundColor: AppColors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
elevation: 5,
|
||||
),
|
||||
child: _isLoading
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: const Text(
|
||||
'Registrar',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user