Code Monkey home page Code Monkey logo

naoki0719 / flutter_screen_lock Goto Github PK

View Code? Open in Web Editor NEW
97.0 0.0 45.0 1.85 MB

Provides the ability to lock the screen on ios and android. Biometric authentication can be used in addition to passcode.

Home Page: https://pub.dev/packages/flutter_screen_lock

License: MIT License

Kotlin 0.11% Swift 1.60% Objective-C 0.04% Dart 53.00% Ruby 2.60% HTML 1.13% CMake 18.02% C++ 22.18% C 1.32%
screen-lock biometrics widget dart flutter-package flutter passcode unlock ui

flutter_screen_lock's Introduction

Flutter Screen Lock

This Flutter plugin provides an feature for screen lock. Enter your passcode to unlock the screen. You can also use biometric authentication as an option.

Landscape view

Features

  • By the length of the character count
  • You can change Cancel and Delete widget
  • Optimizes the UI for device size and orientation
  • You can disable cancellation
  • You can use biometrics (local_auth plugin)
  • Biometrics can be displayed on first launch
  • Unlocked callback
  • You can specify a mismatch event.
  • Limit the maximum number of retries

Usage

You can easily lock the screen with the following code.
To unlock, enter correctString.

Simple

If you give the same input as correctString, it will automatically close the screen.

import 'package:flutter_screen_lock/flutter_screen_lock.dart';

screenLock(
  context: context,
  correctString: '1234',
);

Block user

Provides a screen lock that cannot be cancelled.

import 'package:flutter_screen_lock/flutter_screen_lock.dart';

screenLock(
  context: context,
  correctString: '1234',
  canCancel: false,
);

Passcode creation

You can have users create a new passcode with confirmation

import 'package:flutter_screen_lock/flutter_screen_lock.dart';

screenLockCreate(
  context: context,
  onConfirmed: (value) => print(value), // store new passcode somewhere here
);

Control the creation state

import 'package:flutter_screen_lock/flutter_screen_lock.dart';

final inputController = InputController();

screenLockCreate(
  context: context,
  inputController: inputController,
);

// Somewhere else...
inputController.unsetConfirmed(); // reset first and confirm input

Use local_auth

Add the local_auth package to pubspec.yml.

It includes an example that calls biometrics as soon as screenLock is displayed in didOpened.

import 'package:flutter_screen_lock/flutter_screen_lock.dart';
import 'package:local_auth/local_auth.dart';
import 'package:flutter/material.dart';

Future<void> localAuth(BuildContext context) async {
  final localAuth = LocalAuthentication();
  final didAuthenticate = await localAuth.authenticateWithBiometrics(
      localizedReason: 'Please authenticate');
  if (didAuthenticate) {
    Navigator.pop(context);
  }
}

screenLock(
  context: context,
  correctString: '1234',
  customizedButtonChild: Icon(Icons.fingerprint),
  customizedButtonTap: () async => await localAuth(context),
  didOpened: () async => await localAuth(context),
);

Fully customize

You can customize every aspect of the screenlock. Here is an example:

import 'package:flutter/material.dart';
import 'package:flutter_screen_lock/flutter_screen_lock.dart';

screenLockCreate(
  context: context,
  title: const Text('change title'),
  confirmTitle: const Text('change confirm title'),
  onConfirmed: (value) => Navigator.of(context).pop(),
  config: const ScreenLockConfig(
    backgroundColor: Colors.deepOrange,
  ),
  secretsConfig: SecretsConfig(
    spacing: 15, // or spacingRatio
    padding: const EdgeInsets.all(40),
    secretConfig: SecretConfig(
      borderColor: Colors.amber,
      borderSize: 2.0,
      disabledColor: Colors.black,
      enabledColor: Colors.amber,
      height: 15,
      width: 15,
      build: (context,
              {required config, required enabled}) =>
          Container(
        decoration: BoxDecoration(
          shape: BoxShape.rectangle,
          color: enabled
              ? config.enabledColor
              : config.disabledColor,
          border: Border.all(
            width: config.borderSize,
            color: config.borderColor,
          ),
        ),
        padding: const EdgeInsets.all(10),
        width: config.width,
        height: config.height,
      ),
    ),
  ),
  keyPadConfig: KeyPadConfig(
    buttonConfig: StyledInputConfig(
      textStyle:
          StyledInputConfig.getDefaultTextStyle(context)
              .copyWith(
        color: Colors.orange,
        fontWeight: FontWeight.bold,
      ),
      buttonStyle: OutlinedButton.styleFrom(
        shape: const RoundedRectangleBorder(),
        backgroundColor: Colors.deepOrange,
      ),
    ),
    displayStrings: [
      '零',
      '壱',
      '弐',
      '参',
      '肆',
      '伍',
      '陸',
      '質',
      '捌',
      '玖'
    ],
  ),
  cancelButton: const Icon(Icons.close),
  deleteButton: const Icon(Icons.delete),
);

Version migration

8.x to 9 migration

  • Change screenLockConfig parameter to config
  • Change keyPadConfig parameter to config

7.x to 8 migration

  • Change all callback names from didSomething to onSomething
  • Change screenLock with confirm: true to screenLockCreate
  • Change ScreenLock with confirm: true to ScreenLock.create
  • Replace StyledInputConfig with KeyPadButtonConfig
  • Replace spacingRatio with fixed value spacing in Secrets

6.x to 7 migration

  • Requires dart >= 2.17 and Flutter 3.0
  • Replace InputButtonConfig with KeyPadConfig.
  • Change delayChild to delayBuilder.
    delayBuilder is no longer displayed in a new screen. Instead, it is now located above the Secrets.
  • Accept BuildContext in secretsBuilder.

5.x to 6 migration

  • ScreenLock does not use Navigator.pop internally anymore.
    The developer should now pop by themselves when desired.
    screenLock call will pop automatically if onUnlocked is null.

4.x to 5 migration

Import name has changed from:

import 'package:flutter_screen_lock/functions.dart';

to

import 'package:flutter_screen_lock/flutter_screen_lock.dart';

Apps that use this library

TimeKey

Support me!

Buy Me A Coffee

flutter_screen_lock's People

Contributors

clragon avatar dhaval-k-simformsolutions avatar naoki0719 avatar secarelupus avatar theachoem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_screen_lock's Issues

Widget is overflowed when the input button size=80

The default calculated input button size is quite small, I need to change it bigger, but I will get error: Widget overflow when the button size > 80 although there are still available space on the screen. I found the root cause was the hardcode padding=EdgeInsets.symmetric(horizontal: 50), I managed to fix it by a couple line of codes (see the images), could you help me to fix it?
Screen Shot 2022-01-11 at 08 05 44
Screen Shot 2022-01-11 at 08 06 33
?

[Feature Request] Auto set fingerprint vs face biometric icon or allow to customize biometric icon

First of all thanks for this awesome library.

I am working on one Flutter app which is using this library to show a lock screen on app launch. But now I came across one unique requirement that to customize biometric icon based on fingerprint vs face biometric support. So if I am running app on Android then It should show fingerprint biometric icon But if app is running on iOS X or later (face biometric supported) devices then it should show face icon.

image

As per my currently, We are not supporting this. But It would be nice if that gets supported in this library. I don't know much about library creation in Flutter. But If you would allow me to contribute then I think I can add this feature as well. Thanks.

Too many exports

The lib/flutter_screen_lock.dart file exports almost all files in the library.
The user of the library, however, doesnt really need all of these.

For example, all the different types of buttons dont need to be exported, since the user doesnt build their own keypad.
The buttons also have very generic names, so they could easily interfere with widgets that the user of the library has built themselves.

I assume, the exports could probably be reduced to this:

library flutter_screen_lock;

export 'src/configurations/input_button_config.dart';
export 'src/configurations/screen_lock_config.dart';
export 'src/configurations/secret_config.dart';
export 'src/configurations/secrets_config.dart';
export 'src/functions.dart';
export 'src/heading_title.dart';
export 'src/input_controller.dart';
export 'src/screen_lock.dart';

Support Delaying when max retries was exceeded

It's a very popular scenario when max retries is exceeded and user should be waiting, for example: 5min, before next retry. didMaxRetries is quite complex to handle that scenario. it's will be great if you can support that scenario out of the box, I appreciate that.

The password input panel responses slowly when input.

When I type quickly on the password input panel, it can not response timely. For example, I typed four number quickly, but only two were inputed, there were two types not being corresponded.
And when user inputs a familiar password, it's common to input quickly.
I suspect that Flutter set a least interval between gesture actions, but I can't find related doc or code.
Do you have any idea about that?

provide didCancelled callback

Currently, it is not possible to override the functionality of the cancelButton on the KeyPad.
The cancelButton always executes Navigator.pop(context).

This is undesirable when we are not using ScreenLock in its own Route.

When writing a Function to return a new PIN, and using the confirmation parameter,
I want to either return a new PIN or fail when the action was cancelled.

However, this is not possible.
And because there is no override for the cancelButton, we can neither stop our waiting when the user has cancelled nor wait for the screenLock to "close".

Can i lock the phone?

Can i create lock the phone app like when user turn on the screen and lock screen has to be showed?

retryDelay can be bypassed with back button

The screen which is shown during the retryDelay can easily be bypassed by simply pressing the back button on an android device.

This could be fixed by wrapping the delay route in a WillPop that denies the pop if the screenLock cannot be cancelled.

But it might be nicer to disable all keypad buttons and
show an appropriate message on screen, with a countdown:

Widget Function(BuildContext context, Duration delay) delayBuilder 
= const HeadingTitle(text: 'Input is locked for ${delay.seconds} seconds');

as a parameter of ScreenLock, instead of the current new screen with delayChild.
It would then also have to disable the input buttons during the delay.

User can bypass lockscreen with the Android back button

Using the Android back button, an user can bypass the lockscreen even when the lockscreen has canCancel: false.

Here's a sample code :

        context: context,
        digits: PASSCODE_DIGITS_NUMBER,
        title: Text(S.of(context).enterYourPinCode),
        deleteButton: const Icon(Icons.delete),
        customizedButtonChild: Icon(Icons.fingerprint),
        customizedButtonTap: () async {
          final localAuth = LocalAuthentication();
          bool didAuthenticate = await localAuth.authenticate(
              biometricOnly: true);
          if (didAuthenticate) {
            Navigator.pop(context);
          }
        },
        correctString: _passCode,
        screenLockConfig: ScreenLockConfig(
          backgroundColor: Colors.white,
        ),
        secretsConfig: SecretsConfig(
            secretConfig: SecretConfig(
                borderColor: Colors.black,
                disabledColor: Colors.black,
                enabledColor: Colors.amber)),
        didUnlocked: () {
          Navigator.pop(context);
        },
        canCancel: false
);

Customize the keyPadConfig of the confirm screen.

I am using your package well.
Thank you.

In confirmation:true I want to be able to customize the keyPadConfig of the confirmation screen.
I would like to have different keypads for the two screens of confirmation:true.

Thank you.

Replace MediaQuery size usage

Using MediaQuery.of(context).size plus a factor to define the sizes of widgets is undesirable in most situations.
There are quite a few problems with it:

  1. First, the size will always be dependent on the entire screen.
    the ScreenLock widget could be used inside of a nested Navigator or other confinement which does not take up the entire screen.
    In that case, the buttons and text would have incorret sizes.

  2. Second, no other widgets in flutter ever use this method to size themselves.
    All inbuilt widgets in flutter use the Physical Pixels as static values to size themselves.
    Those physical pixels will make sure that the widgets have the same physical size on all devices.
    This means, if you use MediaQuery to size your widgets, they will look different and strange next to the normal inbuilt flutter widgets.

  3. Lastly, those factor values start to look very bad on large screens (desktop) or very small devices,
    because of the way the factor works. An example of how this looks on a desktop screen is provided further down.

Therefore, we should not use MediaQuery and a factor to size our widgets.

mediaquery input button sizing on my desktop looks like this:
image

with static values (further down) it looks like this:
74335470

in the screenshots it should be obvious that the scaling fails on desktop.
notice how the "cancel" text is incredibly small.this is the effect of the second point above.
the spacing on the secrets is unreasonable as well.

Both the MediaQuery values and the static ones look fine on my own phone.

One simple solution is to replace all the values with static ones.

The above desktop screenshot uses:

48 for the button config text style
68 for the button default size
12 for the secret spacing

Those sizes look both okayish on my desktop and my phone.
More reasonable sizes might be something like 36, 68 and 12.
You probably want to adjust them, as I didn't verify the correct ratio.

Another solution, besides the simply static values,
is to use a LayoutBuilder widget plus breakpoints.
The layoutbuilder widget gives you the constraints that you are in.
This means, this would give you the correct sizes for your "screen", even when inside of a nested navigator or otherwise not a fullscreen.

Then, because factors are not desirable, we can use breakpoints that map to static values.
The material design specification talks about what breakpoints they use to decide the different layouts here.

There are packages that provide these breakpoints though I would not add a dependency when not necessary. Regardless, they show a nice example of how these breakpoints could be implemented.

The package uses MediaQuery in these places:

When testing these changes, I used the Windows build of the example folder.
It currently doesnt have a Windows part here in github, but you create it by:

  • enabling windows (or other OS) desktop support: flutter config --enable-windows-desktop (found under flutter config -h)
  • running flutter create example again in the folder above example
  • executing the windows build flutter run -d windows

I think it would make this package even better if one of those solutions was implemented and MediaQuery was removed.
I tried to be very detailed about my explanation why MediaQuery is a problem.
Please let me know if you have questions.

I will probably not make a pull request for this, because I would like you to decide on these important things.

"Reset" button needed

First of all, thank you for this awesome package!
This is a feature request.

In case when I`m setting pin code first time and miss clicked then I can not enter the same code one more time.
It is not a problem if I trying to change old pin code.
But if setting of pin code is mandatory on first run, I should unload app to make a new try.
It is not clear for many users.
So, I need to write much code to make it work my way. I guess, not only mine.

Thank you!

Unhandled Exception: A ValueNotifier<String> was used after being disposed

Hi
I'm observing the following issue with Android. As far as I remember there were no issue before.
This seems related to a bug you fixed recently.
I observe this on Android emulators 8.1 and 11.

I tried your versions 5.0.9 and 5.0.10, both have same issues.
This happens when the Lock Screen is dismissed after the code was entered.

Any idea about this ?
Thanks

E/flutter ( 6937): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: A ValueNotifier<String> was used after being disposed.
E/flutter ( 6937): Once you have called dispose() on a ValueNotifier<String>, it can no longer be used.
E/flutter ( 6937): #0      ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:114:9)
E/flutter ( 6937): #1      ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:120:6)
E/flutter ( 6937): #2      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:288:12)
E/flutter ( 6937): #3      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:412:5)
E/flutter ( 6937): #4      InputController.dispose (package:flutter_screen_lock/src/input_controller.dart:119:25)
E/flutter ( 6937): #5      _ScreenLockState.dispose.<anonymous closure> (package:flutter_screen_lock/src/screen_lock.dart:240:29)
E/flutter ( 6937): #6      new Future.microtask.<anonymous closure> (dart:async/future.dart:276:37)
E/flutter ( 6937): #7      _rootRun (dart:async/zone.dart:1418:47)
E/flutter ( 6937): #8      _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter ( 6937): #9      _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter ( 6937): #10     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/flutter ( 6937): #11     _rootRun (dart:async/zone.dart:1426:13)
E/flutter ( 6937): #12     _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter ( 6937): #13     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter ( 6937): #14     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/flutter ( 6937): #15     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter ( 6937): #16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

Add some extra functionality!

I want some extra features, like many app which uses lock screen contains options like lock app after 30 sec or 1 min when user doesn't interact with and after screen lock after particular time lock the app, so can we add this features in our package?

physical keyboard input support

It would be great if the package supported input via a physical keyboard.

I have already tested a rough implementation of this:

final FocusNode _focusNode = FocusNode();

bool _canInput = true;

void _blockInput() {
  _canInput = false;
  Timer(const Duration(milliseconds: 100), () => _canInput = true);
}

@override
void initState() {
  super.initState();
  _focusNode.requestFocus();
}

@override
void didChangeDependencies() {
  super.didChangeDependencies();
  FocusScope.of(context).autofocus(_focusNode);
}

@override
void dispose() {
  _focusNode.dispose();
  super.dispose();
}

@override
Widget build(BuildContext context) {
  return KeyboardListener(
    focusNode: _focusNode,
    onKeyEvent: (key) {
      if (!_canInput) {
        return;
      }
      if (widget.inputButtonConfig.inputStrings.contains(key.character)) {
        widget.inputState.addCharacter(key.character!);
        _blockInput();
      }
      if (key.logicalKey == LogicalKeyboardKey.backspace) {
        widget.inputState.removeCharacter();
        _blockInput();
      }
    },
    child: widget.child,
  );
}

It can be used as a widget wrapped around a keypad to enter a PIN code from the keyboard.
There are some issues with delays. KeyEvent can be triggered very fast.
Maybe only add delay on backspace? not sure.

I probably won't make a pull request. I don't want to change the structure of your project too much.
But I think this feature is a great addition.

How can I modify 'Title value'?

Hi.
I did choice flutter_screen_lock library on my project. Thank you for created this library.

I have one question. How can I modify 'Title value'?

I want to modify title value when my client did enter error password.
So I want to show error count in screenLock page.

But, I can't. I added errorCount in 'setStated()' when return 'didError.' But it didn't work.
How can I modify 'Title value'?


this is my code.

` void showScreenLock() {
screenLock(
context: context,
title: Column(
children: [
Text('잠금 비밀번호 4자리를 입력해주세요'),
Text(errorCount.toString() + '회 오류.')
],
),
footer: Text('안대!!!!'),
confirmTitle: Text('한번 더 입력해주세요.'),
correctString: '1234',
maxRetries: errorCount,
didError: _error,
// confirmation: true,
canCancel: true,
didConfirmed: (text) {
ComLogger().d('text = ' + text);
},
didUnlocked: isLogin);
}

_error(int count) {
setState(() {
context;
errorCount = count;
});
ComLogger().d('errorCount = ' + errorCount.toString());
}`

Fingerprint not working!

checkPassword() async{
    SharedPreferences _preferences = await SharedPreferences.getInstance();
    _password = _preferences.getString(_key);
    _isFingerprintEnabled = _preferences.getBool(_fingerprintKey);
    showLockScreen(
      context: context,
      title: "Enter vault password",
      digits: 5,
      correctString: _password,
      cancelText: "Close",
      showBiometricFirst: true,
      canCancel: false,
      onUnlocked: () => Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) => Home())),
      canBiometric: _isFingerprintEnabled,
      biometricAuthenticate: (context) async {
        final localAuth = LocalAuthentication();
        final didAuthenticate = await localAuth.authenticateWithBiometrics(
            localizedReason: 'Please authenticate');

        if (didAuthenticate) {
          return true;
        }

        return false;
      },
    );
  }

This is my code but fingerprint not working means after clicking on Fingerprint icon nothing is happening.

Cancel button is cut-off

Hello,

on iOS for iPhone SE and iPhoneX as well (real devices) the Cancel text is cut-off.

BC10A8CE-E298-4583-99C5-E2CD50DD58BF_4_5005_c

FYI I'm using the nullsafety version

Alternative layout for landscape on small devices

When displaying ScreenLock() on a small device - e.g. phone - in landscape, the entry buttons are too small to easily press.

Is it possible to have an alternative layout when in landscape that has the title & secrets on the left hand side, and the entry buttons on the right hand side, expanded to full height. See attached screenshots

current-landscape
suggested-landscape

Please add an option to remove blur effect

Hi.
Backdrop filter with blur effect is very laggy on some devices (I try on Huawei Y360 android 4.4), so, please add a bool parameter to remove the backdropfilter widget.

Styling delete and customized buttons

I'm trying to style the keypad to match an app I'm working on, but while the delete key follows the BorderSide(white) property, it seems to ignore the backgroundColor property. Is there a specific way to set the background color of the _buildLeftSideButton() and _buildRightSideButton() widgets?

  inputButtonConfig: InputButtonConfig(
      buttonStyle: OutlinedButton.styleFrom(
          backgroundColor: Colors.red,
          primary: Colors.black,
          side: BorderSide(color: Colors.white))

image

Facing Error running your example!! PlatformError & method was called on null!!

I wanted to use your package in my app and for that, I am trying to run the example and understand it. But most of the options provided in the button don't work and the error is as below. The buttons Change Style, Confirm Mode, Customize text, and Can't Cancel give out the method call was called on null. The buttons "Use local_auth" and "Open Biometric First" give out PlatformError. Can you check it once on your end as well? I have not edited any code of yours and am running the main.dart as it is in your example and has included the required packages too!! Please help me!

Change Style, Confirm Mode, Customize text, and Can't Cancel

E/flutter (28464): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
E/flutter (28464): Receiver: null
E/flutter (28464): Tried calling: call()
�[38;5;248mE/flutter (28464): #0      _LockScreenState._verifyCorrectString.<anonymous closure>�[39;49m
�[38;5;244mE/flutter (28464): #1      new Future.delayed.<anonymous closure>  (dart:async/future.dart:318:39)�[39;49m
�[38;5;244mE/flutter (28464): #2      _rootRun  (dart:async/zone.dart:1180:38)�[39;49m
�[38;5;244mE/flutter (28464): #3      _CustomZone.run  (dart:async/zone.dart:1077:19)�[39;49m
�[38;5;244mE/flutter (28464): #4      _CustomZone.runGuarded  (dart:async/zone.dart:979:7)�[39;49m
�[38;5;244mE/flutter (28464): #5      _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:1019:23)�[39;49m
�[38;5;244mE/flutter (28464): #6      _rootRun  (dart:async/zone.dart:1184:13)�[39;49m
�[38;5;244mE/flutter (28464): #7      _CustomZone.run  (dart:async/zone.dart:1077:19)�[39;49m
�[38;5;244mE/flutter (28464): #8      _CustomZone.bindCallback.<anonymous closure>  (dart:async/zone.dart:1003:23)�[39;49m
�[38;5;244mE/flutter (28464): #9      Timer._createTimer.<anonymous closure>  (dart:async-patch/timer_patch.dart:23:15)�[39;49m
�[38;5;244mE/flutter (28464): #10     _Timer._runTimers  (dart:isolate-patch/timer_impl.dart:398:19)�[39;49m
�[38;5;244mE/flutter (28464): #11     _Timer._handleMessage  (dart:isolate-patch/timer_impl.dart:429:5)�[39;49m
�[38;5;244mE/flutter (28464): #12     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:168:12)�[39;49m

Use local_auth and open biometric first

E/flutter (28464):
E/flutter (28464): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null)
�[38;5;244mE/flutter (28464): #0      StandardMethodCodec.decodeEnvelope�[39;49m
�[38;5;244mE/flutter (28464): #1      MethodChannel._invokeMethod�[39;49m
E/flutter (28464): <asynchronous suspension>
�[38;5;244mE/flutter (28464): #2      MethodChannel.invokeMethod�[39;49m
�[38;5;248mE/flutter (28464): #3      LocalAuthentication.authenticateWithBiometrics�[39;49m
�[38;5;248mE/flutter (28464): #4      _MyHomePageState.build.<anonymous closure>.<anonymous closure>�[39;49m
�[38;5;248mE/flutter (28464): #5      _LockScreenState.initState.<anonymous closure>�[39;49m
�[38;5;244mE/flutter (28464): #6      _rootRunUnary  (dart:async/zone.dart:1192:38)�[39;49m
�[38;5;244mE/flutter (28464): #7      _CustomZone.runUnary  (dart:async/zone.dart:1085:19)�[39;49m
�[38;5;244mE/flutter (28464): #8      _CustomZone.runUnaryGuarded  (dart:async/zone.dart:987:7)�[39;49m
�[38;5;244mE/flutter (28464): #9      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)�[39;49m
�[38;5;244mE/flutter (28464): #10     _DelayedData.perform  (dart:async/stream_impl.dart:594:14)�[39;49m
�[38;5;244mE/flutter (28464): #11     _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:710:11)�[39;49m
�[38;5;244mE/flutter (28464): #12     _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:670:7)�[39;49m
�[38;5;244mE/flutter (28464): #13     _rootRun  (dart:async/zone.dart:1180:38)�[39;49m
�[38;5;244mE/flutter (28464): #14     _CustomZone.run  (dart:async/zone.dart:1077:19)�[39;49m
�[38;5;244mE/flutter (28464): #15     _CustomZone.runGuarded  (dart:async/zone.dart:979:7)�[39;49m
�[38;5;244mE/flutter (28464): #16     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:1019:23)�[39;49m
�[38;5;244mE/flutter (28464): #17     _rootRun  (dart:async/zone.dart:1184:13)�[39;49m
�[38;5;244mE/flutter (28464): #18     _CustomZone.run  (dart:async/zone.dart:1077:19)�[39;49m
�[38;5;244mE/flutter (28464): #19     _CustomZone.runGuarded  (dart:async/zone.dart:979:7)�[39;49m
�[38;5;244mE/flutter (28464): #20     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:1019:23)�[39;49m
�[38;5;244mE/flutter (28464): #21     _microtaskLoop  (dart:async/schedule_microtask.dart:43:21)�[39;49m
�[38;5;244mE/flutter (28464): #22     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:52:5)�[39;49m
E/flutter (28464):

Can I show this Lock screen at Bottom of Application?

First of all, thank you for this awesome library. But i want to know that can i change the alignment of this screen? like when we show this screen it starts from top of the screen so on the end much more space remaining empty. So, my question is that how to start the screen from bottom of my application so if any space remain it remains at top not at bottom.

onUnlocked strange behavior

Why when onUnlocked is triggered in the window of checking, and not installing the Pin code, and you continue to enter numbers, the input is visually continued.
i.e., as if the plugin sees that the pin has come up, it starts executing the code for onUnlocked. But the pin entry screen leaves it open and it's as if you can enter the pin again. But you manage to enter a couple of digits, and then the code is executed for sure.

Buttons do not use inputButtonConfig

When specifying an InputButtonConfig,
neither the DeleteButton, the CancelButton nor the HiddenButton use that configuration.
Only the main number buttons use it.

This seems counter-intuitive.
To apply the same button configuration to the delete and cancel button, I have specify them myself, fully.
There is no way of applying the input config to the hidden buttons, because they are not reachable or definable through the screenLock call.

I would be very happy if the input button configuration that is passed to the screenLock call was applied to all the buttons.

Customize the keyboard

Hello, how can we customize the keyboard, can we swap the position of keys or add a new button?

Thanks!

provide didOpened callback

the ScreenLock widget doesnt provide a didOpened function,
but the screenLock function does.

It would be nice if the ScreenLock widget would also provide such a function.
The callback could be called in the initState function.
It can then also be passed in from the screenLock function.

screenLock didCancelled is not passed through

When passing a didCancelled function into screenLock, said function is not passed onto the ScreenLock widget.

Only the defaultDidCancelled is passed on:

  VoidCallback? defaultDidCancelled;
  if (canCancel && didCancelled == null) {
    defaultDidCancelled = Navigator.of(context).pop;
  }

  ScreenLock(
    /* ... */
    didCancelled: defaultDidCancelled,

Help.

Who can help me how to use correctString and listening what pinCode set the user. And save it to use in the other entering to app

canCancel is no longer available in latest version ?

Hi All
Why the canCancel option disappeared in latest version ?
I'm expecting the cancel option appears if we provide a cancelButton, but I cannot succeed in making the cancel button visible with the latest version.

builder: (context) {
          return ScreenLock(
            title: Text(title),
            confirmTitle: Text(S.current.ConfirmAuthRequired),
            confirmation: confirm,
            correctString: correctString,
            // V10.7 canCancel: canCancel,
            cancelButton: canCancel == true ?
              TextButton(onPressed: () { Navigator.pop(context); },
                child: const Icon(Icons.cancel_outlined, color: Colors.white, size: 24,)) : null,
            customizedButtonChild: showBiometrics ? const Icon(
              Icons.fingerprint,) : null,
            customizedButtonTap: showBiometrics ? () async {
              await localAuth(context, callBackOnUnlock);
            } : null,
            didConfirmed: (matchedText) {
              //debugPrint('LOCK screen didConfirmed');
              callBackOnUnlock(matchedText);
            },
            didUnlocked: () {
              //debugPrint('LOCK screen didUnlocked');
              callBackOnUnlock(correctString);
            },
            didMaxRetries: (nb) {
              //debugPrint('LOCK screen didMaxRetries');
            },
          );
        }

Replace HeadingText with DefaultTextTheme

Currently, we are using HeadingText to apply the right style to our Text when they are displayed above the Secrets.
This also means we have to export HeadingText for users to specify their own Text with the same style.
That is inconvenient.

Instead we can do what AppBar does for its title property.
We let the user provide a normal Text and then wrap it in a DefaultTextTheme which applies our text style.
If the user wants to opt out of that, they just have to provide a text style to their Text widget.

I will make a merge request for this, once other things are merged, so that there will be no conflicts.

custom function onError

is it possible to add?

I want to delete data or redirect the user if entered incorrectly several times
Now it is not possible to implement

inputButtonConfig was removed, but not update in docs

Hi, I use latest version of your package(7.0.4), in this version, there is no inputButtonConfig property and InputButtonConfig class, but you don't include this in your documents, there is no migration guide for this, and you use this property in the last example in your docs, please update your docs

Delete button error: Invalid value: Valid value range is empty: -1

I was trying this awesome plugin and run into this error while trying to delete the typed code. I know it's an easy fix for you :)
Thanks a lot for your awesome work!

I/flutter (29235): RangeError (index): Invalid value: Valid value range is empty: -1
I/flutter (29235):
I/flutter (29235): #0      List.[]  (dart:core-patch/growable_array.dart:166:60)
I/flutter (29235): #1      List.removeLast  (dart:core-patch/growable_array.dart:232:20)
I/flutter (29235): #2      _LockScreenState._removedStreamListener.<anonymous closure> 
package:flutter_screen_lock/lock_screen.dart:294
I/flutter (29235): #3      _rootRunUnary  (dart:async/zone.dart:1206:13)
I/flutter (29235): #4      _CustomZone.runUnary  (dart:async/zone.dart:1100:19)
I/flutter (29235): #5      _CustomZone.runUnaryGuarded  (dart:async/zone.dart:1005:7)
I/flutter (29235): #6      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:357:11)
I/flutter (29235): #7      _DelayedData.perform  (dart:async/stream_impl.dart:611:14)
I/flutter (29235): #8      _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:730:11)
I/flutter (29235): #9      _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:687:7)
I/flutter (29235): #10     _rootRun  (dart:async/zone.dart:1182:47)
I/flutter (29235): #11     _CustomZone.run  (dart:async/zone.dart:1093:19)
I/flutter (29235): #12     _CustomZone.runGuarded  (dart:async/zone.dart:997:7)
I/flutter (29235): #13     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:1037:23)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.