flutter_screen_lock icon indicating copy to clipboard operation
flutter_screen_lock copied to clipboard

update customizedButton

Open beheobong opened this issue 1 year ago • 4 comments

customizedButton in confirmed mode

beheobong avatar Sep 04 '23 07:09 beheobong

@naoki0719 please check this commit

beheobong avatar Sep 04 '23 07:09 beheobong

Thanks for the new feature! Please fix the README.md as well. Version 9.1.0 is better for some compatibility.

naoki0719 avatar Sep 05 '23 00:09 naoki0719

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.

clragon avatar Nov 06 '23 14:11 clragon

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.

clragon avatar Nov 06 '23 14:11 clragon