dev #1
@ -11,18 +11,28 @@ class TableWidget extends StatelessWidget {
|
|||||||
|
|
||||||
// Fungsi untuk menentukan jumlah kursi di tiap sisi
|
// Fungsi untuk menentukan jumlah kursi di tiap sisi
|
||||||
Map<String, int> getChairDistribution(int capacity) {
|
Map<String, int> getChairDistribution(int capacity) {
|
||||||
if (capacity == 2) {
|
if (capacity == 1) {
|
||||||
|
return {'top': 0, 'bottom': 0, 'left': 1, 'right': 0};
|
||||||
|
} else if (capacity == 2) {
|
||||||
return {'top': 0, 'bottom': 0, 'left': 1, 'right': 1};
|
return {'top': 0, 'bottom': 0, 'left': 1, 'right': 1};
|
||||||
|
} else if (capacity == 3) {
|
||||||
|
return {'top': 1, 'bottom': 0, 'left': 1, 'right': 1};
|
||||||
} else if (capacity == 4) {
|
} else if (capacity == 4) {
|
||||||
return {'top': 1, 'bottom': 1, 'left': 1, 'right': 1};
|
return {'top': 1, 'bottom': 1, 'left': 1, 'right': 1};
|
||||||
|
} else if (capacity == 5) {
|
||||||
|
return {'top': 2, 'bottom': 1, 'left': 1, 'right': 1};
|
||||||
} else if (capacity == 6) {
|
} else if (capacity == 6) {
|
||||||
return {'top': 2, 'bottom': 2, 'left': 1, 'right': 1};
|
return {'top': 2, 'bottom': 2, 'left': 1, 'right': 1};
|
||||||
|
} else if (capacity == 7) {
|
||||||
|
return {'top': 3, 'bottom': 2, 'left': 1, 'right': 1};
|
||||||
} else if (capacity == 8) {
|
} else if (capacity == 8) {
|
||||||
return {'top': 3, 'bottom': 3, 'left': 1, 'right': 1};
|
return {'top': 3, 'bottom': 3, 'left': 1, 'right': 1};
|
||||||
|
} else if (capacity == 9) {
|
||||||
|
return {'top': 4, 'bottom': 3, 'left': 1, 'right': 1};
|
||||||
} else if (capacity == 10) {
|
} else if (capacity == 10) {
|
||||||
return {'top': 4, 'bottom': 4, 'left': 1, 'right': 1};
|
return {'top': 4, 'bottom': 4, 'left': 1, 'right': 1};
|
||||||
} else {
|
} else {
|
||||||
int side = (capacity / 4).floor();
|
int side = ((capacity - 2) / 2).floor();
|
||||||
return {'top': side, 'bottom': side, 'left': 1, 'right': 1};
|
return {'top': side, 'bottom': side, 'left': 1, 'right': 1};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,14 +83,22 @@ class TableWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 120,
|
width: (table.capacity ?? 0) > 16
|
||||||
|
? 240
|
||||||
|
: (table.capacity ?? 0) > 8
|
||||||
|
? 180
|
||||||
|
: 120,
|
||||||
height: 80,
|
height: 80,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
// Meja utama
|
// Meja utama
|
||||||
Container(
|
Container(
|
||||||
width: 100,
|
width: (table.capacity ?? 0) > 16
|
||||||
|
? 220
|
||||||
|
: (table.capacity ?? 0) > 8
|
||||||
|
? 160
|
||||||
|
: 100,
|
||||||
height: 60,
|
height: 60,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user