Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter mobile secure keyboard

mobile secure keyboard to prevent keylogger attack and screen capture.

screenshots

alphanumeric numeric
flutter mobile secure keyboard 103331973-9a171880-4aab-11eb-8b34-fdf388d14044

getting started

to use mobile secure keyboard plugin, add flutter_secure_keyboard as a dependency in your pubspec.yaml file. for example:

dependencies:
  flutter_secure_keyboard: ^1.0.1+3

examples

class withsecurekeyboardexample extends statefulwidget {
  @override
  _withsecurekeyboardexamplestate createstate() => _withsecurekeyboardexamplestate();
}

class _withsecurekeyboardexamplestate extends state<withsecurekeyboardexample> {
  final securekeyboardcontroller = securekeyboardcontroller();

  final passwordeditor = texteditingcontroller();
  final passwordtextfieldfocusnode = focusnode();

  final pincodeeditor = texteditingcontroller();
  final pincodetextfieldfocusnode = focusnode();

  @override
  widget build(buildcontext context) {
    return withsecurekeyboard(
      controller: securekeyboardcontroller,
      child: scaffold(
        appbar: appbar(title: text('with_secure_keyboard_example')),
        body: _buildcontentview()
      ),
    );
  }

  widget _buildcontentview() {
    // we recommend using the listview widget to prevent widget overflows.
    return listview(
      padding: const edgeinsets.all(8.0),
      children: [
        padding(
          padding: const edgeinsets.only(bottom: 12.0),
          child: _buildpasswordtextfield()
        ),
        _buildpincodetextfield()
      ],
    );
  }

  widget _buildpasswordtextfield() {
    return column(
      crossaxisalignment: crossaxisalignment.start,
      children: [
        text('password'),
        textformfield(
          controller: passwordeditor,
          focusnode: passwordtextfieldfocusnode,
          // we recommended to set false to prevent the soft keyboard from opening.
          enableinteractiveselection: false,
          obscuretext: true,
          ontap: () {
            securekeyboardcontroller.show(
              type: securekeyboardtype.alphanumeric,
              textfieldfocusnode: passwordtextfieldfocusnode,
              inittext: passwordeditor.text,
              hinttext: 'password',
              onconfirmkeypressed: (list<int> charcodes) {
                passwordeditor.text = string.fromcharcodes(charcodes);
              }
            );
          },
        ),
      ],
    );
  }

  widget _buildpincodetextfield() {
    return column(
      crossaxisalignment: crossaxisalignment.start,
      children: [
        text('pincode'),
        textformfield(
          controller: pincodeeditor,
          focusnode: pincodetextfieldfocusnode,
          // we recommended to set false to prevent the soft keyboard from opening.
          enableinteractiveselection: false,
          obscuretext: true,
          ontap: () {
            securekeyboardcontroller.show(
              type: securekeyboardtype.numeric,
              textfieldfocusnode: pincodetextfieldfocusnode,
              inittext: pincodeeditor.text,
              hinttext: 'pincode',
              onconfirmkeypressed: (list<int> charcodes) {
                pincodeeditor.text = string.fromcharcodes(charcodes);
              }
            );
          },
        ),
      ],
    );
  }
}

withsecurekeyboard

parameter description
controller* controller for controlling the secure keyboard.
child* a widget to have a secure keyboard.
keyboardheight parameters to set the keyboard height.
backgroundcolor parameters to set the keyboard background color.
stringkeycolor parameters to set keyboard string key(alphanumeric, numeric..) color.
actionkeycolor parameters to set keyboard action key(shift, backspace, clear..) color.
confirmkeycolor parameters to set keyboard confirm key color.
keytextstyle parameters to set keyboard key text style.
inputtextstyle parameters to set keyboard input text style.

securekeyboardcontroller

function description
isshowing whether the secure keyboard is open.
type indicates the secure keyboard type.
show show a secure keyboard.
hide hide a secure keyboard.

securekeyboardcontroller.show()

parameter description
type* specifies the secure keyboard type.
textfieldfocusnode the focusnode that will receive focus on.
inittext sets the initial value of the input text.
hinttext the hint text to display when the input text is empty.
inputtextlengthsymbol sets the symbol to use when displaying the input text length.
confirmkeytext sets the confirm key text.
clearkeytext sets the clear key text.
obscuringcharacter sets the secure character to hide the input text.
maxlength sets the maximum length of text that can be entered.
alwayscaps whether to always display uppercase characters.
obscuretext whether to hide input text as secure characters.
onkeypressed called when the key is pressed.
oncharcodeschanged called when the character codes changed.
onconfirmkeypressed* called when the confirm key is pressed.
onclosekeypressed called when the close key is pressed.

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.