Animate SetupCompleteScreen elements sequentially and add button scaling
This commit is contained in:
parent
67142977c0
commit
45a3e381c0
|
|
@ -3,7 +3,7 @@ import '../theme.dart';
|
|||
import '../route_transitions.dart';
|
||||
import 'billing_dashboard_screen.dart';
|
||||
|
||||
class SetupCompleteScreen extends StatelessWidget {
|
||||
class SetupCompleteScreen extends StatefulWidget {
|
||||
final String businessName;
|
||||
final String businessType;
|
||||
final String gstin;
|
||||
|
|
@ -21,6 +21,71 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
this.inventoryAlerts = true,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SetupCompleteScreen> createState() => _SetupCompleteScreenState();
|
||||
}
|
||||
|
||||
class _SetupCompleteScreenState extends State<SetupCompleteScreen> with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _checkScaleAnimation;
|
||||
late Animation<double> _cardSlideAnimation;
|
||||
late Animation<double> _cardOpacityAnimation;
|
||||
late Animation<double> _btnSlideAnimation;
|
||||
late Animation<double> _btnOpacityAnimation;
|
||||
double _btnScale = 1.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 1400),
|
||||
);
|
||||
|
||||
_checkScaleAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(0.0, 0.45, curve: Curves.elasticOut),
|
||||
),
|
||||
);
|
||||
|
||||
_cardSlideAnimation = Tween<double>(begin: 32.0, end: 0.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(0.25, 0.75, curve: Curves.easeOutCubic),
|
||||
),
|
||||
);
|
||||
|
||||
_cardOpacityAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(0.25, 0.65, curve: Curves.easeIn),
|
||||
),
|
||||
);
|
||||
|
||||
_btnSlideAnimation = Tween<double>(begin: 24.0, end: 0.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(0.55, 1.0, curve: Curves.easeOutCubic),
|
||||
),
|
||||
);
|
||||
|
||||
_btnOpacityAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: const Interval(0.55, 0.85, curve: Curves.easeIn),
|
||||
),
|
||||
);
|
||||
|
||||
_controller.forward();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String _getCategoryDisplayName(String id) {
|
||||
final cleanId = id.replaceAll('category/', '').trim().toLowerCase();
|
||||
switch (cleanId) {
|
||||
|
|
@ -41,7 +106,7 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final categoryText = _getCategoryDisplayName(businessType);
|
||||
final categoryText = _getCategoryDisplayName(widget.businessType);
|
||||
final gap = context.responsiveGap;
|
||||
|
||||
return Scaffold(
|
||||
|
|
@ -82,8 +147,10 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
children: [
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Circular Green Check badge
|
||||
Container(
|
||||
// Circular Green Check badge with Elastic Entrance Animation
|
||||
ScaleTransition(
|
||||
scale: _checkScaleAnimation,
|
||||
child: Container(
|
||||
width: 96,
|
||||
height: 96,
|
||||
decoration: const BoxDecoration(
|
||||
|
|
@ -113,6 +180,7 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: gap),
|
||||
Text(
|
||||
|
|
@ -131,8 +199,19 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
|
||||
SizedBox(height: gap * 1.5),
|
||||
|
||||
// Glassmorphism summary Card
|
||||
Container(
|
||||
// Glassmorphism summary Card with Fade + Slide Transition
|
||||
AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) {
|
||||
return Transform.translate(
|
||||
offset: Offset(0.0, _cardSlideAnimation.value),
|
||||
child: Opacity(
|
||||
opacity: _cardOpacityAnimation.value,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
|
|
@ -177,7 +256,7 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
businessName,
|
||||
widget.businessName,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -268,10 +347,10 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
const SizedBox(height: 4),
|
||||
Text(
|
||||
[
|
||||
if (barcodeScanner) 'Barcode Enabled',
|
||||
if (kotManagement) 'KOT/Kitchen Order',
|
||||
if (inventoryAlerts) 'Low Stock Warnings',
|
||||
if (!barcodeScanner && !kotManagement && !inventoryAlerts) 'Standard Register',
|
||||
if (widget.barcodeScanner) 'Barcode Enabled',
|
||||
if (widget.kotManagement) 'KOT/Kitchen Order',
|
||||
if (widget.inventoryAlerts) 'Low Stock Warnings',
|
||||
if (!widget.barcodeScanner && !widget.kotManagement && !widget.inventoryAlerts) 'Standard Register',
|
||||
].join(', '),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
|
|
@ -287,11 +366,33 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Primary Launcher CTA
|
||||
ElevatedButton(
|
||||
// Primary Launcher CTA with Slide + Fade + Hover/Tap Scale micro-animations
|
||||
AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, child) {
|
||||
return Transform.translate(
|
||||
offset: Offset(0.0, _btnSlideAnimation.value),
|
||||
child: Opacity(
|
||||
opacity: _btnOpacityAnimation.value,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MouseRegion(
|
||||
onEnter: (_) => setState(() => _btnScale = 1.03),
|
||||
onExit: (_) => setState(() => _btnScale = 1.0),
|
||||
child: AnimatedScale(
|
||||
scale: _btnScale,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: GestureDetector(
|
||||
onTapDown: (_) => setState(() => _btnScale = 0.96),
|
||||
onTapUp: (_) => setState(() => _btnScale = 1.03),
|
||||
onTapCancel: () => setState(() => _btnScale = 1.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
showTopAlert(
|
||||
context,
|
||||
|
|
@ -302,12 +403,12 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
context,
|
||||
FadeSlidePageRoute(
|
||||
child: BillingDashboardScreen(
|
||||
businessName: businessName,
|
||||
businessType: businessType,
|
||||
gstin: gstin,
|
||||
barcodeScanner: barcodeScanner,
|
||||
kotManagement: kotManagement,
|
||||
inventoryAlerts: inventoryAlerts,
|
||||
businessName: widget.businessName,
|
||||
businessType: widget.businessType,
|
||||
gstin: widget.gstin,
|
||||
barcodeScanner: widget.barcodeScanner,
|
||||
kotManagement: widget.kotManagement,
|
||||
inventoryAlerts: widget.inventoryAlerts,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -327,6 +428,10 @@ class SetupCompleteScreen extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue