This repository has been archived by the owner on Oct 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
data_pane.dart
104 lines (98 loc) · 3.34 KB
/
data_pane.dart
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import 'package:data_tables/data_tables.dart';
import 'package:flutter/material.dart';
import 'package:mod_main/modules/org_manager/orgs/view_model/orgs_detail_page_view_model.dart';
import 'package:responsive_builder/responsive_builder.dart';
class DataPane extends StatelessWidget {
final OrgsViewModel model;
final SizingInformation sizingInfo;
const DataPane({Key key, this.model, this.sizingInfo}) : super(key: key);
@override
Widget build(BuildContext context) {
return
// (widget.model.buzy)
// ? Center(child: CircularProgressIndicator()):
NativeDataTable.builder(
rowsPerPage: model.rowsPerPage,
firstRowIndex: model.firstRowIndex,
itemCount: model.orgs.length ?? 0,
header: Text("Organization Details"),
handleNext: () {
model.handleNextPage();
},
handlePrevious: () {
model.handlePrevPage();
},
sortColumnIndex: model.sortColumnIndex,
sortAscending: model.sortAscending,
onRefresh: () async {
await new Future.delayed(new Duration(seconds: 3));
return null;
},
onRowsPerPageChanged: (int value) {
model.setRowsPerPage(value);
},
noItems: Text("No Orgs"),
// mobileItemBuilder: (BuildContext context, int index) {
// final org = model.orgs[index];
// return Text("${index} - ${org.organization}");
// },
onSelectAll: (bool value) {
model.onSelectAll(value);
},
rowCountApproximate: true,
actions: <Widget>[
// IconButton(
// icon: Icon(Icons.info_outline),
// onPressed: () {},
// ),
],
selectedActions: <Widget>[
IconButton(
icon: Icon(Icons.delete),
onPressed: () {},
),
],
itemBuilder: (int index) {
final org = model.orgs[index];
return DataRow.byIndex(
index: index,
onSelectChanged: (value) {
model.changeSelection(value, index);
},
selected: model.selected[index],
cells: [
DataCell(Text(org.organization)),
DataCell(Text(org.campaignName)),
DataCell(Text(org.category)),
DataCell(Text(org.actionType)),
DataCell(Text(org.actionLocation)),
DataCell(Text(org.actionLength)),
DataCell(Text(org.actionTime.toString())),
DataCell(Text(org.histPrecedents)),
DataCell(Text(org.strategy)),
DataCell(Text(org.goal)),
],
);
},
columns: [
DataColumn(
label: Text("Organization"),
onSort: (int columnIndex, bool ascending) =>
model.sort((org) => org.organization, columnIndex, ascending)),
DataColumn(
label: Text("Campaign"),
onSort: (int columnIndex, bool ascending) {
model.sort((org) => org.campaignName, columnIndex, ascending);
}),
DataColumn(label: Text("Category")),
DataColumn(label: Text("Action Type")),
DataColumn(label: Text("Action Location")),
DataColumn(label: Text("Action Length")),
DataColumn(label: Text("Action Time")),
DataColumn(label: Text("Historical Precedents")),
DataColumn(label: Text("Strategy")),
DataColumn(label: Text("Goal")),
],
);
}
}