Untitled
Anonymous
Plain Text
09/26/2025 3:47 AM
20.5 KB
15
Indexable
Never
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import '/theme/app_theme.dart';
class SignUpPage extends StatefulWidget {
const SignUpPage({super.key});
@override
State<SignUpPage> createState() => _SignUpPageState();
}
class _SignUpPageState extends State<SignUpPage>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _fadeAnimation;
late Animation<double> _slideAnimation;
late Animation<double> _scaleAnimation;
final _nameController = TextEditingController();
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
final _confirmPasswordController = TextEditingController();
bool _obscurePassword = true;
bool _obscureConfirmPassword = true;
bool _agreeToTerms = false;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1000),
);
_fadeAnimation = Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.3, 1.0, curve: Curves.easeOut),
),
);
_slideAnimation = Tween<double>(begin: 40, end: 0).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.5, 1.0, curve: Curves.easeOut),
),
);
_scaleAnimation = Tween<double>(begin: 0.95, end: 1).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.6, 1.0, curve: Curves.easeOut),
),
);
WidgetsBinding.instance.addPostFrameCallback((_) {
_controller.forward();
});
}
@override
void dispose() {
_controller.dispose();
_nameController.dispose();
_emailController.dispose();
_passwordController.dispose();
_confirmPasswordController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppTheme.backgroundColor,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios, color: AppTheme.textColor, size: 20),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Transform.translate(
offset: Offset(0, _slideAnimation.value),
child: Opacity(
opacity: _fadeAnimation.value,
child: Transform.scale(
scale: _scaleAnimation.value,
child: Card(
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: Container(
padding: const EdgeInsets.all(32),
decoration: AppTheme.cardDecoration,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title
Text(
'Create Account',
style: AppTheme.headlineLarge,
),
const SizedBox(height: 8),
// Subtitle
Text(
'Join us today and get started',
style: AppTheme.bodyMedium,
),
const SizedBox(height: 32),
// Name Field
TextField(
controller: _nameController,
decoration: AppTheme.inputDecoration(
'Full Name',
Icons.person,
),
keyboardType: TextInputType.name,
style: AppTheme.bodyLarge,
),
const SizedBox(height: 20),
// Email Field
TextField(
controller: _emailController,
decoration: AppTheme.inputDecoration(
'Email',
Icons.email,
),
keyboardType: TextInputType.emailAddress,
style: AppTheme.bodyLarge,
),
const SizedBox(height: 20),
// Password Field
TextField(
controller: _passwordController,
decoration: InputDecoration(
labelText: 'Password',
labelStyle: TextStyle(
color: AppTheme.secondaryTextColor,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppTheme.primaryColor,
width: 1.5,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppTheme.primaryLightColor,
),
),
floatingLabelStyle: TextStyle(
color: AppTheme.primaryColor,
),
prefixIcon: Icon(
Icons.lock,
color: AppTheme.secondaryTextColor,
),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword
? Icons.visibility_off
: Icons.visibility,
color: AppTheme.secondaryTextColor,
),
onPressed: () {
setState(() {
_obscurePassword = !_obscurePassword;
});
},
),
contentPadding: const EdgeInsets.symmetric(
vertical: 16,
horizontal: 16,
),
),
obscureText: _obscurePassword,
style: AppTheme.bodyLarge,
),
const SizedBox(height: 20),
// Confirm Password Field
TextField(
controller: _confirmPasswordController,
decoration: InputDecoration(
labelText: 'Confirm Password',
labelStyle: TextStyle(
color: AppTheme.secondaryTextColor,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppTheme.primaryColor,
width: 1.5,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: AppTheme.primaryLightColor,
),
),
floatingLabelStyle: TextStyle(
color: AppTheme.primaryColor,
),
prefixIcon: Icon(
Icons.lock_outline,
color: AppTheme.secondaryTextColor,
),
suffixIcon: IconButton(
icon: Icon(
_obscureConfirmPassword
? Icons.visibility_off
: Icons.visibility,
color: AppTheme.secondaryTextColor,
),
onPressed: () {
setState(() {
_obscureConfirmPassword =
!_obscureConfirmPassword;
});
},
),
contentPadding: const EdgeInsets.symmetric(
vertical: 16,
horizontal: 16,
),
),
obscureText: _obscureConfirmPassword,
style: AppTheme.bodyLarge,
),
const SizedBox(height: 16),
// Terms and Conditions
Row(
children: [
Checkbox(
value: _agreeToTerms,
onChanged: (value) {
setState(() {
_agreeToTerms = value!;
});
},
activeColor: AppTheme.primaryColor,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
),
Expanded(
child: RichText(
text: TextSpan(
style: TextStyle(
color: AppTheme.secondaryTextColor,
fontSize: 14,
),
children: [
const TextSpan(text: 'I agree to the '),
TextSpan(
text: 'Terms of Service',
style: TextStyle(
color: AppTheme.primaryColor,
fontWeight: FontWeight.w600,
),
recognizer: TapGestureRecognizer()
..onTap = () {
// Navigate to terms
},
),
const TextSpan(text: ' and '),
TextSpan(
text: 'Privacy Policy',
style: TextStyle(
color: AppTheme.primaryColor,
fontWeight: FontWeight.w600,
),
recognizer: TapGestureRecognizer()
..onTap = () {
// Navigate to privacy policy
},
),
],
),
),
),
],
),
const SizedBox(height: 24),
// Sign Up Button
SizedBox(
width: double.infinity,
height: 56,
child: ElevatedButton(
onPressed: () {
// Sign up action
},
style: AppTheme.primaryButtonStyle,
child: const Text(
'SIGN UP',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 24),
// Divider
Row(
children: [
Expanded(
child: Divider(
color: AppTheme.primaryLightColor,
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
child: Text(
'or continue with',
style: TextStyle(
color: AppTheme.secondaryTextColor,
),
),
),
Expanded(
child: Divider(
color: AppTheme.primaryLightColor,
),
),
],
),
const SizedBox(height: 24),
// Social Login Buttons
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: OutlinedButton.icon(
onPressed: () {},
icon: Image.asset(
'assets/images/google.png',
width: 20,
height: 20,
),
label: Text(
'Google',
style: TextStyle(
color: AppTheme.textColor,
),
),
style: OutlinedButton.styleFrom(
foregroundColor: AppTheme.textColor,
padding: const EdgeInsets.symmetric(
vertical: 16,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
side: BorderSide(
color: AppTheme.primaryLightColor,
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: OutlinedButton.icon(
onPressed: () {},
icon: Image.asset(
'assets/images/facebook.png',
width: 20,
height: 20,
),
label: Text(
'Facebook',
style: TextStyle(
color: AppTheme.textColor,
),
),
style: OutlinedButton.styleFrom(
foregroundColor: AppTheme.textColor,
padding: const EdgeInsets.symmetric(
vertical: 16,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
side: BorderSide(
color: AppTheme.primaryLightColor,
),
),
),
),
],
),
const SizedBox(height: 32),
// Sign In Prompt
Center(
child: RichText(
text: TextSpan(
style: TextStyle(
color: AppTheme.secondaryTextColor,
fontSize: 14,
),
children: [
const TextSpan(
text: "Already have an account? ",
),
TextSpan(
text: 'Sign in',
style: TextStyle(
color: AppTheme.primaryColor,
fontWeight: FontWeight.w700,
),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context).pop();
},
),
],
),
),
),
],
),
),
),
),
),
);
},
),
),
),
);
}
}
Editor is loading...
Leave a Comment