atualização

This commit is contained in:
Carlos Correia
2026-03-05 18:08:06 +00:00
parent ebca3cfdce
commit 6931d6ada2
18 changed files with 725 additions and 2191 deletions

View File

@@ -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 '../screens/logado_screen.dart';
class EntrarSheet extends StatefulWidget {
const EntrarSheet({super.key});
@@ -137,11 +38,9 @@ class _EntrarSheetState extends State<EntrarSheet> {
),
);
// Then navigate to LogadoInicialScreen
// Navigate to LogadoScreen
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => const LogadoInicialScreen(),
),
MaterialPageRoute(builder: (context) => const LogadoScreen()),
);
}
} catch (e) {
@@ -222,7 +121,7 @@ class _EntrarSheetState extends State<EntrarSheet> {
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),
),
@@ -273,7 +172,7 @@ class _EntrarSheetState extends State<EntrarSheet> {
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,
@@ -306,7 +205,7 @@ class _EntrarSheetState extends State<EntrarSheet> {
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,
@@ -328,12 +227,31 @@ class _EntrarSheetState extends State<EntrarSheet> {
const SizedBox(height: 32),
// Login button
AnimatedButton(
text: 'Entrar',
onPressed: _handleLogin,
backgroundColor: AppColors.buttonColor,
textColor: AppColors.white,
isLoading: _isLoading,
SizedBox(
width: double.infinity,
height: 60,
child: ElevatedButton(
onPressed: _isLoading ? null : _handleLogin,
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(
'Entrar',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 20),