Skip to content

Commit

Permalink
feat: replace deprecated property
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Aug 9, 2024
1 parent 765b5a3 commit b83bd17
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/src/form_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ class FormBuilder extends StatefulWidget {
/// will rebuild.
final VoidCallback? onChanged;

/// {@macro flutter.widgets.navigator.onPopInvoked}
/// DEPRECATED: Use [onPopInvokedWithResult] instead.
final void Function(bool)? onPopInvoked;

/// {@macro flutter.widgets.navigator.onPopInvokedWithResult}
///
/// {@tool dartpad}
/// This sample demonstrates how to use this parameter to show a confirmation
Expand All @@ -22,9 +25,8 @@ class FormBuilder extends StatefulWidget {
///
/// * [canPop], which also comes from [PopScope] and is often used in
/// conjunction with this parameter.
/// * [PopScope.onPopInvoked], which is what [Form] delegates to internally.ther widget that provides a way to intercept the
/// back button.
final void Function(bool)? onPopInvoked;
/// * [PopScope.onPopInvokedWithResult], which is what [Form] delegates to internally.
final PopInvokedWithResultCallback<Object?>? onPopInvokedWithResult;

/// {@macro flutter.widgets.PopScope.canPop}
///
Expand Down Expand Up @@ -102,7 +104,12 @@ class FormBuilder extends StatefulWidget {
required this.child,
this.onChanged,
this.autovalidateMode,
@Deprecated(
'Use onPopInvokedWithResult instead. '
'This feature was deprecated after v3.22.0-12.0.pre.',
)
this.onPopInvoked,
this.onPopInvokedWithResult,
this.initialValue = const <String, dynamic>{},
this.skipDisabled = false,
this.enabled = true,
Expand Down Expand Up @@ -345,6 +352,8 @@ class FormBuilderState extends State<FormBuilder> {
return Form(
key: _formKey,
autovalidateMode: widget.autovalidateMode,
onPopInvokedWithResult: widget.onPopInvokedWithResult,
// ignore: deprecated_member_use
onPopInvoked: widget.onPopInvoked,
canPop: widget.canPop,
// `onChanged` is called during setInternalFieldValue else will be called early
Expand Down

0 comments on commit b83bd17

Please sign in to comment.