aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--lib/components/SearchableAppList.dart4
-rw-r--r--lib/main.dart18
-rw-r--r--lib/pages/Apps.dart4
4 files changed, 23 insertions, 5 deletions
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
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<SearchableAppList> {
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<Application> 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<MyApp> {
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<MyApp> {
initStateValue(dateTime);
}
+ void dispose() {
+ searchFieldFocus.dispose();
+ super.dispose();
+ }
+
void openApp(Application app) {
DeviceApps.openApp(app.packageName);
}
@@ -103,8 +111,13 @@ class MyAppState extends StreamState<MyApp> {
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<MyApp> {
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<Application> 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,
),
);
}