Add app version display to Wear Settings Screen#148
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds app version retrieval and display to the Wear settings screen using package_info_plus, plus a localization guidance update in the repo instructions indicating hardcoded strings instead of AppLocalizations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/wear/screens/wear_settings_screen.dart (1)
5-36: Guard asyncsetStatewithmountedand localize all user-visible stringsThe version-loading flow via
PackageInfo.fromPlatform()is correctly initialized ininitState, but has two issues:
setStateis called after anawaitwithout checkingmounted, which can throwsetState() called after dispose()if the screen is closed before the future completes.- The
'Error loading version'string is hardcoded; per project guidelines, all user-visible text inlib/wear/screens/**/*.dartmust useAppLocalizations.of(context).Additionally, the file contains other hardcoded strings (
'Settings','About','App Version','Account','Actions','Sign Out') that should also be localized.Fix the immediate lifecycle issue like this:
Future<void> _loadAppVersion() async { try { final packageInfo = await PackageInfo.fromPlatform(); + if (!mounted) return; setState(() { _appVersion = '${packageInfo.version} (${packageInfo.buildNumber})'; }); } catch (e) { + if (!mounted) return; setState(() { - _appVersion = 'Error loading version'; + _appVersion = AppLocalizations.of(context).errorLoadingVersion; }); } }Then route all user-visible strings through
AppLocalizationsthroughout the file.
🧹 Nitpick comments (2)
lib/wear/screens/wear_settings_screen.dart (2)
95-115: Localize the new “About” section headerThe new “About” header is a user-visible string in a screen that otherwise should follow the localization guideline. Please switch
'About'toAppLocalizations.of(context)...rather than a hardcoded literal, in line with the existing i18n approach.As per coding guidelines, all text in
lib/wear/screens/**/*.dartshould be sourced fromAppLocalizations.of(context).
116-179: Localize “App Version” label and consider a non-empty placeholder for_appVersionThe App Version card integrates nicely with the existing Wear UI, but two small tweaks would help:
- Replace the
'App Version'label with a value fromAppLocalizations.of(context)instead of a hardcoded string.- Since
_appVersionstarts as'', the value row will render blank until the async load completes; consider using a short placeholder (e.g., a localized “Loading…” or “Unknown”) to avoid an empty-looking row.These keep the UI consistent with your localization and UX guidelines.
As per coding guidelines, user-facing strings in
lib/wear/screens/**/*.dartshould be localized viaAppLocalizations.of(context).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lib/wear/screens/wear_settings_screen.dart(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
lib/{screens,widgets,wear/screens}/**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
lib/{screens,widgets,wear/screens}/**/*.dart: UseStreamBuilder<QuerySnapshot>andStreamBuilder<DocumentSnapshot>for real-time Firebase sync instead of Provider/ChangeNotifier
UseAppLocalizations.of(context)for all text translations instead of hardcoded strings
UseSingleTickerProviderStateMixinwithAnimationControllerfor animations in StatefulWidgets
Files:
lib/wear/screens/wear_settings_screen.dart
lib/**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
lib/**/*.dart: UsekDebugModechecks for debug print statements
Use snake_case for file names, PascalCase for class names, and camelCase for variable names
Files:
lib/wear/screens/wear_settings_screen.dart
lib/wear/{screens,widgets}/**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use
rotary_scrollbarpackage for rotary scroll support on WearOS
Files:
lib/wear/screens/wear_settings_screen.dart
lib/wear/**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use
wear_pluspackage for ambient mode support on WearOS
Files:
lib/wear/screens/wear_settings_screen.dart
🧠 Learnings (7)
📓 Common learnings
Learnt from: aadishsamir123
Repo: ASDev-Official/shopsync PR: 147
File: android/app/build.gradle:51-58
Timestamp: 2025-12-05T14:08:57.988Z
Learning: For android/app/build.gradle in the shopsync repository: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear), YYYYYYY=versionCode. Phone uses base 300000000, wear uses base 400000000.
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear) and YYYYYYY=versionCode
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/wear/**/*.dart : Use `wear_plus` package for ambient mode support on WearOS
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/wear/**/*.dart : Use `wear_plus` package for ambient mode support on WearOS
Applied to files:
lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/wear/{screens,widgets}/**/*.dart : Use `rotary_scrollbar` package for rotary scroll support on WearOS
Applied to files:
lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/{screens,widgets,wear/screens}/**/*.dart : Use `AppLocalizations.of(context)` for all text translations instead of hardcoded strings
Applied to files:
lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/{screens,widgets,wear/screens}/**/*.dart : Use `SingleTickerProviderStateMixin` with `AnimationController` for animations in StatefulWidgets
Applied to files:
lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/{screens,widgets,wear/screens}/**/*.dart : Use `StreamBuilder<QuerySnapshot>` and `StreamBuilder<DocumentSnapshot>` for real-time Firebase sync instead of Provider/ChangeNotifier
Applied to files:
lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Place WearOS-specific UI in `lib/wear/screens/` with circular layouts and rotary support
Applied to files:
lib/wear/screens/wear_settings_screen.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: CI-Code Check
This pull request enhances the
WearSettingsScreenby adding an "About" section that displays the app version information. The app version is dynamically loaded using thepackage_info_pluspackage and shown in a new card within the settings UI.New "About" Section and App Version Display:
package_info_plusto retrieve app version details._appVersionstate and asynchronous logic to load the app version ininitState.Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.