From c285f8e733d448555209f95fd76eedbeef5d9e24 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 2 Jun 2020 22:17:22 +0530 Subject: Adds application list component in apps view --- lib/components/AppList.dart | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'lib/components/AppList.dart') diff --git a/lib/components/AppList.dart b/lib/components/AppList.dart index e69de29..5b54b04 100644 --- a/lib/components/AppList.dart +++ b/lib/components/AppList.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:device_apps/device_apps.dart'; + +class AppList extends StatelessWidget { + List appList; + void Function(Application) openApp; + void Function(Application) openOptionsMenu; + + AppList({ this.appList, this.openApp, this.openOptionsMenu }): super(); + + @override + Widget build(BuildContext ctx) { + return ListView.builder( + itemCount: appList.length, + itemBuilder: (ctx, index) { + Application app = appList[index]; + return Column( + children: [ + ListTile( + contentPadding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 16.0), + dense: true, + title: Text('${app.appName}', style: const TextStyle(fontSize: 16)), + onTap: () => openApp(app), + onLongPress: () => openOptionsMenu(app), + ), + Divider(height: 1.0), + ], + ); + }, + ); + } +} + -- cgit v1.3.1