import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:line_icons/line_icons.dart'; import 'dart:math' as math; import '../../../common/theme/theme.dart'; import '../../components/button/button.dart'; import '../../components/spacer/spacer.dart'; import 'widgets/appbar.dart'; import 'widgets/quick_stats.dart'; import 'widgets/report_action.dart'; import 'widgets/revenue_summary.dart'; import 'widgets/sales.dart'; import 'widgets/top_product.dart'; @RoutePage() class ReportPage extends StatefulWidget { const ReportPage({super.key}); @override State createState() => _ReportPageState(); } class _ReportPageState extends State with TickerProviderStateMixin { late AnimationController _fadeController; late AnimationController _slideController; late AnimationController _rotationController; late Animation _fadeAnimation; late Animation _slideAnimation; late Animation _rotationAnimation; @override void initState() { super.initState(); _fadeController = AnimationController( duration: const Duration(milliseconds: 800), vsync: this, ); _slideController = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this, ); _rotationController = AnimationController( duration: const Duration(seconds: 3), vsync: this, )..repeat(); _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation(parent: _fadeController, curve: Curves.easeInOut), ); _slideAnimation = Tween(begin: const Offset(0, 0.3), end: Offset.zero).animate( CurvedAnimation(parent: _slideController, curve: Curves.elasticOut), ); _rotationAnimation = Tween( begin: 0, end: 2 * math.pi, ).animate(_rotationController); _fadeController.forward(); _slideController.forward(); } @override void dispose() { _fadeController.dispose(); _slideController.dispose(); _rotationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColor.background, body: CustomScrollView( slivers: [ // Custom App Bar with Hero Effect SliverAppBar( expandedHeight: 120, floating: false, pinned: true, backgroundColor: AppColor.primary, centerTitle: false, flexibleSpace: ReportAppBar(rotationAnimation: _rotationAnimation), actions: [ ActionIconButton(onTap: () {}, icon: LineIcons.download), ActionIconButton(onTap: () {}, icon: LineIcons.filter), SpaceWidth(8), ], ), // Content SliverPadding( padding: EdgeInsets.all(AppValue.padding), sliver: SliverList( delegate: SliverChildListDelegate([ FadeTransition( opacity: _fadeAnimation, child: SlideTransition( position: _slideAnimation, child: Column( children: [ ReportRevenueSummary( rotationAnimation: _rotationAnimation, ), const SpaceHeight(24), ReportQuickStats(), const SpaceHeight(24), ReportSales(), const SpaceHeight(24), ReportTopProduct(), const SpaceHeight(24), ReportAction(), const SpaceHeight(20), ], ), ), ), ]), ), ), ], ), ); } }