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 '../route_transitions.dart';
|
||||||
import 'billing_dashboard_screen.dart';
|
import 'billing_dashboard_screen.dart';
|
||||||
|
|
||||||
class SetupCompleteScreen extends StatelessWidget {
|
class SetupCompleteScreen extends StatefulWidget {
|
||||||
final String businessName;
|
final String businessName;
|
||||||
final String businessType;
|
final String businessType;
|
||||||
final String gstin;
|
final String gstin;
|
||||||
|
|
@ -21,6 +21,71 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
this.inventoryAlerts = true,
|
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) {
|
String _getCategoryDisplayName(String id) {
|
||||||
final cleanId = id.replaceAll('category/', '').trim().toLowerCase();
|
final cleanId = id.replaceAll('category/', '').trim().toLowerCase();
|
||||||
switch (cleanId) {
|
switch (cleanId) {
|
||||||
|
|
@ -41,7 +106,7 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final categoryText = _getCategoryDisplayName(businessType);
|
final categoryText = _getCategoryDisplayName(widget.businessType);
|
||||||
final gap = context.responsiveGap;
|
final gap = context.responsiveGap;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
@ -82,8 +147,10 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
// Circular Green Check badge
|
// Circular Green Check badge with Elastic Entrance Animation
|
||||||
Container(
|
ScaleTransition(
|
||||||
|
scale: _checkScaleAnimation,
|
||||||
|
child: Container(
|
||||||
width: 96,
|
width: 96,
|
||||||
height: 96,
|
height: 96,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
|
|
@ -113,6 +180,7 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
SizedBox(height: gap),
|
SizedBox(height: gap),
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -131,8 +199,19 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
|
|
||||||
SizedBox(height: gap * 1.5),
|
SizedBox(height: gap * 1.5),
|
||||||
|
|
||||||
// Glassmorphism summary Card
|
// Glassmorphism summary Card with Fade + Slide Transition
|
||||||
Container(
|
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,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
@ -177,7 +256,7 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
businessName,
|
widget.businessName,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|
@ -268,10 +347,10 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
[
|
[
|
||||||
if (barcodeScanner) 'Barcode Enabled',
|
if (widget.barcodeScanner) 'Barcode Enabled',
|
||||||
if (kotManagement) 'KOT/Kitchen Order',
|
if (widget.kotManagement) 'KOT/Kitchen Order',
|
||||||
if (inventoryAlerts) 'Low Stock Warnings',
|
if (widget.inventoryAlerts) 'Low Stock Warnings',
|
||||||
if (!barcodeScanner && !kotManagement && !inventoryAlerts) 'Standard Register',
|
if (!widget.barcodeScanner && !widget.kotManagement && !widget.inventoryAlerts) 'Standard Register',
|
||||||
].join(', '),
|
].join(', '),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
|
@ -287,11 +366,33 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
// Primary Launcher CTA
|
// Primary Launcher CTA with Slide + Fade + Hover/Tap Scale micro-animations
|
||||||
ElevatedButton(
|
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: () {
|
onPressed: () {
|
||||||
showTopAlert(
|
showTopAlert(
|
||||||
context,
|
context,
|
||||||
|
|
@ -302,12 +403,12 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
FadeSlidePageRoute(
|
FadeSlidePageRoute(
|
||||||
child: BillingDashboardScreen(
|
child: BillingDashboardScreen(
|
||||||
businessName: businessName,
|
businessName: widget.businessName,
|
||||||
businessType: businessType,
|
businessType: widget.businessType,
|
||||||
gstin: gstin,
|
gstin: widget.gstin,
|
||||||
barcodeScanner: barcodeScanner,
|
barcodeScanner: widget.barcodeScanner,
|
||||||
kotManagement: kotManagement,
|
kotManagement: widget.kotManagement,
|
||||||
inventoryAlerts: inventoryAlerts,
|
inventoryAlerts: widget.inventoryAlerts,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -327,6 +428,10 @@ class SetupCompleteScreen extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue