-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[State Restoration] Restorable TimePickerDialog
widget, RestorableTimeOfDay
#80566
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
TimePickerDialog
widget, RestorableTimeOfDay
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.
LGTM
Object? toPrimitives() => <String, int>{ | ||
'minute': value.minute, | ||
'hour': value.hour, | ||
}; |
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.
We could eliminate the keys and just store this as:
Object? toPrimitives() => <String, int>{ | |
'minute': value.minute, | |
'hour': value.hour, | |
}; | |
Object? toPrimitives() => <int>[value.minute, value.hour]; |
... with a corresponding change in fromPrimitives.
@override | ||
String? get restorationId => widget.restorationId; | ||
|
||
@override | ||
void restoreState(RestorationBucket? oldBucket, bool initialRestore) { | ||
registerForRestoration(controller, 'text_editing_controller'); | ||
registerForRestoration(controllerHasBeenSet, 'has_controller_been_set'); | ||
} |
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.
nit: let's move these below the block of field declarations below.
Fixes #80564.
TimePickerDialog
and adding state restoration framework support.RestorableTimeOfDay
class that is helpful when used in tandem withTimePickerDialog
.Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.