aboutsummaryrefslogtreecommitdiff
path: root/lib/components/AppList.dart
blob: 5b54b043d6f2d911742da54c711bc265fc56f435 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import 'package:flutter/material.dart';
import 'package:device_apps/device_apps.dart';

class AppList extends StatelessWidget {
  List<Application> 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),
          ],
        );
      },
    );
  }
}