Skip to content

Commit 3844cf2

Browse files
authored
Merge pull request #2354 from airqo-platform/close-alert-fix
Refactor container expansion logic and update UI to toggle arrow icon
2 parents 8d4ec23 + 9d9f58c commit 3844cf2

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

mobile-v3/lib/src/app/dashboard/widgets/analytics_specifics.dart

+34-17
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ class _AnalyticsSpecificsState extends State<AnalyticsSpecifics> {
1717
double containerHeight = 90;
1818
bool expanded = false;
1919

20-
void expandContainer() {
20+
void toggleContainer() {
2121
setState(() {
22-
containerHeight = 180;
23-
expanded = true;
22+
if (expanded) {
23+
containerHeight = 90;
24+
expanded = false;
25+
} else {
26+
containerHeight = 180;
27+
expanded = true;
28+
}
2429
});
2530
}
2631

@@ -139,26 +144,38 @@ class _AnalyticsSpecificsState extends State<AnalyticsSpecifics> {
139144
),
140145
SizedBox(height: 8 + 4),
141146
InkWell(
142-
onTap: () => this.expandContainer(),
147+
onTap: () => toggleContainer(),
143148
child: AnimatedContainer(
144149
duration: Duration(milliseconds: 300),
145-
padding:
146-
const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
150+
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
147151
height: containerHeight,
148152
color: Theme.of(context).highlightColor,
149153
child: Container(
150154
padding: const EdgeInsets.symmetric(horizontal: 16),
151-
child: Row(
152-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
153-
crossAxisAlignment: CrossAxisAlignment.center,
154-
children: [
155-
Text(
156-
"🚨 Air Quality Alerts",
157-
style: TextStyle(
158-
fontSize: 16, fontWeight: FontWeight.w600),
159-
),
160-
Icon(Icons.arrow_drop_down)
161-
]),
155+
child: Column(
156+
children: [
157+
Row(
158+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
159+
crossAxisAlignment: CrossAxisAlignment.center,
160+
children: [
161+
Text(
162+
"🚨 Air Quality Alerts",
163+
style: TextStyle(
164+
fontSize: 16, fontWeight: FontWeight.w600),
165+
),
166+
Icon(
167+
expanded
168+
? Icons.arrow_drop_up
169+
: Icons.arrow_drop_down
170+
)
171+
],
172+
),
173+
if (expanded) ...[
174+
SizedBox(height: 16),
175+
Text(""),
176+
],
177+
],
178+
),
162179
decoration: BoxDecoration(
163180
color: Theme.of(context).scaffoldBackgroundColor,
164181
borderRadius: BorderRadius.circular(44)),

0 commit comments

Comments
 (0)