aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/components/SearchableAppList.dart39
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/components/SearchableAppList.dart b/lib/components/SearchableAppList.dart
index 8f9da2f..820759d 100644
--- a/lib/components/SearchableAppList.dart
+++ b/lib/components/SearchableAppList.dart
@@ -3,12 +3,12 @@ import 'package:device_apps/device_apps.dart';
import 'AppList.dart';
-class SearchableAppList extends StatelessWidget {
- Future<List<Application>> appListF;
- void Function(Application) openApp;
- void Function(Application) openOptionsMenu;
-
- SearchableAppList({ this.appListF, this.openApp, this.openOptionsMenu }): super();
+class _SearchableAppListState extends State<SearchableAppList> {
+ String _searchTerm = '';
+
+ void onInput(String str) {
+ setState(() { _searchTerm = str; });
+ }
int _appSorter(Application a, Application b) {
return a.appName.compareTo(b.appName);
@@ -18,9 +18,17 @@ class SearchableAppList extends StatelessWidget {
Widget build(BuildContext ctx) {
return Column(
children: [
- Text('My text input'),
+ Container(
+ height: 100,
+ child: TextField(
+ decoration: InputDecoration(
+ border: InputBorder.none,
+ hintText: 'Enter a search term',
+ ),
+ ),
+ ),
Expanded(child: FutureBuilder(
- future: appListF,
+ future: widget.appListF,
builder: (ctx, AsyncSnapshot<List<Application>> snap) {
if (!snap.hasData) {
return Text('Loading...');
@@ -29,8 +37,8 @@ class SearchableAppList extends StatelessWidget {
snap.data.sort(_appSorter);
return AppList(
appList: snap.data,
- openApp: openApp,
- openOptionsMenu: openOptionsMenu,
+ openApp: widget.openApp,
+ openOptionsMenu: widget.openOptionsMenu,
);
}
)),
@@ -39,3 +47,14 @@ class SearchableAppList extends StatelessWidget {
}
}
+class SearchableAppList extends StatefulWidget {
+ Future<List<Application>> appListF;
+ void Function(Application) openApp;
+ void Function(Application) openOptionsMenu;
+
+ SearchableAppList({ this.appListF, this.openApp, this.openOptionsMenu }): super();
+
+ @override
+ _SearchableAppListState createState() => _SearchableAppListState();
+}
+