update
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../domain/table/table.dart';
|
||||
|
||||
part 'build_context_extension.dart';
|
||||
part 'int_extension.dart';
|
||||
part 'double_extension.dart';
|
||||
part 'string_extension.dart';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
part of 'extension.dart';
|
||||
|
||||
extension StringX on String {
|
||||
TableStatusType toTableStatusType() {
|
||||
switch (this) {
|
||||
case 'available':
|
||||
return TableStatusType.available;
|
||||
case 'occupied':
|
||||
return TableStatusType.occupied;
|
||||
default:
|
||||
return TableStatusType.unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,3 +17,30 @@ Map<String, dynamic> getAuthorizationHeader() {
|
||||
'Bearer ${getIt<SharedPreferences>().getString(LocalStorageKey.token)}',
|
||||
};
|
||||
}
|
||||
|
||||
Map<String, int> getChairDistribution(int capacity) {
|
||||
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};
|
||||
} else if (capacity == 3) {
|
||||
return {'top': 1, 'bottom': 0, 'left': 1, 'right': 1};
|
||||
} else if (capacity == 4) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
return {'top': 4, 'bottom': 4, 'left': 1, 'right': 1};
|
||||
} else {
|
||||
int side = ((capacity - 2) / 2).floor();
|
||||
return {'top': side, 'bottom': side, 'left': 1, 'right': 1};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,5 @@ class ApiPath {
|
||||
static const String outlets = '/api/v1/outlets';
|
||||
static const String categories = '/api/v1/categories';
|
||||
static const String products = '/api/v1/products';
|
||||
static const String tables = '/api/v1/tables';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user