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

feat(settings): add possibility for the user to change app's language (only in the settings) #648

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

BombardierBulge
Copy link
Contributor

@BombardierBulge BombardierBulge commented Mar 15, 2025

Added settings panel and language panel
obrazobrazobraz


Important

Adds a settings panel with language selection capability, including new navigation routes and UI components.

  • Settings Panel:
    • Adds SettingsView in settings.dart with a language selection option.
    • Introduces LanguageDialog in language_settings_view.dart for language selection.
  • Navigation:
    • Adds SettingsRoute to app_router.dart.
    • Implements navigateSettings() in navigation_commands.dart.
  • UI Components:
    • Adds SettingsTitle widget in settings_title.dart to navigate to settings.
    • Updates navigation_tab_view.dart to include SettingsTitle.
  • Localization:
    • Adds "language" key to app_pl.arb for Polish localization.

This description was created by Ellipsis for a7d3b67. It will automatically update as commits are pushed.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 16, 2025
@BombardierBulge BombardierBulge marked this pull request as ready for review March 16, 2025 16:59
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 8af59de in 2 minutes and 45 seconds

More details
  • Looked at 230 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 11 drafted comments based on config settings.
1. lib/features/settings/settings.dart:23
  • Draft comment:
    The onTap callback for language selection has an empty if block; consider applying the language update.
  • Reason this comment was not posted:
    Based on historical feedback, this comment is too similar to comments previously marked by users as bad.
2. lib/features/navigation_tab_view/widgets/settings_title.dart:14
  • Draft comment:
    FutureBuilder is used to call PackageInfo but its snapshot is never used. Consider removing FutureBuilder or handling snapshot states appropriately.
  • Reason this comment was not posted:
    Based on historical feedback, this comment is too similar to comments previously marked by users as bad.
3. lib/features/settings/widgets/language_settings_view.dart:22
  • Draft comment:
    The 'selectedLanguage' variable is reinitialized on every build inside StatefulBuilder, which prevents state persistence. Move it outside the builder or use a proper stateful widget.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    While technically true that the variable is reinitialized on every build, this appears intentional. The initial value always comes from the current locale, and any changes immediately trigger a Navigator.pop() which closes the dialog. There's no need for state persistence between builds since the dialog closes on selection. The StatefulBuilder is only used to trigger UI updates while the dialog is open.
    The reviewer might be right that this could be done more cleanly with a StatefulWidget. There could be edge cases where rebuilds cause unexpected behavior.
    However, the current implementation is functionally correct for its purpose - showing a dialog and closing it on selection. The reinitialization doesn't cause any actual issues.
    The comment should be deleted as it suggests fixing something that isn't actually broken and works as intended in this specific use case.
4. lib/features/navigation_tab_view/widgets/settings_title.dart:15
  • Draft comment:
    Using Future.microtask(PackageInfo.fromPlatform) seems unnecessary if the package info is not used. Consider calling PackageInfo.fromPlatform() directly or removing it.
  • Reason this comment was not posted:
    Marked as duplicate.
5. lib/features/navigator/app_router.dart:18
  • Draft comment:
    There appears to be a potential typographical error in the import on line 18: "digital_guide_entrace.dart". It may be intended to be "digital_guide_entrance.dart" to match the common spelling. Please verify if this is a typo or an intentional naming.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. lib/features/navigator/utils/navigation_commands.dart:157
  • Draft comment:
    Typographical consistency issue: In the navigateDigitalGuideDoor function, the parameter is named doorID but is passed to DoorRoute as doorsID. Consider renaming it (e.g., doorId) to ensure consistent naming and improve code clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. lib/features/navigator/utils/navigation_commands.dart:114
  • Draft comment:
    Typographical note: The type and function name DigitalGuideEntrace in navigateEntrancesDetails appear to contain a typo ('Entrace' instead of 'Entrance'). If this isn’t intentional, consider correcting it to improve readability.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. lib/l10n/app_pl.arb:97
  • Draft comment:
    Typographical error: The value 'Nowa funckcjonalność' should be corrected to 'Nowa funkcjonalność'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. lib/l10n/app_pl.arb:87
  • Draft comment:
    Typographical error: The key 'scientific_cirlces' appears to be misspelled. It should likely be 'scientific_circles'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. lib/l10n/app_pl.arb:342
  • Draft comment:
    Typographical error: The key 'adapted_toilet_seat_hight' seems to be misspelled. It should be 'adapted_toilet_seat_height'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. lib/l10n/app_pl.arb:743
  • Draft comment:
    Typographical error: The key 'handle_heigth_text' is misspelled. It should be 'handle_height_text'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_gLVBJrKy4gBM7kp4


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

return FutureBuilder(
future: Future.microtask(PackageInfo.fromPlatform),
builder:
(context, snapshot) => NavigationTile(
Copy link
Contributor

Choose a reason for hiding this comment

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

FutureBuilder is not using the snapshot; if PackageInfo isn't needed for UI, remove FutureBuilder.

contentPadding: const EdgeInsets.all(AboutUsConfig.spacerHeight),
content: StatefulBuilder(
builder: (context, setState) {
String selectedLanguage = context.localize.localeName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Initializing selectedLanguage inside StatefulBuilder causes reinitialization on rebuild; move it outside the builder.

NavigationTile(
onTap: () async {
final selectedLang = await LanguageDialog.show(context);
if (selectedLang != null) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

The onTap callback processes the language selection result but does nothing with it. Consider handling the selected language or adding a TODO comment.

Suggested change
if (selectedLang != null) {}
if (selectedLang != null) { /* TODO: Handle selected language */ }

@simon-the-shark
Copy link
Member

maybe add polish and english emojis to the ui?

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on a7d3b67 in 1 minute and 7 seconds

More details
  • Looked at 30 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. lib/features/settings/settings.dart:24
  • Draft comment:
    TODO remains: Implement language change handling logic after selection.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative, indicating a TODO item that remains to be implemented. It doesn't provide a suggestion or ask for confirmation about a specific code change.
2. lib/features/settings/widgets/language_settings_view.dart:55
  • Draft comment:
    Consider deferring or removing setState if the dialog closes immediately on tap.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. lib/features/settings/widgets/language_settings_view.dart:24
  • Draft comment:
    Added flag emojis are a nice UX touch. Ensure consistent emoji support across target devices.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_x95qyT66e2MA5YDM


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

onTap: () async {
final selectedLang = await LanguageDialog.show(context);
if (selectedLang != null) {
/* TODO: Handle selected language */
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO left unimplemented. Link to issue or implement handling before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

feat(settings): add possibility for the user to change app's language (only in the settings)
3 participants