Created
June 25, 2020 18:16
-
-
Save scortumee/5aa651591cb0cd047e9fd11bc95e33c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:keyboard_actions/keyboard_actions.dart'; | |
class Keyboard extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => KeyboardState(); | |
} | |
class KeyboardState extends State<Keyboard> { | |
final FocusNode _keyboardWithDone = FocusNode(); | |
KeyboardActionsConfig _buildConfig(BuildContext context) { | |
return KeyboardActionsConfig( | |
keyboardActionsPlatform: KeyboardActionsPlatform.ALL, | |
keyboardBarColor: Colors.grey[200], | |
nextFocus: true, | |
actions: [ | |
KeyboardAction( | |
focusNode: _keyboardWithDone | |
) | |
] | |
); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Column( | |
children: <Widget>[ | |
Text('HEADER'), | |
Expanded( | |
child:ListView( | |
padding: EdgeInsets.only(left: 20, right: 20, top: 10), | |
children: <Widget>[ | |
Container( | |
height: 500, | |
color: Colors.blue, | |
), | |
Container( | |
margin: EdgeInsets.symmetric(vertical: 15), | |
height: 150, | |
child: KeyboardActions( | |
config: _buildConfig(context), | |
child: TextField( | |
focusNode: _keyboardWithDone, | |
maxLines: 5, | |
decoration: InputDecoration( | |
focusedBorder: OutlineInputBorder( | |
borderRadius: BorderRadius.all(Radius.circular(8)), | |
borderSide: BorderSide(color: Colors.blue, width: 5), | |
), | |
enabledBorder: OutlineInputBorder( | |
borderRadius: BorderRadius.all(Radius.circular(8)), | |
borderSide: BorderSide(color: Colors.grey, width: 3), | |
), | |
hintText: '... Meet me at the corner of 5th ave and ...' | |
), | |
), | |
), | |
) | |
] | |
) | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment