Files
flash-call-otp/receiver_app_new/lib/screens/success_screen.dart
2026-05-23 16:17:20 +03:00

172 lines
5.4 KiB
Dart

import 'package:flutter/material.dart';
import 'phone_input_screen.dart';
class SuccessScreen extends StatefulWidget {
final String phone;
const SuccessScreen({super.key, required this.phone});
@override
State<SuccessScreen> createState() => _SuccessScreenState();
}
class _SuccessScreenState extends State<SuccessScreen>
with SingleTickerProviderStateMixin {
late AnimationController _scaleController;
late Animation<double> _scaleAnimation;
@override
void initState() {
super.initState();
_scaleController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 600),
);
_scaleAnimation = CurvedAnimation(
parent: _scaleController,
curve: Curves.elasticOut,
);
// Start the animation
_scaleController.forward();
}
@override
void dispose() {
_scaleController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Animated checkmark
ScaleTransition(
scale: _scaleAnimation,
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
color: Colors.green.shade50,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.green.withValues(alpha: 0.2),
blurRadius: 30,
spreadRadius: 10,
),
],
),
child: Icon(
Icons.check_circle_rounded,
size: 70,
color: Colors.green.shade600,
),
),
),
const SizedBox(height: 40),
// Success text
const Text(
'✅ تم التحقق من رقمك بنجاح',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
const SizedBox(height: 24),
// Phone number
Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(
horizontal: 24, vertical: 16),
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey.shade200),
),
child: Column(
children: [
Text(
'رقم الهاتف',
style: TextStyle(
fontSize: 13,
color: Colors.grey.shade600,
),
),
const SizedBox(height: 4),
Text(
widget.phone,
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
letterSpacing: 1,
),
),
],
),
),
const SizedBox(height: 48),
// Continue button
SizedBox(
width: double.infinity,
height: 56,
child: ElevatedButton(
onPressed: () {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) => const PhoneInputScreen(),
),
(route) => false,
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 2,
),
child: const Text(
'متابعة',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(height: 40),
],
),
),
),
),
),
);
}
}