8000 feat(ui): currency/language flags by tsinis · Pull Request #353 · tsinis/sealed_world · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(ui): currency/language flags #353

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

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

Conversation

tsinis
Copy link
Owner
@tsinis tsinis commented Jun 21, 2025

Description

New experimental adaptiveFlags constructors for currency and language pickers + constructed languages flags + flag of the EU (for the EUR currency).

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • 🧪 Tests
  • 📝 Documentation
  • ⚙️ CI/CD or GitHub Workflow configuration change
  • 📦 Dependencies update

Checks

Please look at the following checklist to ensure that your PR can be accepted quickly:

  • Data comes from open-source resources with the MIT License (if presented).
  • New code is documented and the data source is referenced (if presented).
  • Existing tests are up to date with these changes.
  • New code is fully tested (if presented).

Summary by CodeRabbit

  • New Features

    • Introduced adaptive flag selection for language and currency pickers, automatically displaying the most relevant flag based on locale or user context.
    • Added new flag definitions for international and constructed languages (e.g., European Union, Esperanto, Ido, Interlingue, Interlingua, Volapük).
    • Added the IsoFlag widget for flexible flag rendering by ISO-standardized objects.
    • Pickers now support customizable flag maps and adaptive flag logic for enhanced visual customization.
  • Enhancements

    • Unified flag widget interfaces to support foreground child widgets, explicit sizing, and improved decoration options.
    • Improved diagnostics and theming for flag widgets, including support for custom overlay widgets.
    • Added new extension methods and interfaces for easier flag and country data access.
  • Bug Fixes

    • Deprecated outdated Afghanistan flag and updated references to its alternative.
    • Improved fallback handling and robustness in localization delegates.
  • Documentation

    • Updated and clarified documentation for new and existing flag maps, widget parameters, and adaptive flag logic.
  • Tests

    • Added comprehensive widget tests for adaptive flag behavior in language and currency pickers.
    • Added tests for localization delegate context retrieval.
  • Chores

    • Updated SDK and dependency versions.
    • Removed unused or deprecated workspace tasks and dev dependencies.
    • Minor code and comment cleanups for clarity and maintainability.

tsinis added 22 commits June 3, 2025 21:54
Copy link
coderabbitai bot commented Jun 21, 2025
📝 Walkthrough

Walkthrough

This update introduces adaptive and customizable flag mapping for country, language, and currency pickers, including new extension methods and constructors for locale-aware flag selection. The flag widget infrastructure is refactored: a generic IsoFlag widget is added, CountryFlag is simplified to delegate to it, and support for foreground child widgets is unified. New constructed/international language flags are defined, and relevant test suites are expanded. Several SDK and dependency versions are updated.

Changes

File(s) Change Summary
.vscode/sealed_world.code-workspace Removed macOS-specific font smoothing and golden image testing tasks from VS Code workspace config.
packages/analysis_options.yaml Disabled avoid-continue lint rule; removed related test exclusion.
packages/world_countries/example/lib/routing/parser.dart Removed an inline ignore comment for continue statement.
packages/world_countries/example/pubspec.yaml
packages/world_countries/pubspec.yaml
packages/world_flags/example/pubspec.yaml
packages/world_flags/pubspec.yaml
Updated Dart SDK constraints and dependencies; incremented package versions.
packages/world_countries/lib/src/extensions/pickers/basic_picker_flags_extension.dart Added extension for adaptive flag mapping based on locale and custom logic.
packages/world_countries/lib/src/helpers/typed_locale_delegate.dart Added @mustBeConst annotations to constructor parameters; improved static context retrieval methods.
packages/world_countries/lib/src/interfaces/basic_picker_interface.dart Added optional flagsMap parameter for custom flag mapping in pickers.
packages/world_countries/lib/src/theme/pickers_theme_data.dart Added flagsMap property to picker theme data and copyWith.
packages/world_countries/lib/src/widgets/country/country_picker.dart Added support for custom flagsMap in constructor and builder.
packages/world_countries/lib/src/widgets/country/country_tile.dart Added comment regarding padding for dense tiles.
packages/world_countries/lib/src/widgets/currency/currency_picker.dart Added adaptive flags constructor, default flags map, and flagsMap support for currencies.
packages/world_countries/lib/src/widgets/language/language_picker.dart Added adaptive flags constructor and flagsMap support for languages.
packages/world_countries/lib/src/widgets/phone_code/phone_code_picker.dart Added flagsMap support for custom phone code flag display.
packages/world_countries/lib/src/widgets/pickers/basic_picker.dart Added flagsMap property and parameter to abstract picker class and copyWith.
packages/world_countries/lib/src/widgets/pickers/basic_picker_state.dart Changed text controller fallback logic in picker state.
packages/world_countries/test/src/helpers/typed_locale_delegate_test.dart Added tests for static context retrieval methods in locale delegate.
packages/world_countries/test/src/widgets/currency/currency_picker_test.dart Added widget tests for adaptive currency flag mapping and display.
packages/world_countries/test/src/widgets/language/language_picker_test.dart Added widget tests for adaptive language flag mapping and display.
packages/world_flags/example/lib/main.dart Refactored example to use a custom map of ISO items and flags; updated item rendering logic.
packages/world_flags/example/lib/settings_dialog.dart Improved flag image display with explicit aspect ratio and decoration changes.
packages/world_flags/lib/src/collections/properties_map.dart Added comment with ignore directive for deprecated Afghanistan flag entry.
packages/world_flags/lib/src/data/flags_map_part_2.data.dart Deprecated Afghanistan flag properties constant.
packages/world_flags/lib/src/data/other_iso_flags_map.dart Added new flag property constants for international/constructed language flags (EU, Esperanto, etc).
packages/world_flags/lib/src/helpers/extensions/basic_flag_extension_copy_with.dart Enhanced copyWith for BasicFlag with new parameters; deprecated foregroundWidget in favor of child.
packages/world_flags/lib/src/helpers/extensions/country_flag_extension.dart Added extension to access country from CountryFlag.
packages/world_flags/lib/src/interfaces/decorated_flag_interface.dart Added width, height, and child properties to decorated flag interface.
packages/world_flags/lib/src/theme/flag_theme_data.dart Added child property, updated constructor, copyWith, equality, and diagnostics.
packages/world_flags/lib/src/ui/country_flag.dart Refactored CountryFlag to extend generic IsoFlag, removing direct UI logic.
packages/world_flags/lib/src/ui/decorated_flag_widget.dart Added abstract widget class for decorated flags with sizing and child support.
packages/world_flags/lib/src/ui/flags/basic_flag.dart Refactored to extend DecoratedFlagWidget, added sizing and child support, deprecated foregroundWidget.
packages/world_flags/lib/src/ui/flags/ellipse_flag.dart
.../moon_flag.dart
.../multi_element_flag.dart
.../rectangle_flag.dart
.../star_flag.dart
.../triangle_flag.dart
Updated constructor parameter from foregroundWidget to child and passed to superclass.
packages/world_flags/lib/src/ui/iso_flag.dart Added generic IsoFlag widget for displaying ISO-standardized item flags.
packages/world_flags/lib/src/ui/painters/custom/shahada_painter.dart Updated to use alternative Afghanistan flag properties.
packages/world_flags/lib/src/ui/painters/multi_element_painter.dart Added coverage ignore comment to overridden method.
packages/world_flags/lib/world_flags.dart Exported new flag maps and extensions; introduced new/renamed flag maps for constructed languages and exceptions.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Picker (CountryPicker/LanguagePicker/CurrencyPicker)
  participant BasicPickerFlagsExtension
  participant FlagsMap
  participant PlatformLocale

  User->>Picker: Instantiate (optionally with flagsMap or adaptiveFlags)
  Picker->>BasicPickerFlagsExtension: adaptFlags(itemsMap, ...optional)
  BasicPickerFlagsExtension->>PlatformLocale: Get locale country (if not provided)
  BasicPickerFlagsExtension->>FlagsMap: Map items to flags (using locale, fallbacks, or custom logic)
  BasicPickerFlagsExtension-->>Picker: Return adapted flagsMap
  Picker->>User: Render picker with flags (from flagsMap)
Loading
sequenceDiagram
  participant User
  participant CountryFlag
  participant IsoFlag
  participant FlagMap

  User->>CountryFlag: Construct (with country, map, ...options)
  CountryFlag->>IsoFlag: Forward parameters
  IsoFlag->>FlagMap: Lookup flag for country (main or alternative map)
  IsoFlag-->>CountryFlag: Render flag (or fallback)
  CountryFlag->>User: Display flag widget
Loading

Possibly related PRs

  • tsinis/sealed_world#269: Also modifies .vscode/sealed_world.code-workspace, focusing on workspace configuration and Dart Code Metrics tasks.
  • tsinis/sealed_world#285: Major refactor and version bump of world_flags, involving breaking changes and flag-related updates, closely related in scope to this PR.

Suggested labels

feature, refactor, documentation, dependencies

Suggested reviewers

  • github-actions
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch chore/world-flags-v2.5.0

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added dependencies Pull requests that update a dependency file enhancement New feature or request labels Jun 21, 2025
@tsinis tsinis requested a review from Copilot June 21, 2025 21:43
Copy link
codecov bot commented Jun 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.92%. Comparing base (1ccb539) to head (f03dd53).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main     #353      +/-   ##
===========================================
- Coverage   100.00%   99.92%   -0.08%     
===========================================
  Files           42       51       +9     
  Lines          600     1304     +704     
===========================================
+ Hits           600     1303     +703     
- Misses           0        1       +1     
Flag Coverage Δ
sealed_countries ?
world_countries 99.92% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces experimental adaptiveFlags constructors for language and currency pickers (which choose flags based on locale or provided country), adds the European Union 🇪🇺 flag and constructed language flags, and refactors flag widgets to unify around a new IsoFlag/DecoratedFlagWidget abstraction. It also bumps package versions, updates SDK constraints, and extends tests to cover the new adaptive behavior.

  • Add LanguagePicker.adaptiveFlags and CurrencyPicker.adaptiveFlags for context-aware flag mapping.
  • Introduce IsoFlag widget and DecoratedFlagWidget base class; refactor BasicFlag and its extensions to use a unified child parameter.
  • Supply EU and constructed language flag data and update corresponding maps; extend tests to validate adaptiveFlags.

Reviewed Changes

Copilot reviewed 43 out of 312 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/world_flags/pubspec.yaml Bump version to 2.5.0, update SDK and sealed_countries
packages/world_flags/lib/world_flags.dart Export new data and UI abstractions (iso_flag, extensions)
packages/world_flags/lib/src/data/other_iso_flags_map.dart Add EU and constructed language flag properties
packages/world_flags/lib/src/ui/decorated_flag_widget.dart New abstract DecoratedFlagWidget class
packages/world_flags/lib/src/ui/iso_flag.dart New IsoFlag widget implementation
packages/world_flags/lib/src/ui/flags/* Refactor flag widgets to accept child instead of deprecated properties
packages/world_countries/lib/src/widgets/language/language_picker.dart Add adaptiveFlags constructor, integrate flagsMap
packages/world_countries/lib/src/widgets/currency/currency_picker.dart Add adaptiveFlags constructor, integrate flagsMap
packages/world_countries/lib/src/widgets/pickers/basic_picker_state.dart Controller initialization logic
packages/world_countries/test/src/widgets/*_picker_test.dart Add coverage for adaptiveFlags behavior
packages/world_countries/pubspec.yaml Update SDK, add meta dependency
Comments suppressed due to low confidence (1)

packages/world_flags/lib/src/ui/decorated_flag_widget.dart:20

  • [nitpick] The doc block has duplicate - [child] entries and a minor typo ('to a flag'). Please remove the redundant bullet and correct the grammar for clarity.
  /// - [child]: A widget to display in the foreground of the flag.

Comment on lines 10 to +11
_controller =
widget.textController ??
widget.searchBar?.controller ??
TextEditingController();
widget.textController ?? widget.searchBar?.controller ?? _controller;
Copy link
Preview
Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

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

The fallback to _controller references itself before initialization, which may leave _controller null. Consider defaulting to a new TextEditingController() instead of using the uninitialized _controller.

Copilot uses AI. Check for mistakes.

Comment on lines +129 to +158
child: Builder(
builder: (bc) => Column(
mainAxisSize: MainAxisSize.min,
children: [
flagsMap[itemProperties.item]?.copyWith(height: 18) ??
CountryFlag.simplified(
itemProperties.item,
height: 18,
aspectRatio:
bc.flagTheme?.aspectRatio ??
FlagConstants.defaultAspectRatio,
decoration:
bc.flagTheme?.decoration ??
const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(UiConstants.point / 2),
),
),
),
Padding(
padding: const EdgeInsets.only(
right: UiConstants.point / 2,
),
child: Text(
itemProperties.item.idd.phoneCode(),
style: newContext.theme.textTheme.labelSmall,
style: bc.theme.textTheme.labelSmall,
),
),
),
],
],
),
Copy link
Preview
Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Nested Builder widgets inside the flag column introduce extra build contexts. You could simplify by reusing the existing context (or bc) to reduce widget complexity and improve performance.

Copilot uses AI. Check for mistakes.

Comment on lines 115 to +117
padding: const EdgeInsets.only(top: UiConstants.point),
child:
leading ??
leading ?? // TODO? Remove padding if `isDense`.
Copy link
Preview
Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

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

[nitpick] There's a TODO about removing padding when isDense. Consider implementing the conditional padding logic now or removing the TODO to clarify the intended behavior.

Copilot uses AI. Check for mistakes.

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's TODO?, not TODO or TODO!. Question mark means that it might be an option, but I'm not sure, as it might be a breaking change. I will take some time to think about it.

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: 8

🔭 Outside diff range comments (1)
packages/world_countries/lib/src/widgets/phone_code/phone_code_picker.dart (1)

71-111: Missing flagsMap handling in factory constructor.

The fromCountryPicker factory constructor doesn't pass the flagsMap property from the picker parameter, which could result in loss of custom flag mappings when using this factory method.

Add the missing flagsMap parameter:

  PhoneCodePicker.fromCountryPicker(CountryPicker picker, {super.key})
    : super(
        // ... other parameters ...
        spacing: picker.spacing,
        translation: picker.translation,
+       flagsMap: picker.flagsMap,
      );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38e0bfe and f03dd53.

⛔ Files ignored due to path filters (257)
  • packages/world_flags/test/goldens/decorated/abw.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/afg.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ago.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/aia.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ala.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/alb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/and.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/are.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/arg.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/arm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/asm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ata.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/atf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/atg.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/aus.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/aut.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/aze.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bdi.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bel.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ben.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bes.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bfa.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bgd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bgr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bhr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bhs.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bih.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/blm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/blr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/blz.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bmu.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bol.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bra.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/brb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/brn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/btn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bvt.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/bwa.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/caf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/can.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cck.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/che.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/chl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/chn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/civ.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cmr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cod.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cog.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cok.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/col.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/com.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cpv.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cri.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cub.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cuw.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cxr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cym.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cyp.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/cze.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/deu.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/dji.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/dma.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/dnk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/dom.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/dza.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ecu.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/egy.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/eri.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/esh.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/esp.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/est.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/eth.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/fin.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/fji.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/flk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/fra.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/fro.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/fsm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gab.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gbr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/geo.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ggy.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gha.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gib.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gin.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/glp.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gmb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gnb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gnq.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/grc.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/grd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/grl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gtm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/guf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/gum.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/guy.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/hkg.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/hmd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/hnd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/hrv.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/hti.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/hun.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/idn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/imn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ind.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/iot.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/irl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/irn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/irq.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/isl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/isr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ita.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/jam.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/jey.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/jor.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/jpn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/kaz.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ken.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/kgz.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/khm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/kir.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/kna.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/kor.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/kwt.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lao.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lbn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lbr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lby.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lca.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lie.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lka.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lso.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ltu.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lux.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/lva.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mac.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/maf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mar.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mco.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mda.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mdg.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mdv.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mex.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mhl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mkd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mli.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mlt.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mmr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mne.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mng.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mnp.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/moz.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mrt.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/msr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mtq.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mus.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mwi.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/mys.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/myt.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nam.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ncl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ner.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nfk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nga.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nic.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/niu.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nld.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nor.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/npl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nru.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/nzl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/omn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pak.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pan.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pcn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/per.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/phl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/plw.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/png.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pol.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pri.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/prk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/prt.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pry.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pse.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/pyf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/qat.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/reu.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/rou.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/rus.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/rwa.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sau.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sdn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sen.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sgp.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sgs.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/shn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sjm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/slb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sle.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/slv.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/smr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/som.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/spm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/srb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ssd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/stp.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sur.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/svk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/svn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/swe.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/swz.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/sxm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/syc.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/syr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tca.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tcd.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tgo.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tha.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tjk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tkl.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tkm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tls.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ton.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tto.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tun.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tur.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tuv.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/twn.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/tza.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/uga.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ukr.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/umi.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/unk.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ury.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/usa.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/uzb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/vat.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/vct.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/ven.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/vgb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/vir.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/vnm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/vut.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/wlf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/wsm.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/yem.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/zaf.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/zmb.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/decorated/zwe.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/full/epo.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/full/eur.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/full/ido.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/simplified/epo.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/simplified/eur.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/simplified/ido.png is excluded by !**/*.png
  • packages/world_flags/test/goldens/simplified/ile.png is excluded by !**/*.png
📒 Files selected for processing (43)
  • .vscode/sealed_world.code-workspace (0 hunks)
  • packages/analysis_options.yaml (1 hunks)
  • packages/world_countries/example/lib/routing/parser.dart (1 hunks)
  • packages/world_countries/example/pubspec.yaml (2 hunks)
  • packages/world_countries/lib/src/extensions/pickers/basic_picker_flags_extension.dart (1 hunks)
  • packages/world_countries/lib/src/helpers/typed_locale_delegate.dart (4 hunks)
  • packages/world_countries/lib/src/interfaces/basic_picker_interface.dart (3 hunks)
  • packages/world_countries/lib/src/theme/pickers_theme_data.dart (5 hunks)
  • packages/world_countries/lib/src/widgets/country/country_picker.dart (5 hunks)
  • packages/world_countries/lib/src/widgets/country/country_tile.dart (1 hunks)
  • packages/world_countries/lib/src/widgets/currency/currency_picker.dart (5 hunks)
  • packages/world_countries/lib/src/widgets/language/language_picker.dart (5 hunks)
  • packages/world_countries/lib/src/widgets/phone_code/phone_code_picker.dart (4 hunks)
  • packages/world_countries/lib/src/widgets/pickers/basic_picker.dart (3 hunks)
  • packages/world_countries/lib/src/widgets/pickers/basic_picker_state.dart (1 hunks)
  • packages/world_countries/pubspec.yaml (1 hunks)
  • packages/world_countries/test/src/helpers/typed_locale_delegate_test.dart (2 hunks)
  • packages/world_countries/test/src/widgets/currency/currency_picker_test.dart (1 hunks)
  • packages/world_countries/test/src/widgets/language/language_picker_test.dart (1 hunks)
  • packages/world_flags/example/lib/main.dart (2 hunks)
  • packages/world_flags/example/lib/settings_dialog.dart (1 hunks)
  • packages/world_flags/example/pubspec.yaml (1 hunks)
  • packages/world_flags/lib/src/collections/properties_map.dart (1 hunks)
  • packages/world_flags/lib/src/data/flags_map_part_2.data.dart (1 hunks)
  • packages/world_flags/lib/src/data/other_iso_flags_map.dart (1 hunks)
  • packages/world_flags/lib/src/helpers/extensions/basic_flag_extension_copy_with.dart (3 hunks)
  • packages/world_flags/lib/src/helpers/extensions/country_flag_extension.dart (1 hunks)
  • packages/world_flags/lib/src/interfaces/decorated_flag_interface.dart (3 hunks)
  • packages/world_flags/lib/src/theme/flag_theme_data.dart (7 hunks)
  • packages/world_flags/lib/src/ui/country_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/decorated_flag_widget.dart (1 hunks)
  • packages/world_flags/lib/src/ui/flags/basic_flag.dart (6 hunks)
  • packages/world_flags/lib/src/ui/flags/ellipse_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/flags/moon_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/flags/multi_element_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/flags/rectangle_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/flags/star_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/flags/triangle_flag.dart (2 hunks)
  • packages/world_flags/lib/src/ui/iso_flag.dart (1 hunks)
  • packages/world_flags/lib/src/ui/painters/custom/shahada_painter.dart (2 hunks)
  • packages/world_flags/lib/src/ui/painters/multi_element_painter.dart (1 hunks)
  • packages/world_flags/lib/world_flags.dart (6 hunks)
  • packages/world_flags/pubspec.yaml (2 hunks)
💤 Files with no reviewable changes (1)
  • .vscode/sealed_world.code-workspace
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Verify world_countries / ⏳ Verify world_countries Package
  • GitHub Check: Verify world_flags / ⏳ Verify world_flags Package
🔇 Additional comments (90)
packages/world_countries/pubspec.yaml (2)

27-27: Bump SDK constraint.
The Dart SDK constraint is updated to ^3.8.1, aligning with related packages.


32-32: Add meta package dependency.
The meta package is required for the new @mustBeConst annotations; version matches the Flutter SDK.

packages/world_flags/example/pubspec.yaml (2)

4-4: Version bump to 2.5.0.
Updating the example to version 2.5.0 aligns with the main package changes.


9-9: Update SDK environment constraint.
The Dart SDK constraint is updated to ^3.8.1, ensuring consistency with the rest of the workspace.

packages/world_countries/example/pubspec.yaml (2)

9-9: Update SDK environment constraint.
Aligning the example app's Dart SDK constraint to ^3.8.1 matches the main package updates.


25-25: Upgrade build_runner.
Bumping build_runner to ^2.5.2 ensures compatibility with the updated build tooling.

packages/world_flags/lib/src/ui/painters/multi_element_painter.dart (1)

60-60: LGTM - Appropriate coverage exclusion for abstract method.

The coverage ignore comment is correctly applied to the @override annotation of an abstract method that returns null, which should not be counted in coverage metrics.

packages/analysis_options.yaml (1)

68-68: LGTM - Reasonable stylistic linting decision.

Explicitly disabling the avoid-continue rule is a valid stylistic choice. This aligns with the removal of inline ignore comments for continue statements elsewhere in the codebase.

packages/world_countries/example/lib/routing/parser.dart (1)

56-56: LGTM - Consistent with updated linting policy.

Removing the inline ignore comment aligns with the global disabling of the avoid-continue rule in analysis_options.yaml. The logic remains unchanged and correct.

packages/world_flags/pubspec.yaml (3)

1-1: LGTM - Appropriate version bump for new features.

The minor version bump to 2.5.0 correctly reflects the addition of new adaptive flags functionality described in the PR objectives.


26-26: LGTM - Dependency update supports new features.

The sealed_countries package update from ^2.3.0 to ^2.4.0 likely provides the enhanced country data needed for the new adaptive flags functionality.


21-21: Verify Dart SDK version availability.

The Dart SDK constraint was updated to ^3.8.1. Please ensure this version exists and is stable.

What is the latest stable version of Dart SDK as of June 2025?
packages/world_flags/lib/src/ui/flags/star_flag.dart (1)

24-24: LGTM - Parameter standardization with migration consideration.

The addition of the child parameter and updated documentation aligns with the broader refactoring mentioned in the AI summary to standardize foreground widget parameters across flag components. The coexistence of both foregroundWidget and child parameters suggests a thoughtful migration approach.

Also applies to: 37-37

packages/world_flags/lib/src/ui/painters/custom/shahada_painter.dart (2)

5-5: LGTM: Import migration aligns with refactoring goals.

The import change from flags_map_part_2.data.dart to alternative_flags_map.data.dart is consistent with the PR's infrastructure refactoring to support adaptive flag mapping.


23-25: LGTM: Property migration for Afghanistan flag.

The change from flagAfgProperties.aspectRatio to flagAfgPropertiesAlt.aspectRatio correctly migrates from deprecated properties to the new alternative flag properties, affecting only the Afghanistan flag while preserving the Saudi Arabia flag behavior.

packages/world_flags/lib/src/ui/flags/rectangle_flag.dart (1)

24-24: LGTM! Good backward-compatible API transition.

The documentation and constructor parameter addition for child aligns with the broader refactoring to standardize foreground widget parameter names across flag widgets. Maintaining both foregroundWidget and child parameters ensures backward compatibility during the transition.

Also applies to: 37-37

packages/world_flags/lib/src/data/flags_map_part_2.data.dart (1)

838-838: LGTM! Proper deprecation with clear migration path.

The deprecation annotation correctly guides users to the alternative flagAfgPropertiesAlt and follows Dart deprecation conventions.

packages/world_flags/lib/src/helpers/extensions/country_flag_extension.dart (1)

1-9: LGTM! Useful convenience extension.

The extension provides a clean semantic accessor to the underlying WorldCountry item from a CountryFlag instance. The implementation is simple and the documentation is clear.

packages/world_flags/lib/src/ui/flags/moon_flag.dart (1)

24-24: LGTM! Consistent with the API standardization effort.

The documentation and constructor parameter updates follow the same pattern as other flag widgets, maintaining consistency across the codebase while preserving backward compatibility.

Also applies to: 37-37

packages/world_countries/lib/src/widgets/pickers/basic_picker_state.dart (1)

11-11: LGTM! Good optimization to avoid unnecessary object creation.

The change prevents creating a new TextEditingController when the existing _controller (already initialized at field declaration) can be reused. This is a minor performance improvement with cleaner logic.

packages/world_countries/test/src/helpers/typed_locale_delegate_test.dart (2)

11-11: LGTM: Import addition is appropriate.

The new import for widget_tester_extension.dart is correctly added to support the new widget tests.


128-136: LGTM: Comprehensive widget tests added.

The new widget tests properly verify the behavior of TypedLocaleDelegate.of and TypedLocaleDelegate.maybeOf when no delegate is present in the widget tree. Both tests follow consistent patterns and validate the expected null return values.

packages/world_flags/lib/src/ui/flags/multi_element_flag.dart (2)

24-24: LGTM: Documentation correctly updated.

The parameter documentation has been properly updated from foregroundWidget to child, aligning with the interface standardization.


37-37: LGTM: Constructor parameter addition is consistent.

The addition of super.child maintains backward compatibility while supporting the new standardized parameter naming across flag widgets.

packages/world_flags/lib/src/ui/flags/ellipse_flag.dart (2)

24-24: LGTM: Consistent documentation update.

The documentation change from foregroundWidget to child is consistent with the interface standardization across flag widgets.


37-37: LGTM: Consistent constructor update.

The addition of super.child follows the same pattern as other flag widgets in this refactoring, maintaining consistency across the codebase.

packages/world_flags/example/lib/settings_dialog.dart (2)

75-76: LGTM: Improved image fitting approach.

Replacing the scale parameter with explicit fit: BoxFit.fitHeight provides better control over how the background flag image is displayed, ensuring consistent visual presentation.


79-85: LGTM: Enhanced aspect ratio control.

The addition of the AspectRatio wrapper with prioritized aspect ratio logic (notifier → flag properties → default) provides better control over flag display dimensions. This change aligns well with the broader flag widget improvements in the PR.

packages/world_flags/lib/src/ui/flags/triangle_flag.dart (2)

24-24: LGTM: Consistent parameter documentation.

The documentation update maintains consistency with the interface standardization across all flag widgets in this refactoring.


37-37: LGTM: Consistent constructor parameter addition.

The addition of super.child completes the consistent interface standardization pattern across all flag widget classes in this PR.

packages/world_countries/lib/src/widgets/pickers/basic_picker.dart (1)

123-123: LGTM: Well-implemented flagsMap support.

The flagsMap parameter is properly integrated into the BasicPicker class with:

  • Sensible default (empty map)
  • Correct typing Map<T, BasicFlag>
  • Proper inclusion in copyWith method
  • Appropriate @OverRide annotation

Also applies to: 142-143, 533-533

packages/world_countries/lib/src/interfaces/basic_picker_interface.dart (1)

2-2: LGTM: Comprehensive interface extension for flag mapping.

The interface properly supports the new flagsMap functionality with:

  • Appropriate imports added
  • Excellent documentation explaining usage and recommendations
  • Sensible default value

Note: The type Map<IsoTranslated, BasicFlag> here vs Map<T, BasicFlag> in BasicPicker is acceptable due to type variance rules.

Also applies to: 34-34, 72-80

packages/world_flags/lib/src/interfaces/decorated_flag_interface.dart (1)

2-2: LGTM: Well-designed interface extension for flag dimensions and child widgets.

The interface enhancement properly adds:

  • Required Widget import for child parameter
  • Comprehensive documentation for new properties
  • Consistent parameter handling in constructor
  • Clear field definitions with appropriate nullability

Also applies to: 18-22, 24-32, 55-66

packages/world_countries/lib/src/widgets/country/country_picker.dart (1)

63-63: LGTM: Proper integration of flagsMap functionality.

The CountryPicker correctly implements flagsMap support with:

  • Clear documentation for the new parameter
  • Proper passing to parent constructor
  • Appropriate usage in defaultBuilder with null-safe access
  • Different heights for dense (16) vs normal (18) tiles
  • Complete integration in copyWith method

Also applies to: 105-105, 126-126, 134-134, 204-204, 249-249

packages/world_flags/lib/src/helpers/extensions/basic_flag_extension_copy_with.dart (1)

31-36: LGTM: Excellent backward-compatible API evolution.

The copyWith extension properly handles the transition from foregroundWidget to child with:

  • Clear documentation for new parameters
  • Appropriate deprecation annotation
  • Smart fallback logic: child ?? foregroundWidget ?? this.child
  • Proper integration of height and width parameters

The fallback chain ensures backward compatibility while encouraging migration to the new API.

Also applies to: 46-46, 49-51, 66-67, 69-69

packages/world_countries/lib/src/theme/pickers_theme_data.dart (2)

3-3: LGTM! Import addition aligns with new functionality.

The import of world_flags package is correctly added to support the new BasicFlag type used in the flagsMap property.


56-56: Well-implemented flagsMap integration.

The flagsMap property is properly integrated throughout the class:

  • Initialized with efficient const empty map default
  • Correctly added to constructor parameters
  • Properly handled in copyWith method
  • Declared as final field with appropriate type

The implementation follows Flutter theming patterns and maintains backward compatibility.

Also applies to: 102-102, 131-131, 218-219

packages/world_flags/lib/src/ui/decorated_flag_widget.dart (1)

35-40: Excellent input validation with clear assertions.

The constructor assertions properly validate that aspectRatio, height, and width are positive values when provided, with clear error messages. This helps catch invalid configurations early.

packages/world_flags/example/lib/main.dart (3)

35-44: Excellent demonstration of new flag mapping capabilities.

The static _items map effectively showcases the new adaptive flag functionality by combining:

  • Custom flags for specific countries (AFG)
  • Simplified flag mappings
  • Currency flags (EUR)
  • Language flags

This provides a comprehensive example of the new flag mapping system.


77-78: Proper integration of new IsoFlag widget.

The transition from CountryFlag.simplified to IsoFlag with the entire _items map demonstrates the new generic flag rendering approach effectively.


80-82: Smart conditional logic for mixed item types.

The onTap logic correctly handles the fact that _items now contains mixed types (not just WorldCountry instances), appropriately restricting the settings dialog to only full flags that are WorldCountry instances.

packages/world_countries/lib/src/widgets/phone_code/phone_code_picker.dart (3)

62-62: LGTM! Consistent parameter integration.

The flagsMap parameter is correctly added to the main constructor, maintaining consistency with the parent class signature.


129-159: Excellent flag resolution logic with proper fallback.

The defaultBuilder method correctly implements the flag resolution pattern:

  1. First attempts to use custom flag from flagsMap
  2. Falls back to CountryFlag.simplified with proper theming
  3. Maintains existing styling and layout

The copyWith method on the custom flag ensures consistent sizing.


228-228: Complete flagsMap integration in copyWith method.

The flagsMap parameter is properly added to both the copyWith method signature and implementation, ensuring flag mappings are preserved during widget updates.

Also applies to: 273-273

packages/world_flags/lib/src/theme/flag_theme_data.dart (3)

25-25: Well-integrated child property addition.

The new child property is properly integrated:

  • Clear documentation explaining its purpose as a foreground widget
  • Correctly added to constructor parameters
  • Properly declared as final field with @OverRide annotation

This enhances the theming capabilities for flag widgets with foreground content.

Also applies to: 33-33, 59-60


52-52: Appropriate @OverRide annotations added.

The @override annotations for height and width properties correctly indicate these are interface implementations, improving code clarity and IDE support.

Also applies to: 56-56


86-86: Complete integration across all class methods.

The child property is consistently handled across all relevant methods:

  • copyWith: Proper null-aware assignment
  • toString: Conditional inclusion in string representation
  • operator ==: Included in equality comparison
  • hashCode: Added to hash calculation

This ensures the property behaves correctly in all contexts.

Also applies to: 95-95, 103-103, 113-114, 126-127, 137-138

packages/world_flags/lib/src/data/other_iso_flags_map.dart (6)

10-88: Complex nested structure is well-implemented but could benefit from validation.

The European Union flag definition with 12 stars arranged in a circle is correctly implemented using nested ElementsProperties. The positioning offsets and size factors appear accurate for the circular arrangement.


90-108: Esperanto flag implementation looks accurate.

The green background with white square canton containing a green star matches the official Esperanto flag design. The proportions and positioning are appropriate.


110-130: Ido flag design correctly represents the language symbol.

The blue background with white triangle and star elements accurately represents the Ido language flag. The geometric relationships and angles are properly defined.


132-154: Interlingue flag uses appropriate geometric elements.

The yellow background with black ellipse and horizontal line correctly represents the Interlingue flag design. The nested structure maintains proper proportions.


156-167: Interlingua flag diagonal design is well-structured.

The diagonal blue-red background with rotated white star accurately represents the Interlingua flag. The 45-degree rotation is correctly applied.


169-197: Volapük flag canton design is properly implemented.

The purple background with yellow canton containing the Volapük symbol (ellipse with horizontal line) is correctly structured using nested elements.

packages/world_countries/test/src/widgets/currency/currency_picker_test.dart (6)

112-140: Well-structured test for locale override functionality.

The test properly validates that localeCountry parameter overrides platform locale. The flag finder predicates correctly verify the expected Greenlandic flag is displayed instead of the Danish flag.


142-168: Platform locale fallback test includes proper cleanup.

Good use of addTearDown for cleaning up test state. The test correctly simulates platform locale changes and verifies the expected flag adaptation.


170-194: Custom flagsMap override test is comprehensive.

This test validates that explicitly provided flags in flagsMap take precedence over adaptive logic, which is important for customization scenarios.


196-213: Default EUR flag test validates fallback behavior.

The test correctly verifies that Euro currency displays the EU flag when no other mapping is available, demonstrating the default flags functionality.


215-235: Flag mapper customization test shows proper widget composition.

The test validates that flagMapper can wrap or modify flags while preserving the underlying flag widget, using a proper key-based verification approach.


237-269: Modal bottom sheet test ensures complete integration.

This integration test validates that adaptive flags work correctly in the modal presentation context, covering a real-world usage scenario.

packages/world_countries/test/src/widgets/language/language_picker_test.dart (6)

139-164: Locale override test properly adapted for language context.

The test correctly uses German language with Austrian locale override, validating that the Austrian flag is displayed instead of the German flag. Good use of language-country relationships.


166-189: Platform locale simulation handled correctly.

The test properly simulates Austrian German locale and verifies adaptive flag selection. The cleanup using addTearDown is appropriate.


191-215: Custom flag override test validates precedence.

This test ensures that explicitly provided flags in flagsMap take precedence over adaptive logic, which is crucial for customization scenarios.


217-240: Constructed language fallback test is excellent.

This test validates the unique language picker feature of supporting constructed languages like Esperanto that don't have associated countries. This is an important edge case that's well covered.


242-262: Flag mapper test validates customization capability.

The test properly verifies that flagMapper can customize flag widgets while preserving functionality, using appropriate key-based verification.


264-298: Modal integration test ensures complete functionality.

This comprehensive integration test validates that adaptive flags work correctly in modal presentation, covering real-world usage scenarios.

packages/world_flags/lib/src/ui/iso_flag.dart (4)

28-59: Generic widget design is well-architected.

The generic constraints are appropriate, and the constructor parameters provide comprehensive customization options. The alternative map precedence design allows for flexible flag overrides.


75-84: Flag resolution logic is clean and correct.

The basicFlag getter correctly prioritizes alternative map over main map using null-aware operators. The debug label implementation provides meaningful identification.


86-187: Comprehensive diagnostics implementation enhances debugging.

The extensive debugFillProperties implementation provides detailed information about widget state, flag availability, and map contents. This will be very helpful for developers debugging flag display issues.


189-203: Build method handles edge cases properly.

The build method correctly handles null flag cases with appropriate fallbacks (orElse widget or SizedBox.shrink()). The use of copyWith preserves all customization parameters.

packages/world_flags/lib/world_flags.dart (4)

11-11: New exports are appropriate for enhanced functionality.

The added exports for other_iso_flags_map.dart, country_flag_extension.dart, decorated_flag_widget.dart, and iso_flag.dart properly expose the new flag data and UI components introduced in this PR.

Also applies to: 67-67, 72-72, 85-85, 93-93


144-156: Map renaming improves clarity of purpose.

Renaming smallSimplifiedFlagsMap to uniqueSimplifiedFlagsMap better describes its contents (excluding countries with alternative representations). The documentation clearly explains the exclusions.


530-545: New smallSimplifiedFlagsMap maintains comprehensive coverage.

The restructured map includes the exceptions (Afghanistan and French Guiana) along with all unique flags, providing a complete simplified flags collection. The spread operator usage is clean.


560-576: Language flags map is a valuable addition.

The new smallSimplifiedLanguageFlagsMap provides proper support for constructed languages, addressing a gap in flag coverage. The flag types are appropriate for each language's design.

packages/world_countries/lib/src/widgets/language/language_picker.dart (3)

3-3: LGTM: Import additions support new adaptive flags functionality.

The new imports are necessary for the experimental constructor and extension method integration.

Also applies to: 6-6


61-61: LGTM: Consistent flagsMap parameter integration.

The flagsMap parameter is properly added to the constructor, copyWith method, and implementation with correct typing and handling.

Also applies to: 245-245, 290-290


173-173: LGTM: Proper flag integration in defaultBuilder.

The flag lookup and integration into the LanguageTile is correctly implemented and will gracefully handle missing flag mappings.

packages/world_countries/lib/src/helpers/typed_locale_delegate.dart (2)

53-61: LGTM: Appropriate use of @mustBeConst annotations.

The compile-time constant enforcement for translation cache parameters and configuration will improve performance and prevent accidental runtime construction.

Also applies to: 91-98


239-240: LGTM: Clean direct access method.

The of method provides a clear API for direct TypedLocale access with appropriate documentation about potential exceptions.

packages/world_countries/lib/src/extensions/pickers/basic_picker_flags_extension.dart (4)

8-14: LGTM: Well-structured extension with proper constraints.

The extension design with type constraints and internal annotation is appropriate. The static flag map combination provides comprehensive coverage.


16-49: LGTM: Sound adaptive flag mapping algorithm.

The priority-based flag selection logic is well-designed:

  1. Preserves explicitly provided flags
  2. Uses locale-appropriate flags when available
  3. Falls back gracefully for edge cases

The algorithm correctly handles various scenarios while maintaining user control through custom flags.


51-59: LGTM: Robust platform locale detection.

The country code validation and safe conversion approach properly handles edge cases and invalid locales from the platform.


61-71: LGTM: Appropriate default flag styling.

The default mapper provides consistent styling suitable for picker UI elements. The rounded border decoration and standard sizing work well for list contexts.

packages/world_flags/lib/src/ui/flags/basic_flag.dart (4)

23-23: LGTM: Good architectural refactoring with backwards compatibility.

The change to extend DecoratedFlagWidget improves code organization. The deprecation handling for foregroundWidget with fallback to child maintains backwards compatibility while encouraging migration to the new API.

Also applies to: 41-57


77-79: LGTM: Proper deprecation with backwards compatibility.

The deprecated getter correctly delegates to the new child property, maintaining API compatibility during the transition period.


200-227: LGTM: Improved build method with proper sizing control.

The SizedBox wrapper provides explicit size control while maintaining theme fallbacks. The comprehensive fallback chain for child widgets preserves backwards compatibility and provides flexible customization options.


100-101: LGTM: Updated debug properties reflect new architecture.

The debug properties correctly include the new sizing and child parameters with appropriate fallback descriptions.

Also applies to: 169-171

packages/world_countries/lib/src/widgets/currency/currency_picker.dart (3)

64-153: LGTM: Consistent adaptive flags implementation.

The constructor follows the established pattern from LanguagePicker with currency-specific documentation and examples. Using defaultFlagsMap as the default provides sensible defaults for common currencies like Euro.


155-157: LGTM: Sensible default flag mapping for Euro currency.

Mapping EUR to the European Union flag is appropriate given Euro's multinational nature. The StarFlag implementation correctly represents the EU flag design.


61-61: LGTM: Consistent parameter integration throughout the class.

The flagsMap parameter is properly integrated in the constructor, copyWith method, and defaultBuilder with correct typing and implementation.

Also applies to: 173-173, 246-246, 291-291

packages/world_flags/lib/src/ui/country_flag.dart (1)

26-89: Well-executed refactoring to extend generic base class.

The refactoring successfully simplifies CountryFlag by delegating core functionality to the generic IsoFlag base class. This approach eliminates code duplication and aligns with the new flag widget architecture, following SOLID principles.

10000
@@ -114,7 +114,7 @@ class CountryTile extends ListItemTile<WorldCountry> {
leading: Padding(
padding: const EdgeInsets.only(top: UiConstants.point),
child:
leading ??
leading ?? // TODO? Remove padding if `isDense`.
Copy link
@coderabbitai coderabbitai bot Jun 21, 2025

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Implement conditional padding for dense tiles.
Rather than leaving a TODO, update the Padding widget to use EdgeInsets.zero when dense == true to maintain consistent spacing.

Apply this diff:

Padding(
-  padding: const EdgeInsets.only(top: UiConstants.point),
+  padding: dense == true
+      ? EdgeInsets.zero
+      : const EdgeInsets.only(top: UiConstants.point),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
leading ?? // TODO? Remove padding if `isDense`.
Padding(
padding: dense == true
? EdgeInsets.zero
: const EdgeInsets.only(top: UiConstants.point),
child: leading ?? // TODO? Remove padding if `isDense`.
)
🤖 Prompt for AI Agents
In packages/world_countries/lib/src/widgets/country/country_tile.dart at line
117, the Padding widget currently does not adjust for dense tiles. Modify the
padding to use EdgeInsets.zero when the dense property is true, otherwise keep
the existing padding. This ensures consistent spacing by conditionally applying
zero padding for dense tiles.

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's TODO?, not TODO or TODO!. Question mark means that it might be an option, but I'm not sure, as it might be a breaking change. I will take some time to think about it.

Copy link

Choose a reason for hiding this comment

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

@tsinis, thank you for clarifying the intentional use of TODO? to indicate uncertainty! That's a thoughtful convention that communicates the level of confidence in potential changes.

You're absolutely right to be cautious about this particular change since modifying padding behavior could indeed be a breaking change for existing applications that depend on the current visual layout. Taking time to evaluate the impact on backward compatibility is the right approach.

I appreciate you explaining the semantic difference between TODO?, TODO, and TODO! in your codebase - it's a useful way to categorize the urgency and certainty of potential improvements.


✏️ Learnings added
Learnt from: tsinis
PR: tsinis/sealed_world#353
File: packages/world_countries/lib/src/widgets/country/country_tile.dart:117-117
Timestamp: 2025-06-21T22:02:51.862Z
Learning: In tsinis's codebase, `TODO?` indicates uncertainty about whether a change should be implemented (often due to potential breaking changes), while `TODO` or `TODO!` indicate more definitive action items. The question mark is used as a semantic indicator of the developer's confidence level in the proposed change.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +20 to +25
/// - [child]: A widget to display in the foreground of the flag.
/// - [width]: The width of the flag. If `null`, the width from the flag theme
/// is used.
/// - [height]: The height of the flag. If `null`, the height from the flag
/// theme is used.
/// - [child]: A widget to display in the foreground of the flag.
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix duplicate parameter documentation.

The child parameter is documented twice in the constructor documentation (lines 20 and 25). Remove the duplicate.

  /// - [aspectRatio]: The aspect ratio of the flag.
  /// - [decoration]: The decoration to paint behind the flag.  
  /// - [decorationPosition]: The position of the decoration.
  /// - [padding]: The padding around the flag.
- /// - [child]: A widget to display in the foreground of the flag.
  /// - [width]: The width of the flag. If `null`, the width from the flag theme
  ///  is used.
  /// - [height]: The height of the flag. If `null`, the height from the flag
  ///  theme is used.
  /// - [child]: A widget to display in the foreground of the flag.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// - [child]: A widget to display in the foreground of the flag.
/// - [width]: The width of the flag. If `null`, the width from the flag theme
/// is used.
/// - [height]: The height of the flag. If `null`, the height from the flag
/// theme is used.
/// - [child]: A widget to display in the foreground of the flag.
/// - [aspectRatio]: The aspect ratio of the flag.
/// - [decoration]: The decoration to paint behind the flag.
/// - [decorationPosition]: The position of the decoration.
/// - [padding]: The padding around the flag.
/// - [width]: The width of the flag. If `null`, the width from the flag theme
/// is used.
/// - [height]: The height of the flag. If `null`, the height from the flag
/// theme is used.
/// - [child]: A widget to display in the foreground of the flag.
🤖 Prompt for AI Agents
In packages/world_flags/lib/src/ui/decorated_flag_widget.dart between lines 20
and 25, the constructor documentation has the `child` parameter documented
twice. Remove the duplicate `child` parameter documentation to keep the comments
clear and concise.

Comment on lines +64 to +157
/// A factory constructor that creates a [LanguagePicker] with a pre-computed
/// map of flags based on the device's locale or a provided [localeCountry].
///
/// Unlike the default constructor which uses a manually built [flagsMap],
/// this constructor automatically computes the most relevant flag for each
/// language. It prioritizes the user's geopolitical context to provide a more
/// intuitive experience, saving you from complex manual mapping.
///
/// For example, if the user's device is set to Austria (`AT`), the German
/// language (`de`) will be displayed with the Austrian flag 🇦🇹. For all
/// other users, it will show the flag of Germany 🇩🇪.
///
/// This is achieved by first checking the provided [localeCountry]. If it's
/// `null`, it inspects the user's preferred locales from the platform. The
/// first locale with a valid country code is then used as the context. Flags
/// provided in the initial [flagsMap] are respected and will not be
/// overridden by this logic.
@experimental
LanguagePicker.adaptiveFlags({
Iterable<NaturalLanguage> languages = NaturalLanguage.list,
super.addAutomaticKeepAlives,
super.addRepaintBoundaries,
super.addSemanticIndexes,
super.cacheExtent,
super.caseSensitiveSearch,
super.chosen,
super.clipBehavior,
super.crossAxisAlignment,
super.direction,
super.disabled,
super.dragStartBehavior,
super.emptyStatePlaceholder,
super.itemBuilder,
super.key,
super.keyboardDismissBehavior,
super.mainAxisAlignment,
super.mainAxisSize,
super.onSelect,
super.padding,
super.physics,
super.primary,
super.restorationId,
super.reverse,
super.scrollController,
super.searchBar,
super.searchBarPadding,
super.searchIn,
super.onSearchResultsBuilder,
super.separator,
super.showClearButton,
super.showSearchBar,
super.shrinkWrap,
super.sort,
super.startWithSearch,
super.textBaseline,
super.textDirection,
super.verticalDirection,
super.spacing,
super.translation,
@mustBeConst Map<NaturalLanguage, BasicFlag> flagsMap = const {},

/// The country to use as the locale reference for flag selection and
/// mapping. If provided, this country will be used to determine the default
/// flag for languages that are associated with a specific country context.
/// If `null`, the picker will attempt to infer the locale country from the
/// current context. For example if device's country is Austria (`AT`), the
/// picker will use the Austrian 🇦🇹 flag for the German language (`DE`),
/// but if device's country is France (`FR`), the picker will use the flag
/// of Germany 🇩🇪 for the German language (`DE`). To modify the default
/// behavior of the flag mapping, please use [flagsMap] parameter, or the
/// `flagMapper` function to customize how flags are displayed for each
/// language.
WorldCountry? localeCountry,

/// An optional custom function to map or transform a [BasicFlag] for a
/// given language. This function allows you to override the default flag
/// appearance or logic for each language and its associated countries. If
/// not provided, a default flag mapping will be used (similar to country
/// picker).
BasicFlag Function(
BasicFlag flag,
NaturalLanguage language,
List<WorldCountry>? countries,
)?
flagMapper,
}) : super(
languages,
flagsMap: flagsMap.adaptFlags(
languages.byCountryMap(),
fallbacksMap: smallSimplifiedLanguageFlagsMap,
flagsMapper: flagMapper,
localeCountry: localeCountry,
),
);
Copy link
@coderabbitai coderabbitai bot Jun 21, 2025

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider parameter organization for the extensive constructor.

While the adaptive flags constructor provides excellent functionality and documentation, the 75+ parameter list is quite extensive. Consider if parameter grouping or a builder pattern could improve maintainability, though this does follow the established Flutter widget pattern.

The locale-aware flag selection logic is well-documented and the delegation to the extension method provides good separation of concerns.

🤖 Prompt for AI Agents
In packages/world_countries/lib/src/widgets/language/language_picker.dart
between lines 64 and 157, the LanguagePicker.adaptiveFlags constructor has an
extensive parameter list exceeding 75 parameters, which can reduce
maintainability and readability. To fix this, consider grouping related
parameters into smaller data classes or using a builder pattern to organize the
parameters more logically while preserving the existing Flutter widget
constructor style. This will improve code clarity and ease future modifications
without changing the current functionality.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Not true dude, TextField especially together with InputDecoration inside or Scaffold or ThemeData itself are examples of very huge classes in Flutter SDK.

Copy link

Choose a reason for hiding this comment

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

@tsinis You're absolutely right! I apologize for that assessment. Flutter SDK indeed follows the pattern of extensive parameter lists in constructors - TextField, InputDecoration, Scaffold, and ThemeData are perfect examples of this being the established Flutter convention. The LanguagePicker.adaptiveFlags constructor with its comprehensive parameter list actually follows standard Flutter widget design patterns rather than being a maintainability concern.

Thanks for the correction!

   (\   /)
  ( ._.)  
 o_(")(") 
*Learning noted!*

✏️ Learnings added
Learnt from: tsinis
PR: tsinis/sealed_world#353
File: packages/world_countries/lib/src/widgets/language/language_picker.dart:64-157
Timestamp: 2025-06-21T22:06:05.683Z
Learning: Flutter widgets commonly have extensive parameter lists (50+ parameters is normal) as seen in TextField, InputDecoration, Scaffold, and ThemeData. This is the established Flutter convention for providing comprehensive configuration options through constructor parameters rather than using builder patterns or parameter grouping.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +219 to +226
static TypedLocale? maybeOf(BuildContext context) {
try {
return Localizations.of<TypedLocale?>(context, TypedLocale);
// ignore: avoid_catches_without_on_clauses, for DevEx, there is `of`.
} catch (_) {
return null;
}
}
Copy link
@coderabbitai coderabbitai bot Jun 21, 2025

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider more specific exception handling.

While the broad catch clause provides good developer experience, consider catching more specific exceptions (like FlutterError or AssertionError) to avoid masking unexpected errors.

The try-catch approach for safe access is well-designed and documented.

    try {
      return Localizations.of<TypedLocale?>(context, TypedLocale);
-      // ignore: avoid_catches_without_on_clauses, for DevEx, there is `of`.
-    } catch (_) {
+    } on FlutterError catch (_) {
+      return null;
+    } on AssertionError catch (_) {
      return null;
    }
🤖 Prompt for AI Agents
In packages/world_countries/lib/src/helpers/typed_locale_delegate.dart around
lines 219 to 226, the current catch clause is too broad and may mask unexpected
errors. Refine the exception handling by catching specific exceptions such as
FlutterError and AssertionError instead of a general catch-all. This will
maintain safe access while preventing unintended error suppression.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Kek, what is the benefit of such an approach? You are always returning null, so there is no benefit; it's an anti-pattern in fact.

Copy link

Choose a reason for hiding this comment

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

@tsinis You're absolutely right, and I apologize for the poor suggestion.

The current implementation with the broad catch (_) clause is actually the correct pattern for a maybeOf method. The entire purpose of a "maybe" accessor is to safely return null for any failure, regardless of the specific exception type.

Catching specific exceptions that all do the same thing (return null) would be unnecessary complexity and indeed an anti-pattern, as you said. The current approach is clean and follows the established convention for safe accessors.

The method name maybeOf clearly communicates the intent, and there's already a separate of method available when you want exceptions to be thrown normally. The broad catch is intentional and appropriate here.

Thank you for the correction!


✏️ Learnings added
Learnt from: tsinis
PR: tsinis/sealed_world#353
File: packages/world_countries/lib/src/helpers/typed_locale_delegate.dart:219-226
Timestamp: 2025-06-21T22:06:59.733Z
Learning: For "maybe" accessor methods (like `maybeOf`), using a broad catch clause that returns null is the correct pattern, not an anti-pattern. These methods are designed to safely return null for any failure, so catching specific exceptions that all have identical handling (return null) adds unnecessary complexity without benefit.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

super.key,
}) : _map = smallSimplifiedFlagsMap,
_alternativeMap = alternativeMap;
}) : super(country, smallSimplifiedFlagsMap); // TODO! Check asserts.
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

⚠️ Potential issue

Address the TODO comment before merging.

The TODO comment indicates that assertions need to be checked. Please verify and implement any necessary parameter validations or remove the TODO if no assertions are needed.

Would you like me to analyze what assertions might be needed based on the parent class implementation?

🤖 Prompt for AI Agents
In packages/world_flags/lib/src/ui/country_flag.dart at line 52, the TODO
comment indicates that assertions related to the constructor parameters need to
be reviewed. Check the parent class constructor to identify any required
parameter validations or constraints, then add appropriate assert statements to
validate inputs such as ensuring non-null or valid country codes. If no
assertions are necessary, remove the TODO comment to clean up the code.

Comment on lines +15 to +16
/// options such as height, width, aspect ratio, decoration (and it's position),
/// padding, and a child widget.
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix the grammatical error in the documentation.

The documentation uses "it's" (contraction of "it is") instead of "its" (possessive form).

-/// options such as height, width, aspect ratio, decoration (and it's position),
+/// options such as height, width, aspect ratio, decoration (and its position),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// options such as height, width, aspect ratio, decoration (and it's position),
/// padding, and a child widget.
/// options such as height, width, aspect ratio, decoration (and its position),
/// padding, and a child widget.
🤖 Prompt for AI Agents
In packages/world_flags/lib/src/ui/country_flag.dart around lines 15 to 16, fix
the grammatical error in the documentation comment by replacing "it's" with the
correct possessive form "its" to properly describe the position of the
decoration.

Comment on lines +56 to +57
/// - [item]: The country for which the flag is to be displayed.
/// - [_map]: A map of flags for ISO countries.
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update documentation to use public-facing parameter names.

The documentation refers to internal superclass parameters (item and _map) instead of the actual parameter names that users would use when calling this constructor.

-  /// - [item]: The country for which the flag is to be displayed.
-  /// - [_map]: A map of flags for ISO countries.
+  /// - [country]: The country for which the flag is to be displayed.
+  /// - [flagsMap]: A map of flags for ISO countries.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// - [item]: The country for which the flag is to be displayed.
/// - [_map]: A map of flags for ISO countries.
/// - [country]: The country for which the flag is to be displayed.
/// - [flagsMap]: A map of flags for ISO countries.
🤖 Prompt for AI Agents
In packages/world_flags/lib/src/ui/country_flag.dart around lines 56 to 57,
update the documentation comments to replace the internal superclass parameter
names `item` and `_map` with the actual public-facing parameter names used in
this constructor, ensuring the docs accurately reflect what users see and use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0