2025-08-12 17:36:41 +07:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
2025-08-12 22:33:31 +07:00
|
|
|
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';
|
2025-08-12 17:36:41 +07:00
|
|
|
|
|
|
|
|
@RoutePage()
|
2025-08-12 22:33:31 +07:00
|
|
|
class ReportPage extends StatefulWidget {
|
2025-08-12 17:36:41 +07:00
|
|
|
const ReportPage({super.key});
|
|
|
|
|
|
2025-08-12 22:33:31 +07:00
|
|
|
@override
|
|
|
|
|
State<ReportPage> createState() => _ReportPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ReportPageState extends State<ReportPage> with TickerProviderStateMixin {
|
|
|
|
|
late AnimationController _fadeController;
|
|
|
|
|
late AnimationController _slideController;
|
|
|
|
|
late AnimationController _rotationController;
|
|
|
|
|
late Animation<double> _fadeAnimation;
|
|
|
|
|
late Animation<Offset> _slideAnimation;
|
|
|
|
|
late Animation<double> _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<double>(begin: 0.0, end: 1.0).animate(
|
|
|
|
|
CurvedAnimation(parent: _fadeController, curve: Curves.easeInOut),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_slideAnimation =
|
|
|
|
|
Tween<Offset>(begin: const Offset(0, 0.3), end: Offset.zero).animate(
|
|
|
|
|
CurvedAnimation(parent: _slideController, curve: Curves.elasticOut),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_rotationAnimation = Tween<double>(
|
|
|
|
|
begin: 0,
|
|
|
|
|
end: 2 * math.pi,
|
|
|
|
|
).animate(_rotationController);
|
|
|
|
|
|
|
|
|
|
_fadeController.forward();
|
|
|
|
|
_slideController.forward();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
_fadeController.dispose();
|
|
|
|
|
_slideController.dispose();
|
|
|
|
|
_rotationController.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-12 17:36:41 +07:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2025-08-12 22:33:31 +07:00
|
|
|
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),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
2025-08-12 17:36:41 +07:00
|
|
|
}
|
|
|
|
|
}
|