option to reverse the Layout
This commit is contained in:
parent
f5c6e2be5a
commit
4e823d35b8
@ -18,7 +18,7 @@
|
||||
|
||||
* Fixed the bug with backspace key.
|
||||
|
||||
## [0.2.1] - 19/03/2020.
|
||||
## [0.2.2] - 19/03/2020.
|
||||
|
||||
* Adding multi-language support.
|
||||
* Customizable layout.
|
@ -68,6 +68,10 @@ VirtualKeyboardLayoutKeys customLayoutKeys;
|
||||
/// will be ignored if customLayoutKeys is not null
|
||||
List<VirtualKeyboardDefaultLayouts> defaultLayouts;
|
||||
```
|
||||
```dart
|
||||
/// inverse the layout to fix the issues with right to left languages, default is false.
|
||||
bool reverseLayout;
|
||||
```
|
||||
|
||||
### VirtualKeyboardType
|
||||
enum of Available Virtual Keyboard Types.
|
||||
|
@ -87,6 +87,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
textController: _controllerText,
|
||||
//customLayoutKeys: _customLayoutKeys,
|
||||
defaultLayouts: [VirtualKeyboardDefaultLayouts.Arabic,VirtualKeyboardDefaultLayouts.English],
|
||||
//reverseLayout :true,
|
||||
type: isNumericMode
|
||||
? VirtualKeyboardType.Numeric
|
||||
: VirtualKeyboardType.Alphanumeric,
|
||||
|
@ -38,6 +38,9 @@ class VirtualKeyboard extends StatefulWidget {
|
||||
/// Set to true if you want only to show Caps letters.
|
||||
final bool alwaysCaps;
|
||||
|
||||
/// inverse the layout to fix the issues with right to left languages.
|
||||
final bool reverseLayout;
|
||||
|
||||
/// used for multi-languages with default layouts, the default is English only
|
||||
/// will be ignored if customLayoutKeys is not null
|
||||
final List<VirtualKeyboardDefaultLayouts> defaultLayouts;
|
||||
@ -51,6 +54,7 @@ class VirtualKeyboard extends StatefulWidget {
|
||||
this.defaultLayouts,
|
||||
this.customLayoutKeys,
|
||||
this.textController,
|
||||
this.reverseLayout = false,
|
||||
this.height = _virtualKeyboardDefaultHeight,
|
||||
this.textColor = Colors.black,
|
||||
this.fontSize = 14,
|
||||
@ -75,6 +79,7 @@ class _VirtualKeyboardState extends State<VirtualKeyboard> {
|
||||
Color textColor;
|
||||
double fontSize;
|
||||
bool alwaysCaps;
|
||||
bool reverseLayout;
|
||||
VirtualKeyboardLayoutKeys customLayoutKeys;
|
||||
// Text Style for keys.
|
||||
TextStyle textStyle;
|
||||
@ -126,6 +131,7 @@ class _VirtualKeyboardState extends State<VirtualKeyboard> {
|
||||
textColor = widget.textColor;
|
||||
fontSize = widget.fontSize;
|
||||
alwaysCaps = widget.alwaysCaps;
|
||||
reverseLayout = widget.reverseLayout ?? false;
|
||||
textController = widget.textController ?? textController;
|
||||
customLayoutKeys = widget.customLayoutKeys ?? customLayoutKeys ;
|
||||
// Init the Text Style for keys.
|
||||
@ -149,7 +155,7 @@ class _VirtualKeyboardState extends State<VirtualKeyboard> {
|
||||
textColor = widget.textColor;
|
||||
fontSize = widget.fontSize;
|
||||
alwaysCaps = widget.alwaysCaps;
|
||||
|
||||
reverseLayout = widget.reverseLayout ?? false;
|
||||
// Init the Text Style for keys.
|
||||
textStyle = TextStyle(
|
||||
fontSize: fontSize,
|
||||
@ -196,13 +202,7 @@ class _VirtualKeyboardState extends State<VirtualKeyboard> {
|
||||
|
||||
// Generate keyboard row.
|
||||
List<Widget> rows = List.generate(keyboardRows.length, (int rowNum) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// Generate keboard keys
|
||||
children: List.generate(
|
||||
var items =List.generate(
|
||||
keyboardRows[rowNum].length,
|
||||
(int keyNum) {
|
||||
// Get the VirtualKeyboardKey object.
|
||||
@ -236,8 +236,17 @@ class _VirtualKeyboardState extends State<VirtualKeyboard> {
|
||||
}
|
||||
|
||||
return keyWidget;
|
||||
},
|
||||
),
|
||||
});
|
||||
|
||||
if(this.reverseLayout)
|
||||
items = items.reversed.toList();
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// Generate keboard keys
|
||||
children: items,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: virtual_keyboard_multi_language
|
||||
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.2.1
|
||||
author: Ahmed El-Araby <ahmed-eg@live.com>
|
||||
version: 0.2.2
|
||||
#author: Ahmed El-Araby <ahmed-eg@live.com>
|
||||
homepage: https://github.com/ahmed-eg/virtual_keyboard_multi_language
|
||||
|
||||
environment:
|
||||
|
Loading…
x
Reference in New Issue
Block a user