From 35524aa8cb3d5e83a18af7ea8a952faa731375b4 Mon Sep 17 00:00:00 2001 From: iqFareez <60868965+fareezMaple@users.noreply.github.com> Date: Mon, 17 Aug 2020 10:41:37 +0800 Subject: [PATCH] unfocusing stuff --- lib/AppBody.dart | 5 +++- lib/main.dart | 67 ++++++++++++++++++++++++++---------------------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/lib/AppBody.dart b/lib/AppBody.dart index 0a0341e..3ca685f 100644 --- a/lib/AppBody.dart +++ b/lib/AppBody.dart @@ -102,7 +102,9 @@ class _AppBodyState extends State { filled: true), keyboardType: TextInputType.number, inputFormatters: [_amountValidator], - textInputAction: TextInputAction.done, + textInputAction: TextInputAction.next, + onSubmitted: (_) => + FocusScope.of(context).nextFocus(), ), ), ), @@ -123,6 +125,7 @@ class _AppBodyState extends State { keyboardType: TextInputType.number, inputFormatters: [_amountValidator], textInputAction: TextInputAction.done, + onSubmitted: (_) => FocusScope.of(context).unfocus(), ), ), ) diff --git a/lib/main.dart b/lib/main.dart index 871aef2..a1bd311 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,38 +25,43 @@ class MyApp extends StatelessWidget { class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.deepOrange.shade600, - elevation: 0.0, - actions: [ - IconButton( - icon: Icon(Icons.share), - onPressed: () { - print('Pressed'); - Share.share('Not implemented yet :")'); - }, - tooltip: 'Share your current BMI', - ), - IconButton( - icon: Icon(Icons.info), - onPressed: () { - print('Info'); - showAboutDialog( - context: context, - applicationName: 'BMI Calculator Lite', - applicationVersion: '1.0.0-pre+1', - applicationIcon: Image.network( - 'https://firebasestorage.googleapis.com/v0/b/bmi-flutter-2e776.appspot.com/o/logounnamed%20(Custom).png?alt=media&token=b22b53f7-bfc6-4a9b-89f3-92e681d1fe6c', - width: 50, - ), - applicationLegalese: '© maplerr aka fareez'); - }, - tooltip: 'View some info', - ) - ], + return GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrange.shade600, + elevation: 0.0, + actions: [ + IconButton( + icon: Icon(Icons.share), + onPressed: () { + print('Pressed'); + Share.share('Not implemented yet :")'); + }, + tooltip: 'Share your current BMI', + ), + IconButton( + icon: Icon(Icons.info), + onPressed: () { + print('Info'); + showAboutDialog( + context: context, + applicationName: 'BMI Calculator Lite', + applicationVersion: '1.0.0-pre+1', + applicationIcon: Image.network( + 'https://firebasestorage.googleapis.com/v0/b/bmi-flutter-2e776.appspot.com/o/logounnamed%20(Custom).png?alt=media&token=b22b53f7-bfc6-4a9b-89f3-92e681d1fe6c', + width: 50, + ), + applicationLegalese: '© maplerr aka fareez'); + }, + tooltip: 'View some info', + ) + ], + ), + body: AppBody(), ), - body: AppBody(), ); } }