Skip to content

feat: enhance input decoration with new border options#449

Merged
divyanshub024 merged 3 commits intodevfrom
dv/input-border
Feb 19, 2026
Merged

feat: enhance input decoration with new border options#449
divyanshub024 merged 3 commits intodevfrom
dv/input-border

Conversation

@divyanshub024
Copy link
Member

@divyanshub024 divyanshub024 commented Feb 19, 2026

Description

This PR enhances StacInputDecoration by introducing support for customizable input borders across different states.

A new StacInputBorder model and parser have been added, enabling configuration of:

  • errorBorder
  • focusedBorder
  • focusedErrorBorder
  • disabledBorder
  • enabledBorder
  • Default border

These updates bring Stac’s input decoration capabilities closer to Flutter’s native InputDecoration, allowing more granular styling directly from JSON.

The changes include:

  • Added StacInputBorder support in stac_core
  • Implemented StacInputBorderParser in stac
  • Updated StacInputDecoration and StacInputDecorationTheme parsers to handle new border properties
  • Regenerated relevant .g.dart files
  • Updated examples and dependencies where required

## 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
  • Build configuration change
  • Documentation
  • Chore

Summary by CodeRabbit

  • New Features

    • Input fields now support configurable borders for error, focused, disabled and normal states.
  • Refactor

    • Example screen pattern helpers added to improve internal screen handling.
  • Chores

    • Updated dependencies: webview_flutter, json_annotation, stac_core.
    • Restructured build execution for dependency-ordered builds.

- Added `StacInputBorder` parser to handle various input border styles, including error, focused, and enabled states.
- Updated `StacInputDecoration` to include new properties for custom borders.
- Enhanced `StacInputDecorationTheme` and `StacInputDecoration` parsers to support the new border options.
- Updated related documentation and examples to reflect the new features.
@divyanshub024
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

✅ Actions performed

Review triggered.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

📝 Walkthrough

Walkthrough

Adds StacInputBorder parsing and wires border fields through InputDecoration models and parsers; extends StacInputDecoration with six border properties; updates melos build steps and some dependencies; and adds pattern-matching helpers to an example Freezed type.

Changes

Cohort / File(s) Summary
StacInputBorder Parser & export
packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart, packages/stac/lib/src/parsers/foundation/foundation.dart
New StacInputBorderParser extension on StacInputBorder? with parse(BuildContext) mapping to Flutter InputBorder variants; exported from foundation parsers.
InputDecoration / Theme parsers
packages/stac/lib/src/parsers/foundation/decoration/stac_input_decoration_parser.dart, packages/stac/lib/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart
Added parsing of errorBorder, focusedBorder, focusedErrorBorder, disabledBorder, enabledBorder, and border using the new parse extension; made suffixIcon parsing nullable-safe.
Core model and generated serialization
packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart, packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart
Extended StacInputDecoration with six new StacInputBorder? fields and updated JSON (de)serialization to include those fields.
Build script
melos.yaml
Replaced a single build_runner command with ordered melos exec steps targeting packages in dependency order (stac_core → stac → counter_example → stac_gallery → stac_webview).
Gallery example (Freezed)
examples/stac_gallery/lib/app/example/example_screen.freezed.dart
Added ExampleScreenPatterns extension with maybeMap, map, mapOrNull, maybeWhen, when, and whenOrNull pattern helpers for ExampleScreen.
Dependency bumps
packages/stac_webview/pubspec.yaml
Updated dependency versions: webview_flutter ^4.13.0 → ^4.13.1, json_annotation ^4.9.0 → ^4.10.0, stac_core ^1.0.0 → ^1.3.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Potatomonsta

Poem

🐰 I hopped through code with ears held high,
Borders parsed beneath the sky.
Six new fields, a tidy song,
Parsers hum and patterns throng.
Tap the gallery — the rabbit's spry! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding border-related properties to input decoration across multiple states (errorBorder, focusedBorder, etc.) and implementing corresponding parsing logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dv/input-border

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

❤️ Share

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

- Bumped versions for dependencies in counter_example, movie_app, and stac_gallery to latest releases.
- Updated SHA256 checksums for the following packages: characters, matcher, material_color_utilities, and test_api.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart`:
- Around line 21-25: The current parser returns OutlineInputBorder with a
fallback of BorderRadius.zero when border.borderRadius is null, which diverges
from Flutter's default of BorderRadius.all(Radius.circular(4.0)); update the
fallback used in the OutlineInputBorder creation (the code that references
border.borderRadius?.parse) to use BorderRadius.all(Radius.circular(4.0)) when
border.borderRadius is absent so the parsed OutlineInputBorder matches Flutter's
default appearance.
- Around line 18-19: The case handling StacInputBorderType.underlineInputBorder
currently returns UnderlineInputBorder(borderSide: side) and ignores
StacInputBorder.borderRadius; update the mapping to pass the configured border
radius into UnderlineInputBorder via its borderRadius parameter (e.g.,
borderRadius: <converted StacInputBorder.borderRadius>), converting the STAC
model radius to the Flutter BorderRadius/BorderRadiusDirectional type as needed
and leaving it null to preserve UnderlineInputBorder's defaults when no radius
is specified. Ensure the change is made in the same switch branch that handles
StacInputBorderType.underlineInputBorder so the borderRadius is honored at
runtime.

- Updated the `UnderlineInputBorder` and `OutlineInputBorder` cases in the `StacInputBorderParser` to include customizable border radius settings.
- Default border radius values are now applied for better visual consistency in input decorations.
Copy link
Contributor

@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.

🧹 Nitpick comments (1)
packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart (1)

23-33: Add const to the BorderRadius fallback literals.

Both fallback values use only constant arguments and can be compile-time constants, avoiding a heap allocation on every parse() call.

♻️ Proposed fix
-          borderRadius:
-              border.borderRadius?.parse ??
-              BorderRadius.only(
-                topLeft: Radius.circular(4.0),
-                topRight: Radius.circular(4.0),
-              ),
+          borderRadius:
+              border.borderRadius?.parse ??
+              const BorderRadius.only(
+                topLeft: Radius.circular(4.0),
+                topRight: Radius.circular(4.0),
+              ),
-          borderRadius:
-              border.borderRadius?.parse ??
-              BorderRadius.all(Radius.circular(4.0)),
+          borderRadius:
+              border.borderRadius?.parse ??
+              const BorderRadius.all(Radius.circular(4.0)),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart`
around lines 23 - 33, Add compile-time constants for the fallback BorderRadius
literals to avoid allocations: make the fallback BorderRadius instances const
(e.g., change BorderRadius.all(Radius.circular(4.0)) to const
BorderRadius.all(const Radius.circular(4.0)) and similarly make the
BorderRadius.only(...) fallback const with const Radius.circular(4.0)). Update
the occurrences around the parse fallback (border.borderRadius?.parse) and the
StacInputBorderType.outlineInputBorder/other branch that return
BorderRadius.only/BorderRadius.all so the literals are prefixed with const.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@packages/stac/lib/src/parsers/foundation/borders/stac_input_border_parser.dart`:
- Around line 23-33: Add compile-time constants for the fallback BorderRadius
literals to avoid allocations: make the fallback BorderRadius instances const
(e.g., change BorderRadius.all(Radius.circular(4.0)) to const
BorderRadius.all(const Radius.circular(4.0)) and similarly make the
BorderRadius.only(...) fallback const with const Radius.circular(4.0)). Update
the occurrences around the parse fallback (border.borderRadius?.parse) and the
StacInputBorderType.outlineInputBorder/other branch that return
BorderRadius.only/BorderRadius.all so the literals are prefixed with const.

@divyanshub024 divyanshub024 merged commit 42607b9 into dev Feb 19, 2026
6 checks passed
@divyanshub024 divyanshub024 deleted the dv/input-border branch February 19, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments