Skip to content

Conversation

@TheGoodUser
Copy link
Contributor

@TheGoodUser TheGoodUser commented Sep 11, 2025

Description

Enhance theme selection UI for improved UX

Fixes #415

Type of change

Please delete options that are not relevant.

  • UI/UX improvement (non-breaking change which enhances user experience)

How Has This Been Tested?

Tested locally with updated UI components and verified changes across different screen sizes.

Recording.2025-09-12.015512.mp4

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

Maintainer Checklist

Summary by CodeRabbit

  • New Features

    • Enhanced theme selection list with richer visuals: icons per theme, color swatches, and a clear checkmark for the selected theme.
    • Improved selection feedback with highlighted borders and tile colors based on the chosen theme.
    • Localized theme titles displayed consistently.
  • Refactor

    • Modularized theme list items into dedicated components for titles and trailing indicators, improving consistency and maintainability.
  • Style

    • Updated spacing, padding, and rounded tile shapes for a cleaner, more polished appearance.

@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Introduces modular theme selection tiles in ThemeScreen with padding and styled ListTiles, adds ThemeIcons enum for icon mapping, and creates TileTitle and TileTrailing widgets. Selection triggers themeController.setTheme with the lowercase theme name. Titles use AppLocalizations. No existing public APIs changed; new public widgets and enum added.

Changes

Cohort / File(s) Summary
Theme selection screen refactor
lib/themes/theme_screen.dart
Imports new components/enums; wraps body with symmetric padding; ListView.builder now computes isSelected, localizes title, resolves icon via ThemeIcons (fallback to classic); renders ListTile with dynamic border, colors, leading icon chip, TileTitle, and TileTrailing; onTap calls themeController.setTheme(theme.name.toLowerCase()).
Theme-to-icon mapping enum
lib/themes/theme_icon_enum.dart
Adds ThemeIcons enum mapping theme names to Icons (classic, vintage, forest, cream, amber, time); exposes fields theme and icon with const constructor.
Tile title widget
lib/themes/theme_tile_title.dart
Adds TileTitle StatelessWidget with themeName, theme, isSelected; renders title and three color dots (primary, secondary with optional border when selected, onPrimary); note: Column/Row configured with non-standard spacing properties per summary (may be compile-time issues).
Tile trailing widget
lib/themes/theme_tile_trailing.dart
Adds TileTrailing StatelessWidget showing a selected checkmark badge using theme colors, or a non-selected circular icon with layered shadows; includes local helper for non-selected state.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant ThemeScreen
  participant TileTitle
  participant TileTrailing
  participant ThemeIcons
  participant ThemeController

  User->>ThemeScreen: Open Themes
  ThemeScreen->>ThemeIcons: Resolve icon by theme name
  ThemeScreen->>TileTitle: Build(title, theme, isSelected)
  ThemeScreen->>TileTrailing: Build(theme, isSelected)

  User->>ThemeScreen: Tap a theme tile
  activate ThemeScreen
  ThemeScreen->>ThemeController: setTheme(theme.name.toLowerCase())
  deactivate ThemeScreen
  ThemeController-->>ThemeScreen: Notifies theme change
  ThemeScreen-->>User: UI updates selected tile
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks (4 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The changeset implements a redesigned theme picker and introduces ThemeIcons, TileTitle, and TileTrailing which address theme-selection UX improvements. However, linked issue #415 requires two deliverables: (1) fixing a non-responsive toggle in Profile > Settings > Themes and (2) updating the "No rooms found" landing page; the provided summaries show no explicit modifications to the Settings toggle or the landing-page code. Because the toggle fix is not clearly located in the diffs and the landing-page change is absent, the PR does not demonstrably meet all linked-issue objectives. Please indicate which files/commits fix the Settings toggle and include a minimal test or screenshot demonstrating the toggle now responds, and either add the "No rooms found" UX changes to this PR or open a linked follow-up PR and reference it; after those items are present, re-run verification.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title succinctly and accurately describes the primary change: improvements to the theme-selection UI and UX. It follows a conventional commit-style prefix (feat(theme-selection): …), is concise, and contains no noisy file lists or emojis. While a bit broad, it gives teammates a clear signal about the main change.
Out of Scope Changes Check ✅ Passed All added and modified files are within lib/themes and relate to the theme selection UI (theme_screen.dart plus new TileTitle/TileTrailing/ThemeIcons), so the changes remain on-topic for the PR objective to improve theme selection UX. I do not see edits to unrelated areas such as room-listing or the "No rooms found" landing page that would indicate out-of-scope modifications. Therefore there are no obvious out-of-scope changes introduced by this changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I hop through themes with gleeful speed,
A tap—new colors sprout from seed.
Icons gleam, a tidy trail,
Dots like candies never stale.
With checks that shine and borders neat,
My burrow’s UI feels complete. 🐇✨

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

🎉 Welcome @TheGoodUser!
Thank you for your pull request! Our team will review it soon. 🔍

  • Please ensure your PR follows the contribution guidelines. ✅
  • All automated tests should pass before merging. 🔄
  • If this PR fixes an issue, link it in the description. 🔗

We appreciate your contribution! 🚀

Copy link
Contributor

@M4dhav M4dhav left a comment

Choose a reason for hiding this comment

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

Please do these refactoring changes

@M4dhav
Copy link
Contributor

M4dhav commented Sep 11, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@M4dhav M4dhav added enhancement New feature or request good first issue Good for newcomers design labels Sep 11, 2025
@M4dhav
Copy link
Contributor

M4dhav commented Sep 11, 2025

Also please don't change the PR Template format like this, you are supposed to edit it in place

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
lib/themes/theme_screen.dart (1)

47-198: Consider extracting widgets and improving names.
Move builders into dedicated stateless widgets (ThemeTile, ThemeLeadingIcon, ThemeSelectionIndicator) for reuse/testability; aligns with prior feedback.

🧹 Nitpick comments (8)
lib/themes/theme_enum.dart (2)

7-16: Use strong typing instead of String for enum association.
Avoid string drift and simplify lookups by binding ThemeIcons to Themes.

Apply:

-enum ThemeIcons {
-  classic('classic', Icons.diamond),
-  vintage('vintage', Icons.temple_buddhist_rounded),
-  forest('forest', Icons.forest),
-  cream('cream', Icons.nights_stay),
-  amber('amber', Icons.local_fire_department),
-  time('time', Icons.access_time_outlined);
+enum ThemeIcons {
+  classic(Themes.classic, Icons.diamond),
+  vintage(Themes.vintage, Icons.temple_buddhist_rounded),
+  forest(Themes.forest, Icons.forest),
+  cream(Themes.cream, Icons.nights_stay),
+  amber(Themes.amber, Icons.local_fire_department),
+  time(Themes.time, Icons.access_time_outlined);
 
-  final String theme;
+  final Themes theme;
   final IconData icon;
   const ThemeIcons(this.theme, this.icon);
 }

7-12: Provide a helper/extension for icon lookup to avoid repeated scans.

Add (outside this hunk):

extension ThemesX on Themes {
  IconData get icon =>
      ThemeIcons.values.firstWhere((e) => e.theme == this).icon;
}
lib/themes/theme_screen.dart (6)

18-20: Localize user-facing strings.
Use AppLocalizations for AppBar title and the 'none' label.

-      appBar: AppBar(
-        title: const Text("Themes"),
-      ),
+      appBar: AppBar(
+        title: Text(AppLocalizations.of(context)!.themes),
+      ),
...
-            ? const Text("none")
+            ? Text(AppLocalizations.of(context)!.none)

Also applies to: 25-25


193-196: Honor theme contrast for leading icon.
Use onPrimaryColor instead of hardcoded white.

-      child: Icon(
-        iconData, size: 25,
-        color: Colors.white,
-      ),
+      child: Icon(
+        iconData,
+        size: 25,
+        color: theme.onPrimaryColor,
+      ),

73-77: ListTile color props conflict; align with Material tokens.
Let selectedTileColor drive background; avoid black26 default.

-        tileColor: isSelected ? theme.primaryColor : Colors.black26,
-        selected: isSelected,
-        selectedColor: theme.primaryColor,
-        selectedTileColor: theme.secondaryColor,
+        selected: isSelected,
+        tileColor: Colors.transparent,
+        selectedTileColor: theme.primaryColor,
+        selectedColor: theme.onPrimaryColor,

54-54: Remove no-op decoration.

-      decoration: BoxDecoration(),

23-23: Use const constructors for minor perf/readability.

-          padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2),
+          padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
...
-        contentPadding: EdgeInsets.symmetric(vertical: 13, horizontal: 18),
+        contentPadding: const EdgeInsets.symmetric(vertical: 13, horizontal: 18),
...
-        padding: EdgeInsets.all(5),
+        padding: const EdgeInsets.all(5),

Also applies to: 56-56, 157-157


178-185: Avoid per-build linear scans for icon mapping.
Cache a map once or use a typed enum helper (see enum comment) to cut repeated iterations.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1bbc38 and a7a10d1.

📒 Files selected for processing (2)
  • lib/themes/theme_enum.dart (1 hunks)
  • lib/themes/theme_screen.dart (2 hunks)
🔇 Additional comments (3)
lib/themes/theme_enum.dart (2)

3-17: Enums extracted to a dedicated file — good separation.


8-8: Verify icon availability across your Flutter version. Icons.temple_buddhist_rounded is present in the Flutter Icons API but may be missing on older SDKs — confirm your minimum Flutter SDK/Material Icons font supports it or fall back to Icons.temple_buddhist or IconData(0xf039a, fontFamily: 'MaterialIcons'). (api.flutter.dev)

lib/themes/theme_screen.dart (1)

107-115: , the spacing feature is fully available. No SizedBox workarounds needed.

@M4dhav
Copy link
Contributor

M4dhav commented Sep 11, 2025

Please also implement changes suggested by coderabbit

@TheGoodUser
Copy link
Contributor Author

Also please don't change the PR Template format like this, you are supposed to edit it in place

Apologies for changing the PR template format. I’ll make sure to follow the guidelines and only edit in place going forward.

@M4dhav
Copy link
Contributor

M4dhav commented Sep 12, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Sep 12, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
lib/themes/theme_screen.dart (1)

40-46: Icon lookup robust and localized-title-safe.

Using firstWhere(..., orElse: ...) with the raw theme key avoids runtime throws when no match exists. Nice.

🧹 Nitpick comments (6)
lib/themes/theme_icon_enum.dart (1)

3-14: Optional: remove duplicated theme string; use enum .name instead.

This avoids drift between the enum value and the stored string, and reduces API surface.

-enum ThemeIcons {
-  classic('classic', Icons.diamond),
-  vintage('vintage', Icons.temple_buddhist_rounded),
-  forest('forest', Icons.forest),
-  cream('cream', Icons.nights_stay),
-  amber('amber', Icons.local_fire_department),
-  time('time', Icons.access_time_outlined);
-
-  final String theme;
-  final IconData icon;
-  const ThemeIcons(this.theme, this.icon);
-}
+enum ThemeIcons {
+  classic(Icons.diamond),
+  vintage(Icons.temple_buddhist_rounded),
+  forest(Icons.forest),
+  cream(Icons.nights_stay),
+  amber(Icons.local_fire_department),
+  time(Icons.access_time_outlined);
+
+  final IconData icon;
+  const ThemeIcons(this.icon);
+}

Follow-up: update call sites to compare with e.name instead of e.theme. See suggested change in theme_screen.dart (Lines 40-45).

lib/themes/theme_tile_trailing.dart (1)

15-39: Make decoration constants to reduce rebuild allocations.

Const-qualify static shadows and colors.

-      return Container(
+      return Container(
         height: size,
         width: size,
         decoration: BoxDecoration(
-          boxShadow: [
-            BoxShadow(
-              color: Color.fromRGBO(50, 50, 93, 0.25),
+          boxShadow: const [
+            BoxShadow(
+              color: Color.fromRGBO(50, 50, 93, 0.25),
               blurRadius: 27,
               spreadRadius: -5,
               offset: Offset(0, 13),
             ),
-            BoxShadow(
-              color: Color.fromRGBO(0, 0, 0, 0.3),
+            BoxShadow(
+              color: Color.fromRGBO(0, 0, 0, 0.3),
               blurRadius: 16,
               spreadRadius: -8,
               offset: Offset(0, 8),
             ),
           ],
           shape: BoxShape.circle,
-          color: Colors.white,
+          color: Colors.white,
         ),
       );
lib/themes/theme_screen.dart (4)

83-88: Simplify tile colors; rely on selectedTileColor.

No need to branch tileColor on isSelected when selectedTileColor is set.

-                        tileColor: isSelected
-                            ? theme.primaryColor
-                            : Colors.black26,
+                        tileColor: Colors.black26,
                         selected: isSelected,
-                        selectedColor: theme.primaryColor,
+                        selectedColor: theme.primaryColor,
                         selectedTileColor: theme.secondaryColor,

23-23: Use consts and remove no-op decoration.

Minor allocation wins and cleanup.

-          padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2),
+          padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
@@
-                        contentPadding: EdgeInsets.symmetric(
+                        contentPadding: const EdgeInsets.symmetric(
                           vertical: 13,
                           horizontal: 18,
                         ),
@@
-                          padding: const EdgeInsets.all(12.0),
+                          padding: const EdgeInsets.all(12.0),
@@
-                          ),
+                          ),
@@
-                      decoration: BoxDecoration(),
+                      // decoration removed; had no effect

Also applies to: 51-54, 68-68, 76-76, 47-50


20-21: Consider localizing literals.

“Themes” and “none” are hardcoded; prefer AppLocalizations for consistency.

Also applies to: 24-26


40-46: If adopting enum .name, update comparison accordingly.

Needed only if you apply the ThemeIcons refactor.

-                    final IconData iconData = ThemeIcons.values
-                        .firstWhere(
-                          (e) => e.theme == theme.name.toLowerCase(),
-                          orElse: () => ThemeIcons.classic,
-                        )
-                        .icon;
+                    final IconData iconData = ThemeIcons.values
+                        .firstWhere(
+                          (e) => e.name == theme.name.toLowerCase(),
+                          orElse: () => ThemeIcons.classic,
+                        )
+                        .icon;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7a10d1 and f653417.

📒 Files selected for processing (4)
  • lib/themes/theme_icon_enum.dart (1 hunks)
  • lib/themes/theme_screen.dart (2 hunks)
  • lib/themes/theme_tile_title.dart (1 hunks)
  • lib/themes/theme_tile_trailing.dart (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-11T21:08:07.631Z
Learnt from: M4dhav
PR: AOSSIE-Org/Resonate#527
File: lib/themes/theme_screen.dart:57-63
Timestamp: 2025-09-11T21:08:07.631Z
Learning: In Flutter, while BorderRadiusGeometry.circular exists, the borderRadius parameter in RoundedRectangleBorder specifically expects a BorderRadius object, so use BorderRadius.circular instead of BorderRadiusGeometry.circular for better type compatibility.

Applied to files:

  • lib/themes/theme_screen.dart
📚 Learning: 2025-09-11T21:09:29.353Z
Learnt from: M4dhav
PR: AOSSIE-Org/Resonate#527
File: lib/themes/theme_screen.dart:57-63
Timestamp: 2025-09-11T21:09:29.353Z
Learning: In Flutter, when you don't want a border on a widget, use BorderSide.none instead of creating a BorderSide with transparent color. BorderSide.none is more semantically correct, performant, and follows Flutter conventions.

Applied to files:

  • lib/themes/theme_screen.dart
🔇 Additional comments (1)
lib/themes/theme_icon_enum.dart (1)

5-9: Verify icon availability across your min Flutter SDK.

Some symbols (e.g., Icons.temple_buddhist_rounded) depend on newer Material Symbols sets. Confirm they exist for your targeted Flutter/Dart versions to avoid compile-time errors.

@M4dhav
Copy link
Contributor

M4dhav commented Sep 12, 2025

Great work on the PR, thank you for your contribution!

@M4dhav M4dhav merged commit bfde40d into AOSSIE-Org:dev Sep 12, 2025
2 checks passed
@github-actions
Copy link
Contributor

PR Closed - Thank You, @TheGoodUser!

  • If this PR was merged: Congratulations! Your contribution is now part of the project. 🚀
  • If this PR was closed without merging: Don’t worry! You can always improve it and submit again. 💪

We appreciate your effort and look forward to more contributions from you! 🤝

@TheGoodUser
Copy link
Contributor Author

Great work on the PR, thank you for your contribution!

Thanks a lot! Excited that my second PR got merged. Looking forward to contributing more! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: Toggle Theme Button Malfunction + Enhanced User Experience for "No Rooms Found" Page.

2 participants