security_keyboard 1.0.3

  • Readme
  • Changelog
  • Installing
  • 58

security_keyboard #

A flutter security keyboard for multiple TextField and automatically positioned to the TextField position.

Add dependency #

  security_keyboard: ^1.0.3

Examples #

Step1 #

Write a personalized keyboard based on project needs

typedef KeyboardSwitch = Function(SecurityKeyboardType type);

enum SecurityKeyboardType {

class SecurityKeyboard extends StatefulWidget {
  final KeyboardController controller;

  final SecurityKeyboardType keyboardType;

  const SecurityKeyboard({this.controller, this.keyboardType});

  static SecurityTextInputType text =

  static SecurityTextInputType _inputKeyboard(
      SecurityKeyboardType securityKeyboardType) {
    String inputType = securityKeyboardType.toString();
    SecurityTextInputType securityTextInputType = SecurityTextInputType(name: inputType);
        builder: (context, controller) {
          return SecurityKeyboard(
            controller: controller,
            keyboardType: securityKeyboardType,
        getHeight: () {
          return SecurityKeyboard.getHeight(securityKeyboardType);

    return securityTextInputType;

  SecurityKeyboardType get _keyboardType => keyboardType;

  static double getHeight(SecurityKeyboardType securityKeyboardType) {
    return 232;

  _SecurityKeyboardState createState() => _SecurityKeyboardState();

class _SecurityKeyboardState extends State<SecurityKeyboard> {
  SecurityKeyboardType currentKeyboardType;

  void initState() {
    currentKeyboardType = widget._keyboardType;

  Widget build(BuildContext context) {
    Widget keyboard;
    return keyboard;

Step2 #

Add the following code to the page where you want to use the secure keyboard.

class PasswordVerify extends StatelessWidget {
  Widget build(BuildContext context) {
    return WillPopScope(
      child: KeyboardMediaQuery(
        child: Builder(builder: (ctx) {
          return Scaffold(
            appBar: AppBar(
              title: Text('验证登录密码'),
              brightness: Brightness.light,
            body: PasswordWidget(),
      onWillPop: _requestPop,

  Future<bool> _requestPop() {
    bool b = true;
    if (KeyboardManager.isShowKeyboard) {
      b = false;
    return Future.value(b);

Step3 #

Set custom security keyboard type in the TextField keyboardType. Just Pass the inputType written in Step1 as you normally would set the keyboard input type.

   keyboardType: SecurityKeyboard.text,

[1.0.3] - 2019-07-30.

  • Updated to flutter 1.7.8.

[1.0.2] - 2019-04-08.

  • Update addKeyboard.

[1.0.1] - 2019-04-04.

  • Update dependencies.

[1.0.0] - 2019-04-04.

  • Initial version, created by cy.

Use this package as a library

1. Depend on it

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

  security_keyboard: ^1.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:security_keyboard/keyboard_controller.dart';
import 'package:security_keyboard/keyboard_manager.dart';
import 'package:security_keyboard/keyboard_media_query.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/keyboard_manager.dart. (-2.96 points)

Analysis of lib/keyboard_manager.dart reported 6 hints, including:

line 51 col 5: 'BinaryMessages' is deprecated and shouldn't be used.

line 51 col 20: 'setMockMessageHandler' is deprecated and shouldn't be used.

line 101 col 19: 'BinaryMessages' is deprecated and shouldn't be used.

line 101 col 34: 'handlePlatformMessage' is deprecated and shouldn't be used.

line 227 col 5: 'BinaryMessages' is deprecated and shouldn't be used.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and security_keyboard.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies