feat: Add onTapAlwaysCalled in TextFormField (#140089)
Add onTapAlwaysCalled in TextFormField *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
This commit is contained in:
@@ -134,6 +134,7 @@ class TextFormField extends FormField<String> {
|
||||
int? maxLength,
|
||||
this.onChanged,
|
||||
GestureTapCallback? onTap,
|
||||
bool onTapAlwaysCalled = false,
|
||||
TapRegionCallback? onTapOutside,
|
||||
VoidCallback? onEditingComplete,
|
||||
ValueChanged<String>? onFieldSubmitted,
|
||||
@@ -231,6 +232,7 @@ class TextFormField extends FormField<String> {
|
||||
maxLength: maxLength,
|
||||
onChanged: onChangedHandler,
|
||||
onTap: onTap,
|
||||
onTapAlwaysCalled: onTapAlwaysCalled,
|
||||
onTapOutside: onTapOutside,
|
||||
onEditingComplete: onEditingComplete,
|
||||
onSubmitted: onFieldSubmitted,
|
||||
|
||||
@@ -1512,6 +1512,26 @@ void main() {
|
||||
expect(textFieldWidget.dragStartBehavior, dragStartBehavior);
|
||||
});
|
||||
|
||||
testWidgetsWithLeakTracking('Passes onTapAlwaysCalled to onTapAlwaysCalled TextField', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Material(
|
||||
child: Center(
|
||||
child: TextFormField(
|
||||
onTapAlwaysCalled: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final Finder textFieldFinder = find.byType(TextField);
|
||||
expect(textFieldFinder, findsOneWidget);
|
||||
|
||||
final TextField textFieldWidget = tester.widget(textFieldFinder);
|
||||
expect(textFieldWidget.onTapAlwaysCalled, isTrue);
|
||||
});
|
||||
|
||||
testWidgetsWithLeakTracking('Error color for cursor while validating', (WidgetTester tester) async {
|
||||
const Color themeErrorColor = Color(0xff111111);
|
||||
const Color errorStyleColor = Color(0xff777777);
|
||||
|
||||
Reference in New Issue
Block a user