flutter_screen_lock
flutter_screen_lock copied to clipboard
update customizedButton
customizedButton in confirmed mode
@naoki0719 please check this commit
Thanks for the new feature! Please fix the README.md as well. Version 9.1.0 is better for some compatibility.
this is a breaking API change and according to semantic versioning it shouldnt be a patch or a minor but a major. 9.0.0 -> 10.0.0 This is important because dart pub will automatically upgrade patch and minors, so if they break the API, users will have errors e.g. in their continous integration or when pulling a fresh repository.
Additionally to the above, it should already be possible to to what you wish for without this PR. For example:
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.