refactor: Replace header implementation with ReportsHeader widget for cleaner code

This commit is contained in:
Achintha Isuru
2026-02-20 02:09:54 -05:00
parent af78b38ea2
commit c261b340a1

View File

@@ -86,88 +86,10 @@ class _ReportsPageState extends State<ReportsPage>
body: SingleChildScrollView(
child: Column(
children: [
// Header
Container(
padding: const EdgeInsets.only(
top: 60,
left: 20,
right: 20,
bottom: 32,
),
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
UiColors.primary,
UiColors.buttonPrimaryHover,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Column(
children: [
Row(
children: [
GestureDetector(
onTap: () => Modular.to.toClientHome(),
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: const Icon(
UiIcons.arrowLeft,
color: UiColors.white,
size: 20,
),
),
),
const SizedBox(width: 12),
Text(
context.t.client_reports.title,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: UiColors.white,
),
),
],
),
const SizedBox(height: 24),
// Tabs
Container(
height: 44,
padding: const EdgeInsets.all(4)
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2)
borderRadius: BorderRadius.circular(12),
),
child: TabBar(
controller: _tabController,
indicator: BoxDecoration(
color: UiColors.white,
borderRadius: BorderRadius.circular(8),
),
labelColor: UiColors.primary,
unselectedLabelColor: UiColors.white,
labelStyle: const TextStyle(
fontWeight: FontWeight.w600,
fontSize: 14,
),
indicatorSize: TabBarIndicatorSize.tab,
dividerColor: Colors.transparent,
tabs: [
Tab(text: context.t.client_reports.tabs.today),
Tab(text: context.t.client_reports.tabs.week),
Tab(text: context.t.client_reports.tabs.month),
Tab(text: context.t.client_reports.tabs.quarter),
],
),
),
],
),
// Header with title and tabs
ReportsHeader(
tabController: _tabController,
onTabChanged: _loadSummary,
),
// Content