diff --git a/lib/src/keyboard.dart b/lib/src/keyboard.dart index f498346..83dce30 100644 --- a/lib/src/keyboard.dart +++ b/lib/src/keyboard.dart @@ -219,29 +219,32 @@ class _VirtualKeyboardState extends State { switch (key.action) { case VirtualKeyboardKeyAction.Backspace: actionKey = GestureDetector( - onLongPress: () { - longPress = true; - // Start sending backspace key events while longPress is true - Timer.periodic( - Duration(milliseconds: _virtualKeyboardBackspaceEventPerioud), - (timer) { - if (longPress) { - onKeyPress(key); - } else { - // Cancel timer. - timer.cancel(); - } - }); - }, - onLongPressUp: () { - // Cancel event loop - longPress = false; - }, - child: Icon( - Icons.backspace, - color: textColor, - ), - ); + onLongPress: () { + longPress = true; + // Start sending backspace key events while longPress is true + Timer.periodic( + Duration(milliseconds: _virtualKeyboardBackspaceEventPerioud), + (timer) { + if (longPress) { + onKeyPress(key); + } else { + // Cancel timer. + timer.cancel(); + } + }); + }, + onLongPressUp: () { + // Cancel event loop + longPress = false; + }, + child: Container( + height: double.infinity, + width: double.infinity, + child: Icon( + Icons.backspace, + color: textColor, + ), + )); break; case VirtualKeyboardKeyAction.Shift: actionKey = Icon(Icons.arrow_upward, color: textColor); @@ -260,21 +263,20 @@ class _VirtualKeyboardState extends State { return Expanded( child: InkWell( onTap: () { - if (!alwaysCaps) { - if (key.action == VirtualKeyboardKeyAction.Shift) { + if (key.action == VirtualKeyboardKeyAction.Shift) { + if (!alwaysCaps) { setState(() { isShiftEnabled = !isShiftEnabled; }); } - - onKeyPress(key); } + + onKeyPress(key); }, child: Container( + alignment: Alignment.center, height: height / _keyRows.length, - child: Center( - child: actionKey, - ), + child: actionKey, ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 99a5199..8f2e603 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: virtual_keyboard description: A simple package for dispaying virtual keyboards on a devices like kiosks and ATMs. The library is written in Dart and has no native code dependancy. -version: 0.1.3 +version: 0.1.4 author: Gurgen Hovhannisyan homepage: https://github.com/gurgenDP/virtual_keyboard