Skip to content

Commit cb4874c

Browse files
committed
feat(dashboard): make main content area responsive
Replaces the main content `Row` with a `LayoutBuilder`. This allows the layout to switch from a `Row` on wider screens to a `Column` on narrower screens, ensuring the recent headlines, system status, and quick actions cards stack vertically on smaller displays.
1 parent a13e9d2 commit cb4874c

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

lib/dashboard/view/dashboard_page.dart

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,14 @@ class _DashboardPageState extends State<DashboardPage> {
106106
},
107107
),
108108
const SizedBox(height: AppSpacing.lg),
109-
Row(
110-
crossAxisAlignment: CrossAxisAlignment.start,
111-
children: [
112-
Expanded(
113-
flex: 2,
114-
child: _RecentHeadlinesCard(
115-
headlines: recentHeadlines,
116-
),
117-
),
118-
const SizedBox(width: AppSpacing.lg),
119-
Expanded(
120-
flex: 1,
121-
child: Column(
109+
LayoutBuilder(
110+
builder: (context, constraints) {
111+
const wideBreakpoint = 1200;
112+
final isWide = constraints.maxWidth > wideBreakpoint;
113+
114+
final mainContent = [
115+
_RecentHeadlinesCard(headlines: recentHeadlines),
116+
Column(
122117
children: [
123118
_SystemStatusCard(
124119
status: appConfig.appOperationalStatus,
@@ -127,8 +122,28 @@ class _DashboardPageState extends State<DashboardPage> {
127122
const _QuickActionsCard(),
128123
],
129124
),
130-
),
131-
],
125+
];
126+
127+
if (isWide) {
128+
return Row(
129+
crossAxisAlignment: CrossAxisAlignment.start,
130+
children: [
131+
Expanded(flex: 2, child: mainContent[0]),
132+
const SizedBox(width: AppSpacing.lg),
133+
Expanded(flex: 1, child: mainContent[1]),
134+
],
135+
);
136+
}
137+
138+
return Column(
139+
crossAxisAlignment: CrossAxisAlignment.stretch,
140+
children: [
141+
mainContent[0],
142+
const SizedBox(height: AppSpacing.lg),
143+
mainContent[1],
144+
],
145+
);
146+
},
132147
),
133148
],
134149
);

0 commit comments

Comments
 (0)