Skip to content

Instantly share code, notes, and snippets.

@scortumee
Created June 25, 2020 18:16
Show Gist options
  • Save scortumee/5aa651591cb0cd047e9fd11bc95e33c9 to your computer and use it in GitHub Desktop.
Save scortumee/5aa651591cb0cd047e9fd11bc95e33c9 to your computer and use it in GitHub Desktop.
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