initial commit
This commit is contained in:
+48
-4
@@ -19,6 +19,7 @@ class Booking {
|
||||
String code;
|
||||
String information;
|
||||
|
||||
int weekday = -1;
|
||||
String holiday = '';
|
||||
String dayLeft = '';
|
||||
String dayRight = '';
|
||||
@@ -45,10 +46,11 @@ class Booking {
|
||||
required this.information,
|
||||
}) {
|
||||
PublicHolidays h = PublicHolidays(year: bookingDay.year);
|
||||
|
||||
|
||||
weekday = bookingDay.weekday;
|
||||
holiday = h.holiday(bookingDay);
|
||||
dayLeft = DateFormat('EEEE - dd').format(bookingDay);
|
||||
dayRight = DateFormat('dd - EEEE').format(bookingDay);
|
||||
dayRight = DateFormat('dd - EEEE').format(bookingDay);
|
||||
pause = '';
|
||||
durationIs = '';
|
||||
durationShould = '';
|
||||
@@ -78,6 +80,8 @@ class BookingDataSource extends DataGridSource {
|
||||
void buildDataGridRow() {
|
||||
_bookingDataGridRows = booking
|
||||
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||
DataGridCell<String>(columnName: 'code', value: e.code),
|
||||
DataGridCell<int>(columnName: 'weekday', value: e.weekday),
|
||||
DataGridCell<String>(columnName: 'dayLeft', value: e.dayLeft),
|
||||
DataGridCell<String>(columnName: 'holiday', value: e.holiday),
|
||||
DataGridCell<String>(
|
||||
@@ -148,7 +152,6 @@ class BookingDataSource extends DataGridSource {
|
||||
}
|
||||
|
||||
List<Booking> booking = [];
|
||||
|
||||
List<DataGridRow> _bookingDataGridRows = [];
|
||||
|
||||
@override
|
||||
@@ -156,10 +159,51 @@ class BookingDataSource extends DataGridSource {
|
||||
|
||||
@override
|
||||
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||
Color colBG = Colors.white;
|
||||
String code = row.getCells().toList()[0].value;
|
||||
int weekday = row.getCells().toList()[1].value;
|
||||
String holiday = row.getCells().toList()[3].value;
|
||||
|
||||
if (code == 'U') {
|
||||
colBG = Color.fromARGB(255, 127, 127, 255);
|
||||
}
|
||||
if (weekday == 6 || weekday == 7) {
|
||||
colBG = Color.fromARGB(255, 255, 165, 0);
|
||||
}
|
||||
if (holiday != '') {
|
||||
colBG = Color.fromARGB(255, 255, 165, 0);
|
||||
}
|
||||
if (code == 'T') {
|
||||
colBG = Color.fromARGB(255, 127, 127, 255);
|
||||
}
|
||||
if (code == 'SU') {
|
||||
colBG = Color.fromARGB(255, 127, 127, 255);
|
||||
}
|
||||
if (code == 'K') {
|
||||
colBG = Colors.yellow;
|
||||
}
|
||||
if (code == 'G') {
|
||||
colBG = Color.fromARGB(255, 191, 191, 255);
|
||||
}
|
||||
if (code == 'T') {
|
||||
colBG = Colors.red;
|
||||
}
|
||||
|
||||
return DataGridRowAdapter(
|
||||
cells: row.getCells().map<Widget>((e) {
|
||||
if (e.columnName == 'dayRight' ||
|
||||
e.columnName == 'holiday' ||
|
||||
e.columnName == 'information') {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
color: colBG,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(e.value.toString() == '99:99' ? '' : e.value.toString()),
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
alignment: Alignment.centerRight,
|
||||
color: colBG,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(e.value.toString() == '99:99' ? '' : e.value.toString()),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user