Created
April 28, 2023 14:23
-
-
Save rei-codes/b2d5bcde0e4268a2e3a135ee876edb70 to your computer and use it in GitHub Desktop.
Next focus on enter
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
class NextFocusOnEnter extends StatelessWidget { | |
const NextFocusOnEnter({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Next focus on enter'), | |
), | |
body: Column( | |
children: const [ | |
Padding( | |
padding: EdgeInsets.all(16), | |
child: TextField( | |
decoration: InputDecoration(hintText: 'First'), | |
// Magic happens here | |
// Switches the focus to the next widget | |
textInputAction: TextInputAction.next, | |
), | |
), | |
Padding( | |
padding: EdgeInsets.all(16), | |
child: TextField( | |
decoration: InputDecoration(hintText: 'Second'), | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment