-
Notifications
You must be signed in to change notification settings - Fork 26
Add ScaffoldMessenger Key and OnTapOutside functionality to the #59
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
Conversation
There was a problem hiding this 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
onTapOutsidecallback parameter toAdaptiveTextFormFieldfor handling taps outside the text field - Added
scaffoldMessengerKeyparameter toAdaptiveAppto 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.
| onTapOutside: onTapOutside != null | ||
| ? (event) { | ||
| onTapOutside!(); | ||
| } | ||
| : null, |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
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.
| scrollBehavior: config.scrollBehavior, | ||
| highContrastTheme: config.highContrastTheme, | ||
| highContrastDarkTheme: config.highContrastDarkTheme, | ||
| scaffoldMessengerKey: scaffoldMessengerKey, |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
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.
| // Called when a tap is detected outside the text field. | ||
| final VoidCallback? onTapOutside; |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
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.
| // 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; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Hello, thanks for the change! <3 |
…tFormField
Description
Type of Change
Related Issues
Closes #
Changes Made
Testing
Automated Tests⚠️ REQUIRED
flutter test)flutter analyze)dart format)Manual Testing
Screenshots/Videos
Before
After
Checklist
Breaking Changes
Additional Notes
Demo Code
// Example usage