Skip to content

Commit b83bd17

Browse files
feat: replace deprecated property
1 parent 765b5a3 commit b83bd17

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/src/form_builder.dart

+13-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class FormBuilder extends StatefulWidget {
99
/// will rebuild.
1010
final VoidCallback? onChanged;
1111

12-
/// {@macro flutter.widgets.navigator.onPopInvoked}
12+
/// DEPRECATED: Use [onPopInvokedWithResult] instead.
13+
final void Function(bool)? onPopInvoked;
14+
15+
/// {@macro flutter.widgets.navigator.onPopInvokedWithResult}
1316
///
1417
/// {@tool dartpad}
1518
/// This sample demonstrates how to use this parameter to show a confirmation
@@ -22,9 +25,8 @@ class FormBuilder extends StatefulWidget {
2225
///
2326
/// * [canPop], which also comes from [PopScope] and is often used in
2427
/// conjunction with this parameter.
25-
/// * [PopScope.onPopInvoked], which is what [Form] delegates to internally.ther widget that provides a way to intercept the
26-
/// back button.
27-
final void Function(bool)? onPopInvoked;
28+
/// * [PopScope.onPopInvokedWithResult], which is what [Form] delegates to internally.
29+
final PopInvokedWithResultCallback<Object?>? onPopInvokedWithResult;
2830

2931
/// {@macro flutter.widgets.PopScope.canPop}
3032
///
@@ -102,7 +104,12 @@ class FormBuilder extends StatefulWidget {
102104
required this.child,
103105
this.onChanged,
104106
this.autovalidateMode,
107+
@Deprecated(
108+
'Use onPopInvokedWithResult instead. '
109+
'This feature was deprecated after v3.22.0-12.0.pre.',
110+
)
105111
this.onPopInvoked,
112+
this.onPopInvokedWithResult,
106113
this.initialValue = const <String, dynamic>{},
107114
this.skipDisabled = false,
108115
this.enabled = true,
@@ -345,6 +352,8 @@ class FormBuilderState extends State<FormBuilder> {
345352
return Form(
346353
key: _formKey,
347354
autovalidateMode: widget.autovalidateMode,
355+
onPopInvokedWithResult: widget.onPopInvokedWithResult,
356+
// ignore: deprecated_member_use
348357
onPopInvoked: widget.onPopInvoked,
349358
canPop: widget.canPop,
350359
// `onChanged` is called during setInternalFieldValue else will be called early

0 commit comments

Comments
 (0)