Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor container expansion logic and update UI to toggle arrow icon #2354

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions mobile-v3/lib/src/app/dashboard/widgets/analytics_specifics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ class _AnalyticsSpecificsState extends State<AnalyticsSpecifics> {
double containerHeight = 90;
bool expanded = false;

void expandContainer() {
void toggleContainer() {
setState(() {
containerHeight = 180;
expanded = true;
if (expanded) {
containerHeight = 90;
expanded = false;
} else {
containerHeight = 180;
expanded = true;
}
});
}

Expand Down Expand Up @@ -139,26 +144,38 @@ class _AnalyticsSpecificsState extends State<AnalyticsSpecifics> {
),
SizedBox(height: 8 + 4),
InkWell(
onTap: () => this.expandContainer(),
onTap: () => toggleContainer(),
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
padding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
height: containerHeight,
color: Theme.of(context).highlightColor,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"🚨 Air Quality Alerts",
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.w600),
),
Icon(Icons.arrow_drop_down)
]),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"🚨 Air Quality Alerts",
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.w600),
),
Icon(
expanded
? Icons.arrow_drop_up
: Icons.arrow_drop_down
)
],
),
if (expanded) ...[
SizedBox(height: 16),
Text(""),
],
Comment on lines +173 to +176
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove empty Text widget and implement actual content

The expanded section contains a placeholder empty Text widget that should be replaced with meaningful content.

Would you like help implementing the expanded content section with actual air quality alerts? I can provide a template for displaying alert information.

],
),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(44)),
Expand Down
Loading