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

keyboard actions

because the keyboard that android / ios offers us specifically when we are in numeric mode, does not bring the button to hide the keyboard. this causes a lot of inconvenience for users, so this package allows adding functionality to the existing keyboard.

keyboard-actions

features

  • done button for the keyboard ( you can customize the button).
  • move up/down between your textfields.
  • keyboard bar customization
  • you can use it for android, ios or both platforms.

getting started

you should ensure that you add the router as a dependency in your flutter project.

dependencies:
  keyboard_actions: "^1.0.4"

you should then run flutter packages upgrade or update your packages in intellij.

example project

there is an example project in the example folder. check it out. otherwise, keep reading to get up and running.

usage

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

 //...
  focusnode _nodetext1 = focusnode();
  focusnode _nodetext2 = focusnode();
  focusnode _nodetext3 = focusnode();
  focusnode _nodetext4 = focusnode();
  focusnode _nodetext5 = focusnode();

 @override
  widget build(buildcontext context) {
    return scaffold(
      appbar: appbar(
        title: text("keyboard actions sample"),
      ),
      body: formkeyboardactions(
        keyboardactionsplatform: keyboardactionsplatform.all, //optional
        keyboardbarcolor: colors.grey[200], //optional
        nextfocus: true, //optional
        actions: [
          keyboardaction(
            focusnode: _nodetext1,
          ),
          keyboardaction(
            focusnode: _nodetext2,
            closewidget: padding(
              padding: edgeinsets.all(8.0),
              child: icon(icons.close),
            ),
          ),
          keyboardaction(
            focusnode: _nodetext3,
            ontapaction: () {
              showdialog(
                  context: context,
                  builder: (context) {
                    return alertdialog(
                      content: text("custom action"),
                      actions: <widget>[
                        flatbutton(
                          child: text("ok"),
                          onpressed: () => navigator.of(context).pop(),
                        )
                      ],
                    );
                  });
            },
          ),
          keyboardaction(
            focusnode: _nodetext4,
            displayclosewidget: false,
          ),
          keyboardaction(
            focusnode: _nodetext5,
            closewidget: padding(
              padding: edgeinsets.all(5.0),
              child: text("close"),
            ),
          ),
        ],
        child: padding(
          padding: const edgeinsets.all(15.0),
          child: singlechildscrollview(
            child: column(
              crossaxisalignment: crossaxisalignment.stretch,
              children: <widget>[
                textfield(
                  keyboardtype: textinputtype.number,
                  focusnode: _nodetext1,
                  decoration: inputdecoration(
                    hinttext: "input number",
                  ),
                ),
                textfield(
                  keyboardtype: textinputtype.text,
                  focusnode: _nodetext2,
                  decoration: inputdecoration(
                    hinttext: "input text with custom close widget",
                  ),
                ),
                textfield(
                  keyboardtype: textinputtype.number,
                  focusnode: _nodetext3,
                  decoration: inputdecoration(
                    hinttext: "input number with custom action",
                  ),
                ),
                textfield(
                  keyboardtype: textinputtype.text,
                  focusnode: _nodetext4,
                  decoration: inputdecoration(
                    hinttext: "input text without close widget",
                  ),
                ),
                textfield(
                  keyboardtype: textinputtype.number,
                  focusnode: _nodetext5,
                  decoration: inputdecoration(
                    hinttext: "input number with custom close widget",
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

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.