Skip to content

Conversation

@Crucialjun
Copy link
Contributor

@Crucialjun Crucialjun commented Dec 27, 2025

…tFormField

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • [*] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement

Related Issues

Closes #

Changes Made

  • Add Scaffold messenger key to the AdaptiveApp
  • Add OnTapOutside functionality to the AdaptiveTextFormField
  • Add Autofill hints to the AdaptiveTextFormField

Testing

Automated Tests ⚠️ REQUIRED

  • I have added unit/widget tests for my changes
  • [*] All new and existing tests pass locally (flutter test)
  • [*] Code analysis passes with no errors (flutter analyze)
  • [*] Code formatting is correct (dart format)
  • Test coverage is adequate (>80% for new code)

Manual Testing

  • [*] iOS 26+ tested
  • iOS <26 tested
  • [*] Android tested
  • Web tested (if applicable)
  • Tested in both light and dark mode
  • Tested with different screen sizes
  • Tested with accessibility features (large fonts, screen readers, etc.)

Screenshots/Videos

Before

After

Checklist

  • [*] My code follows the style guidelines of this project
  • [*] I have performed a self-review of my own code
  • [*] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [*] My changes generate no new warnings
  • [*] I have checked that my code does not introduce any accessibility issues
  • I have updated the CHANGELOG.md file (if applicable)
  • I have updated version number in pubspec.yaml (if applicable)
  • I have added examples to the example app (if adding new widgets)

Breaking Changes

Additional Notes

Demo Code

// Example usage

Copilot AI review requested due to automatic review settings December 27, 2025 16:47
Copy link
Contributor

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 adds two new features to the adaptive platform UI library: a scaffoldMessengerKey property to AdaptiveApp and an onTapOutside callback to AdaptiveTextFormField. These additions enable developers to programmatically show snackbars and handle tap events outside text fields across both Material and Cupertino platforms.

Key changes:

  • Added onTapOutside callback parameter to AdaptiveTextFormField for handling taps outside the text field
  • Added scaffoldMessengerKey parameter to AdaptiveApp to enable programmatic control of snackbars and other messenger features
  • Updated dependency versions in example app's pubspec.lock

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
lib/src/widgets/adaptive_text_form_field.dart Adds onTapOutside parameter and implements it for both Cupertino and Material variants of the text form field
lib/src/widgets/adaptive_app.dart Adds scaffoldMessengerKey parameter to both standard and router constructors, passing it to MaterialApp
example/pubspec.lock Updates package versions (meta 1.16.0→1.17.0, test_api 0.7.6→0.7.7, and bumps local package version to 0.1.100)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 178 to 182
onTapOutside: onTapOutside != null
? (event) {
onTapOutside!();
}
: null,
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The new onTapOutside functionality is not covered by any tests. The test file test/adaptive_text_field_test.dart has comprehensive test coverage for AdaptiveTextFormField including validation, callbacks, and other features. Consider adding test cases to verify that onTapOutside is correctly called when a tap occurs outside the text field on both Material and Cupertino platforms.

Copilot uses AI. Check for mistakes.
scrollBehavior: config.scrollBehavior,
highContrastTheme: config.highContrastTheme,
highContrastDarkTheme: config.highContrastDarkTheme,
scaffoldMessengerKey: scaffoldMessengerKey,
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The new scaffoldMessengerKey parameter is not covered by any tests. The test file test/adaptive_app_test.dart has comprehensive test coverage for AdaptiveApp including various properties and callbacks. Consider adding test cases to verify that the scaffoldMessengerKey is correctly passed to the underlying MaterialApp and can be used to show snackbars or other messenger features.

Copilot uses AI. Check for mistakes.
Comment on lines 139 to 140
// Called when a tap is detected outside the text field.
final VoidCallback? onTapOutside;
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The onTapOutside parameter is defined as VoidCallback? but Flutter's native TextFormField and CupertinoTextField expect TapRegionCallback? which has the signature void Function(PointerDownEvent event). This creates an API inconsistency where the wrapper ignores the event parameter that the underlying widgets provide. Consider changing the type to TapRegionCallback? to maintain consistency with Flutter's API and allow consumers to access the event information if needed.

Suggested change
// Called when a tap is detected outside the text field.
final VoidCallback? onTapOutside;
/// Called when a tap is detected outside the text field.
final TapRegionCallback? onTapOutside;

Copilot uses AI. Check for mistakes.
@berkaycatak
Copy link
Owner

Hello, thanks for the change! <3

@berkaycatak berkaycatak merged commit caf261a into berkaycatak:main Jan 4, 2026
2 checks passed
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.

2 participants