From 0ec3ce0089cee442d8a8152befeea5213c412b14 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 8 Jun 2020 13:11:40 +0530 Subject: Fixes gradle issue --- android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 296b146..da44bc1 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip -- cgit v1.3.1 From f41510dc4e54a8c15c58a4d7ca5ecc5c023b2285 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 21 Jun 2020 23:07:33 +0530 Subject: Implements node focus in/out --- lib/components/SearchableAppList.dart | 4 +++- lib/main.dart | 18 ++++++++++++++++-- lib/pages/Apps.dart | 4 +++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/components/SearchableAppList.dart b/lib/components/SearchableAppList.dart index d9c7a17..3ac0d25 100644 --- a/lib/components/SearchableAppList.dart +++ b/lib/components/SearchableAppList.dart @@ -51,6 +51,7 @@ class _SearchableAppListState extends State { child: TextField( enableSuggestions: false, controller: _inputController, + focusNode: widget.searchFieldFocus, decoration: InputDecoration( contentPadding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 8.0), hintStyle: TextStyle(color: Color(0x88D8DEE9)), @@ -77,8 +78,9 @@ class SearchableAppList extends StatefulWidget { List appList; void Function(Application) openApp; void Function(Application) openOptionsMenu; + FocusNode searchFieldFocus; - SearchableAppList({ this.appList, this.openApp, this.openOptionsMenu }): super(); + SearchableAppList({ this.appList, this.openApp, this.openOptionsMenu, this.searchFieldFocus }): super(); @override _SearchableAppListState createState() => _SearchableAppListState(); diff --git a/lib/main.dart b/lib/main.dart index fa48706..f7f3c06 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -36,6 +36,9 @@ class MyAppState extends StreamState { stream$: Stream.periodic(Duration(seconds: 1), (_x) => DateTime.now()).asBroadcastStream(), value: DateTime.now(), ); + + FocusNode searchFieldFocus = FocusNode(); + void initState() { super.initState(); @@ -51,6 +54,11 @@ class MyAppState extends StreamState { initStateValue(dateTime); } + void dispose() { + searchFieldFocus.dispose(); + super.dispose(); + } + void openApp(Application app) { DeviceApps.openApp(app.packageName); } @@ -103,8 +111,13 @@ class MyAppState extends StreamState { onWillPop: () => Future.value(false), child: PageView( controller: PageController(keepPage: true), - onPageChanged: (_x) { - SystemChannels.textInput.invokeMethod('TextInput.hide'); + onPageChanged: (x) { + if (x == 1) { + searchFieldFocus.requestFocus(); + } else { + searchFieldFocus.unfocus(); + //SystemChannels.textInput.invokeMethod('TextInput.hide'); + } }, children: [ HomeView( @@ -117,6 +130,7 @@ class MyAppState extends StreamState { appList: applications.value, openApp: openApp, openOptionsMenu: openOptionsMenu, + searchFieldFocus: searchFieldFocus, ), ], ), diff --git a/lib/pages/Apps.dart b/lib/pages/Apps.dart index f221d27..692ec37 100644 --- a/lib/pages/Apps.dart +++ b/lib/pages/Apps.dart @@ -10,8 +10,9 @@ class AppsView extends StatelessWidget { void Function(Application) openApp; void Function(BuildContext, Application) openOptionsMenu; List appList; + FocusNode searchFieldFocus; - AppsView({ this.appList, this.openApp, this.openOptionsMenu }): super(); + AppsView({ this.appList, this.openApp, this.openOptionsMenu, this.searchFieldFocus }): super(); @override Widget build(BuildContext ctx) { @@ -21,6 +22,7 @@ class AppsView extends StatelessWidget { appList: appList, openApp: openApp, openOptionsMenu: (app) => openOptionsMenu(ctx, app), + searchFieldFocus: searchFieldFocus, ), ); } -- cgit v1.3.1