This package gives you lock screen or pass code page

Overview

Flutter Pass Code Page or Pin Code Page Package

This package gives you beautiful pass code page for using both android and ios.

flutter platform pub package License: MIT

Demo

Finger Print Usage

First, be sure you should ensure that you add the local_auth package as a dependency. And Please read local_auth all integration details. https://pub.dartlang.org/packages/local_auth

iOS Integration Note that this plugin works with both TouchID and FaceID. However, to use the latter, you need to also add:

<key>NSFaceIDUsageDescription</key>
<string>Why is my app authenticating using face id?</string>

to your Info.plist file. Failure to do so results in a dialog that tells the user your app has not been updated to use TouchID.

Android Integration Note that local_auth plugin requires the use of a FragmentActivity as opposed to Activity. This can be easily done by switching to use FlutterFragmentActivity as opposed to FlutterActivity in your manifest (or your own Activity class if you are extending the base class).

Update your project's AndroidManifest.xml file to include the USE_FINGERPRINT permissions:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.app">
  <uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<manifest>

Usage

It is really easy to use! You should ensure that you add the flutter_lock_screen as a dependency in your flutter project.

dependencies:
  flutter_lock_screen: '^2.0.1'

Than you can use it with below example.

import 'package:flutter/material.dart';
import 'package:local_auth/local_auth.dart';
import 'package:testapp/empty_page.dart';
import 'package:flutter/services.dart';

class PassCodeScreen extends StatefulWidget {
  PassCodeScreen({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _PassCodeScreenState createState() => new _PassCodeScreenState();
}

class _PassCodeScreenState extends State<PassCodeScreen> {
  bool isFingerprint = false;

  Future<Null> biometrics() async {
    final LocalAuthentication auth = new LocalAuthentication();
    bool authenticated = false;

    try {
      authenticated = await auth.authenticateWithBiometrics(
          localizedReason: 'Scan your fingerprint to authenticate',
          useErrorDialogs: true,
          stickyAuth: false);
    } on PlatformException catch (e) {
      print(e);
    }
    if (!mounted) return;
    if (authenticated) {
      setState(() {
        isFingerprint = true;
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    var myPass = [1, 2, 3, 4];
    return LockScreen(
        title: "This is Screet ",
        passLength: myPass.length,
        bgImage: "images/pass_code_bg.jpg",
        fingerPrintImage: "images/fingerprint.png",
        showFingerPass: true,
        fingerFunction: biometrics,
        fingerVerify: isFingerprint,
        borderColor: Colors.white,
        showWrongPassDialog: true,
        wrongPassContent: "Wrong pass please try again.",
        wrongPassTitle: "Opps!",
        wrongPassCancelButtonText: "Cancel",
        passCodeVerify: (passcode) async {
          for (int i = 0; i < myPass.length; i++) {
            if (passcode[i] != myPass[i]) {
              return false;
            }
          }

          return true;
        },
        onSuccess: () {
          Navigator.of(context).pushReplacement(
              new MaterialPageRoute(builder: (BuildContext context) {
            return EmptyPage();
          }));
        });
  }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Comments
  • Cannot find symbol: PackageManager.FEATURE_IRIS

    Cannot find symbol: PackageManager.FEATURE_IRIS

    I am using flutter_lock_screen(^1.0.5) plugin along with local_auth(0.6.0) in my project. When I am trying to build the project but it keeps returning the same error everytime. I have changed the FlutterActivity to FlutterFragmentActivity as given in the documentation The Fingerprint permission is also added to the AndroidManifest.xml file

    Launching lib/main.dart on Redmi Note 5 Pro in debug mode...
    /home/pratik037/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/local_auth-0.6.0/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java:104: error: cannot find symbol
              if (packageManager.hasSystemFeature(PackageManager.FEATURE_FACE)) {
                                                                ^
      symbol:   variable FEATURE_FACE
      location: class PackageManager
    
    
    /home/pratik037/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/local_auth-0.6.0/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java:107: error: cannot find symbol
              if (packageManager.hasSystemFeature(PackageManager.FEATURE_IRIS)) {
                                                                ^
      symbol:   variable FEATURE_IRIS
      location: class PackageManager
    2 errors
    

    Here's my code:

    import 'package:flutter/material.dart';
    import 'package:flutter_lock_screen/flutter_lock_screen.dart';
    import 'package:local_auth/local_auth.dart';
    import 'package:flutter/services.dart';
    
    class PassCodeScreen extends StatefulWidget {
      PassCodeScreen({Key key, this.title}) : super(key: key);
    
      final String title;
    
      @override
      _PassCodeScreenState createState() => new _PassCodeScreenState();
    }
    
    class _PassCodeScreenState extends State<PassCodeScreen> {
      bool isFingerprint;
    
      Future<Null> biometrics() async {
        final LocalAuthentication auth = new LocalAuthentication();
        bool authenticated = false;
    
        try {
          authenticated = await auth.authenticateWithBiometrics(
              localizedReason: 'Scan your fingerprint to authenticate',
              useErrorDialogs: true,
              stickyAuth: true);
        } on PlatformException catch (e) {
          print(e);
        }
        if (!mounted) return;
        if (authenticated) {
          setState(() {
            isFingerprint = true;
          });
        }
      }
    
      @override
      Widget build(BuildContext context) {
        var myPass = [1, 2, 3, 4];
        return LockScreen(
            title: "This is Screet ",
            passLength: myPass.length,
            bgImage: "images/pass_code_bg.jpg",
            fingerPrintImage: "images/fingerprint.png",
            showFingerPass: true,
            fingerFunction: biometrics,
            fingerVerify: isFingerprint,
            borderColor: Colors.white,
            showWrongPassDialog: true,
            wrongPassContent: "Wrong pass please try again.",
            wrongPassTitle: "Opps!",
            wrongPassCancelButtonText: "Cancel",
            passCodeVerify: (passcode) async {
              for (int i = 0; i < myPass.length; i++) {
                if (passcode[i] != myPass[i]) {
                  return false;
                }
              }
    
              return true;
            },
            onSuccess: () {
              Navigator.pushReplacementNamed(context, '/');
            });
      }
    }
    

    Here's flutter doctor -v output:

    pratik037@Pratik-Asus:~/Flutter Projects/remindme$ flutter doctor -v
    [✓] Flutter (Channel beta, v1.9.1+hotfix.2, on Linux, locale en_GB.UTF-8)
        • Flutter version 1.9.1+hotfix.2 at /home/pratik037/Flutter/flutter
        • Framework revision 2d2a1ffec9 (3 weeks ago), 2019-09-06 18:39:49 -0700
        • Engine revision b863200c37
        • Dart version 2.5.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at /home/pratik037/Android/Sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-29, build-tools 28.0.3
        • Java binary at: /home/pratik037/Android_Studio/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
        • All Android licenses accepted.
    
    [✓] Android Studio (version 3.5)
        • Android Studio at /home/pratik037/Android_Studio/android-studio
        • Flutter plugin version 39.0.3
        • Dart plugin version 191.8423
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    
    [✓] IntelliJ IDEA Community Edition (version 2019.1)
        • IntelliJ at /home/pratik037/Downloads/idea-IC-183.5912.21
        • Flutter plugin version 35.2.2
        • Dart plugin version 191.6183.88
    
    [✓] VS Code (version 1.38.1)
        • VS Code at /usr/share/code
        • Flutter extension version 3.4.1
    
    [✓] Connected device (1 available)
        • Redmi Note 5 Pro • 41d6ca4b • android-arm64 • Android 9 (API 28)
    
    • No issues found!
    

    Can you please help me to solve this issue?

    opened by pratik037 22
  • no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null flutter

    no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null flutter

    on my phone fingerprint is not working with the plugin no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null flutter

    opened by Kalyanb447-github 3
  • boolean expression must not be null

    boolean expression must not be null

    I am getting this error when i launch this app [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Failed assertion: boolean expression must not be null _LockScreenState._fingerPrint _fingerPrint() { if (widget.fingerVerify) { <.... error hit this line widget.onSuccess(); } }

    opened by prasant10050 1
  • Question: PlatformException(NotAvailable, Required security features not enabled, null, null)

    Question: PlatformException(NotAvailable, Required security features not enabled, null, null)

    Hi. im asking in case you have an idea.

    i didnt have problems switching to FlutterFragmentActivity but i get this error now. im not quite sure why it says required security features not enabled when in the manifest file, it is specified what permissions to use.

    thoughts?

    this is what i use now

    before it was USE_FINGERPRINT. still tried to use this but same result.

    opened by chitgoks 0
  • Update flutter_lock_screen.dart

    Update flutter_lock_screen.dart

    Fixed issue with display of "fingerPrintImage" currently the white colour overlay the image so the image won't display.

    Please accept it , it will waste other people time as well to find out the reason

    opened by mdavidkhan 0
Owner
Yasin ilhan
Yasin ilhan
A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper on Android devices.

wallpaper_manager A Flutter plugin for changing the Home Screen, Lock Screen (or both) Wallpaper(s) on Android devices. Usage Installation In the pubs

Aditya Mulgundkar 38 Nov 28, 2022
Android test task master - Create PIN code screen, authentication by PIN code screen and menu screen

Here is described test tasks for a android dev. Need to implement three screens:

null 3 Oct 4, 2022
A Dart package which simulates pass by reference feature

Reference Wrapper is a Dart package which simulates pass by reference feature us

null 0 Dec 19, 2021
Flutter - Passcode Lock Screen

Flutter - Passcode Lock Screen A Flutter package for iOS and Android for showing passcode input screen, similar to Native iOS. Installation First add

Vladimir Hudnitsky 160 Dec 25, 2022
A flutter app that gives you affirmation you daily need by saying "I am Freaking rich!"

A very basic flutter app that gives you affirmation you daily need by saying "I am Freaking rich!" ?? What’s In This Document Get Up and Running in 5

Bhavuk kalra 1 Feb 15, 2022
I created a welcome page, login page and signup page using Flutter

welcome_page UI design for welcome page, signUp page & Login page by Joy Obor Getting Started This project is a starting point for a Flutter applicati

spyder 0 Dec 29, 2021
Doctor Consultation App in Flutter containing splash screen on boarding screen Routing state management Dash board Bottom navigation Decorated Drawer and Doctors Screen in the last.

Online doctor Consultation App UI in Flutter Doctor Consultation App UI in Flutter Visit Website Features State Management Navigation Bar Responsive D

Habib ullah 14 Jan 1, 2023
A simple button that gives you the possibility to transform into a circular one and shows a progress indicator

Progress Button A simple button that gives you the possibility to transform into

Daniel B Schneider 0 Dec 22, 2021
Widget that gives you the size of the widget in runtime.

Tailor Flutter widget that calculates the size of a widget in runtime. Usage Just wrap your widget with Tailor and get the size in the builder. The bu

Aman Gupta 7 Nov 2, 2022
A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your issue.

r_scan A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your iss

PengHui Li 112 Nov 11, 2022
Rotate Dial Lock

Rotary dial Locker Dependencies : How it works Most magic handle by GuesterDetector. onPanEnd onPanDown onPanUpdate SpringHouse, 1st we locate where u

Md. Yeasin Sheikh 10 Dec 21, 2022
Backs up Android devices on Linux, macOS and Windows. Backup your device without vendor lock-ins, using insecure software or root.

Backs up Android devices on Linux, macOS and Windows. Backup your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box.

null 255 Dec 31, 2022
MindInventory 15 Sep 5, 2022
A package that gives us a modern way to show animated border as a placeholder while loading our widget with easy customization and ready to use.

A package that gives us a modern way to show animated border as a placeholder while loading our widget with easy customization and ready to use.

Mohit Chauhan 8 Oct 3, 2022
A package that offers various page indicators inlcuding a Flutter implementation of the Ink Page Indicator

A package that offers various page indicators inlcuding a Flutter implementation of the Ink Page Indicator. See below for more examples.

null 50 Jan 6, 2022
A full screen mobile scanner for scanning QR Code and Bar Code.

Flutter QR Bar Scanner A Full Screen Scanner for Scanning QR code and Barcode using Google's Mobile Vision API Reading & Scanning QR/Bar codes using F

Lutfor Rahman 31 Oct 5, 2022
ITS A SIMPLE CRYPTO APP THAT GIVES OR DISPLAYS PRICES - %CHANGE AND CHANGE VALUE OF TICKER (VARIOUS CRYPTO ASSERTS)

btcpricetracker A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

jatin upadhyay 0 Dec 28, 2021
Its a simple app which gives Weather Update, Bit Coin Value Comparator, and Flash Chat Application

Bundle_App_MajorProject Description : Its a simple app which is a bundle of Weather Update App, Bit Coin Value Comparator App, and Flash Chat Applicat

Avinandan Bose 2 Sep 9, 2022
Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.

Dart_Native Dart_Native operates as both a code generator tool and a bridge to communicate between Dart and native APIs. Replaces the low-performing F

DartNative 893 Jan 4, 2023