diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-02 22:31:27 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-02 22:31:27 +0530 |
| commit | fe5cebca2be3bff2e9acea13fab2a4d8f706e02f (patch) | |
| tree | 05a828005888c38d6592399961075ad789cb20b1 /lib/components | |
| parent | c285f8e733d448555209f95fd76eedbeef5d9e24 (diff) | |
| download | daft-launcher-fe5cebca2be3bff2e9acea13fab2a4d8f706e02f.tar.gz daft-launcher-fe5cebca2be3bff2e9acea13fab2a4d8f706e02f.zip | |
Simple text field added
Diffstat (limited to '')
| -rw-r--r-- | lib/components/SearchableAppList.dart | 39 |
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(); +} + |
