slide_animated_password_lock 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 47

slide_animated_password_lock #

A simple password input field with slide lock animation.

Parameters #

hashedPassword - Correct hashed password value to trigger the sliding animation

hashMethod - Hashed method using for the password. Options available: HashMethod.PlainText/ HashMethod.SHA1/ HashMethod.SHA224/ HashMethod.SHA256/ HashMethod.SHA384/ HashMethod.SHA512/ HashMethod.MD5/ HashMethod.HMACMD5/ HashMethod.HMACSHA1/ HashMethod.HMACSHA256

hashKey - (Optional) Hash key in use if using HashMethod.HMACMD5/ HashMethod.HMACSHA1/ HashMethod.HMACSHA256

controller - Text Editing Controller for textfield

onUnlock - Function handler when unlocked

color - Color of the input field

width - (Optional) the total width of the widget. Default to 250, require > 0

height - (Optional) the height of the widget. Default to 40, require > 0

placeholder - (Optional) placeholder in the textfield. Default to an empty string.

Getting Started #

Add the plugin:

    dependencies:
        slide_animated_password_lock: ^1.0.0

Basic Usage #

 SlideAnimatedPasswordLock(
  hashedPassword: _hashedPassword,
  hashMethod: HashMethod.MD5,
  controller: _textFieldController,
  color: Theme.of(context).primaryColor,
  placeholder: "HELLO WORLD",
  onUnlock: (_unlocked){
    if (_unlocked){
      setState(()=>_msg = "Unlocked!");
    }else{
      setState(()=>_msg = "Please unlock!");
    }
  },
),

[0.0.3] - Support Password Hashing #

[0.0.2] #

  • Bug fix
  • Update Readme

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:slide_animated_password_lock/slide_animated_password_lock.dart';
import 'package:crypto/crypto.dart';
import 'dart:convert'; 


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _password = '111';
  String _hashedPassword;
  final TextEditingController _textFieldController =
      new TextEditingController();
  String _msg = "Please unlock";

  @override
  void initState() {
    super.initState();
    List<int> bytes = utf8.encode(_password); 
    _hashedPassword = md5.convert(bytes).toString();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
        SlideAnimatedPasswordLock(
          hashedPassword: _hashedPassword,
          hashMethod: HashMethod.MD5,
          controller: _textFieldController,
          color: Theme.of(context).primaryColor,
          placeholder: "HELLO WORLD",
          onUnlock: (_unlocked){
            if (_unlocked){
              setState(()=>_msg = "Unlocked!");
            }else{
              setState(()=>_msg = "Please unlock!");
            }
          },
        ),
        Text(_msg)
      ])),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  slide_animated_password_lock: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:slide_animated_password_lock/slide_animated_password_lock.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
86
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [slide_animated_password_lock] that is in a package requiring null.

Health suggestions

Fix lib/slide_animated_password_lock.dart. (-0.50 points)

Analysis of lib/slide_animated_password_lock.dart reported 1 hint:

line 20 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: SlideAnimatedPasswordLock.slideSpace

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

The package description is too short. (-4 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
crypto ^2.1.3 2.1.5
flutter 0.0.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test