-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlist_item.dart
More file actions
58 lines (51 loc) · 1.84 KB
/
list_item.dart
File metadata and controls
58 lines (51 loc) · 1.84 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import 'package:flutter/material.dart';
import '../../data/employee.dart';
import '../../data/routes.dart';
class ListItem extends StatelessWidget {
static const String employeesInsertEndpoint =
'https://app.swaggerhub.com/apis/flutterteam2/basic-flutter/1.0.0#/employeemanagement/v1/employee';
const ListItem({Key? key, required this.index, required this.employeeList})
: super(key: key);
final int index;
final List<Employee> employeeList;
void _switchToEmployeePage(BuildContext context) {
Navigator.pushNamed(context, Routes.employeeDialogRouteName);
}
void _switchToEmployeePage(BuildContext context) {
Navigator.pushNamed(context, Routes.employeeDialogRouteName);
}
@override
Widget build(BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_switchToEmployeePage(context);
},
child: Card(
elevation: 10,
child: ListTile(
title: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'${employeeList[index].firstName} ${employeeList[index].lastName} ',
style: Theme.of(context).textTheme.headline6),
),
subtitle: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
employeeList[index].email,
style: const TextStyle(
fontFamily: "Raleway-ExtraBold", fontSize: 16),
softWrap: true,
),
),
trailing: TextButton.icon(
onPressed: () {},
icon: const Icon(Icons.delete_forever),
label: const Text("Delete"),
style: TextButton.styleFrom(
primary: Theme.of(context).errorColor)),
),
));
}
}