-
Notifications
You must be signed in to change notification settings - Fork 48
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
update customizedButton #99
base: master
Are you sure you want to change the base?
Conversation
@naoki0719 please check this commit |
Thanks for the new feature! |
this is a breaking API change and according to semantic versioning it shouldnt be a patch or a minor but a major. |
Widget? customizedButtonChild, | ||
VoidCallback? customizedButtonTap, | ||
Widget Function(bool confirmed)? customizedButtonChild, | ||
Function(bool confirmed, InputController controller)? customizedButtonTap, |
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.
This is missing a return type for the Function.
Function(bool confirmed, InputController controller)? customizedButtonTap, | |
void Function(bool confirmed, InputController controller)? customizedButtonTap, |
@@ -107,7 +107,8 @@ class ScreenLock extends StatefulWidget { | |||
final ValueChanged<int>? onMaxRetries; | |||
|
|||
/// Tapped for left side lower button. | |||
final VoidCallback? customizedButtonTap; | |||
final Function(bool confirmed, InputController controller)? |
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.
final Function(bool confirmed, InputController controller)? | |
final void Function(bool confirmed, InputController controller)? |
Additionally to the above, it should already be possible to to what you wish for without this PR. onPressed: () async {
bool confirmed = false;
final controller = InputController();
final subscription = controller.confirmed
.listen((event) => confirmed = event);
await screenLock(
context: context,
correctString: '1234',
customizedButtonChild: StreamBuilder<bool>(
stream: controller.confirmed,
builder: (context, snapshot) => Icon(
confirmed
? Icons.restart_alt_rounded
: Icons.arrow_back,
),
),
customizedButtonTap: () async {
if (confirmed) {
controller.unsetConfirmed();
} else {
Navigator.of(context).pop();
}
},
onOpened: () async => await localAuth(context),
);
subscription.cancel();
}, So I dont think it is necessary to add it to the package itself. |
customizedButton in confirmed mode