const constructure
This commit is contained in:
parent
5058f99fe0
commit
e625bd3d2a
@ -4,6 +4,9 @@ linter:
|
||||
rules:
|
||||
sort_pub_dependencies: false
|
||||
prefer_relative_imports: true
|
||||
prefer_const_constructors: true
|
||||
prefer_const_literals_to_create_immutables: true
|
||||
prefer_const_declarations: true
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
|
||||
@ -33,16 +33,16 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
state.copyWith(
|
||||
failureOption: optionOf(f),
|
||||
status: token
|
||||
? AuthStatus.authenticated()
|
||||
: AuthStatus.unauthenticated(),
|
||||
? const AuthStatus.authenticated()
|
||||
: const AuthStatus.unauthenticated(),
|
||||
),
|
||||
),
|
||||
(user) => emit(
|
||||
state.copyWith(
|
||||
user: user,
|
||||
status: token
|
||||
? AuthStatus.authenticated()
|
||||
: AuthStatus.unauthenticated(),
|
||||
? const AuthStatus.authenticated()
|
||||
: const AuthStatus.unauthenticated(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -175,7 +175,7 @@ class CategoryLoaderBloc
|
||||
_searchDebounce?.cancel();
|
||||
|
||||
// Debounce search for better UX
|
||||
_searchDebounce = Timer(Duration(milliseconds: 300), () async {
|
||||
_searchDebounce = Timer(const Duration(milliseconds: 300), () async {
|
||||
emit(state.copyWith(isLoadingMore: true));
|
||||
_isLoadingMore = false;
|
||||
|
||||
@ -237,7 +237,7 @@ class CategoryLoaderBloc
|
||||
);
|
||||
|
||||
// After sync error, try to load local data
|
||||
Timer(Duration(seconds: 2), () {
|
||||
Timer(const Duration(seconds: 2), () {
|
||||
add(const CategoryLoaderEvent.getCategories());
|
||||
});
|
||||
},
|
||||
@ -251,7 +251,7 @@ class CategoryLoaderBloc
|
||||
);
|
||||
|
||||
// After successful sync, load the updated data
|
||||
Timer(Duration(seconds: 1), () {
|
||||
Timer(const Duration(seconds: 1), () {
|
||||
add(const CategoryLoaderEvent.getCategories());
|
||||
});
|
||||
},
|
||||
|
||||
@ -43,7 +43,7 @@ class ProductLoaderBloc extends Bloc<ProductLoaderEvent, ProductLoaderState> {
|
||||
state.copyWith(
|
||||
isLoadingMore: false,
|
||||
failureOptionProduct: optionOf(
|
||||
ProductFailure.dynamicErrorMessage(
|
||||
const ProductFailure.dynamicErrorMessage(
|
||||
'Database lokal belum siap. Silakan lakukan sinkronisasi data terlebih dahulu.',
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
part of 'theme.dart';
|
||||
|
||||
class AppStyle {
|
||||
static TextStyle xs = TextStyle(color: AppColor.black, fontSize: 11);
|
||||
static TextStyle xs = const TextStyle(color: AppColor.black, fontSize: 11);
|
||||
|
||||
static TextStyle sm = TextStyle(color: AppColor.black, fontSize: 12);
|
||||
static TextStyle sm = const TextStyle(color: AppColor.black, fontSize: 12);
|
||||
|
||||
static TextStyle md = TextStyle(color: AppColor.black, fontSize: 14);
|
||||
static TextStyle md = const TextStyle(color: AppColor.black, fontSize: 14);
|
||||
|
||||
static TextStyle lg = TextStyle(color: AppColor.black, fontSize: 16);
|
||||
static TextStyle lg = const TextStyle(color: AppColor.black, fontSize: 16);
|
||||
|
||||
static TextStyle xl = TextStyle(color: AppColor.black, fontSize: 18);
|
||||
static TextStyle xl = const TextStyle(color: AppColor.black, fontSize: 18);
|
||||
|
||||
static TextStyle xxl = TextStyle(color: AppColor.black, fontSize: 20);
|
||||
static TextStyle xxl = const TextStyle(color: AppColor.black, fontSize: 20);
|
||||
|
||||
static TextStyle h6 = TextStyle(color: AppColor.black, fontSize: 22);
|
||||
static TextStyle h6 = const TextStyle(color: AppColor.black, fontSize: 22);
|
||||
|
||||
static TextStyle h5 = TextStyle(color: AppColor.black, fontSize: 24);
|
||||
static TextStyle h5 = const TextStyle(color: AppColor.black, fontSize: 24);
|
||||
|
||||
static TextStyle h4 = TextStyle(color: AppColor.black, fontSize: 26);
|
||||
static TextStyle h4 = const TextStyle(color: AppColor.black, fontSize: 26);
|
||||
|
||||
static TextStyle h3 = TextStyle(color: AppColor.black, fontSize: 28);
|
||||
static TextStyle h3 = const TextStyle(color: AppColor.black, fontSize: 28);
|
||||
|
||||
static TextStyle h2 = TextStyle(color: AppColor.black, fontSize: 30);
|
||||
static TextStyle h2 = const TextStyle(color: AppColor.black, fontSize: 30);
|
||||
|
||||
static TextStyle h1 = TextStyle(color: AppColor.black, fontSize: 32);
|
||||
static TextStyle h1 = const TextStyle(color: AppColor.black, fontSize: 32);
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
part of 'theme.dart';
|
||||
|
||||
class AppValue {
|
||||
// TODO: define value
|
||||
}
|
||||
class AppValue {}
|
||||
|
||||
@ -11,7 +11,7 @@ class ThemeApp {
|
||||
useMaterial3: true,
|
||||
primaryColor: AppColor.primary,
|
||||
scaffoldBackgroundColor: AppColor.white,
|
||||
appBarTheme: AppBarTheme(
|
||||
appBarTheme: const AppBarTheme(
|
||||
color: AppColor.white,
|
||||
elevation: 0,
|
||||
titleTextStyle: TextStyle(
|
||||
@ -19,7 +19,7 @@ class ThemeApp {
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
iconTheme: const IconThemeData(color: AppColor.primary),
|
||||
iconTheme: IconThemeData(color: AppColor.primary),
|
||||
),
|
||||
fontFamily: FontFamily.quicksand,
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.primary),
|
||||
@ -28,19 +28,19 @@ class ThemeApp {
|
||||
hintStyle: const TextStyle(color: AppColor.textSecondary),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.borderDark),
|
||||
borderSide: const BorderSide(color: AppColor.borderDark),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.primary),
|
||||
borderSide: const BorderSide(color: AppColor.primary),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.borderDark),
|
||||
borderSide: const BorderSide(color: AppColor.borderDark),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide(color: AppColor.error),
|
||||
borderSide: const BorderSide(color: AppColor.error),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -89,6 +89,7 @@ class ProductAnalyticCategoryItem with _$ProductAnalyticCategoryItem {
|
||||
required int totalRevenue,
|
||||
}) = _ProductAnalyticCategoryItem;
|
||||
|
||||
// ignore: prefer_const_constructors
|
||||
factory ProductAnalyticCategoryItem.empty() => ProductAnalyticCategoryItem(
|
||||
categoryName: '',
|
||||
productCount: 0,
|
||||
|
||||
@ -10,8 +10,8 @@ class ListCustomer with _$ListCustomer {
|
||||
required int totalPages,
|
||||
}) = _ListCustomer;
|
||||
|
||||
factory ListCustomer.empty() => ListCustomer(
|
||||
customers: const [],
|
||||
factory ListCustomer.empty() => const ListCustomer(
|
||||
customers: [],
|
||||
totalCount: 0,
|
||||
page: 0,
|
||||
limit: 0,
|
||||
|
||||
@ -10,7 +10,7 @@ class AddItemOrderRequest with _$AddItemOrderRequest {
|
||||
required String notes,
|
||||
}) = _AddItemOrderRequest;
|
||||
|
||||
factory AddItemOrderRequest.empty() => AddItemOrderRequest(
|
||||
factory AddItemOrderRequest.empty() => const AddItemOrderRequest(
|
||||
productId: '',
|
||||
productVariantId: '',
|
||||
quantity: 0,
|
||||
|
||||
@ -10,8 +10,13 @@ class ListOrder with _$ListOrder {
|
||||
required int totalPages,
|
||||
}) = _ListOrder;
|
||||
|
||||
factory ListOrder.empty() =>
|
||||
ListOrder(orders: [], totalCount: 0, page: 0, limit: 0, totalPages: 0);
|
||||
factory ListOrder.empty() => const ListOrder(
|
||||
orders: [],
|
||||
totalCount: 0,
|
||||
page: 0,
|
||||
limit: 0,
|
||||
totalPages: 0,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
|
||||
@ -10,7 +10,7 @@ class ListPaymentMethod with _$ListPaymentMethod {
|
||||
required int totalPages,
|
||||
}) = _ListPaymentMethod;
|
||||
|
||||
factory ListPaymentMethod.empty() => ListPaymentMethod(
|
||||
factory ListPaymentMethod.empty() => const ListPaymentMethod(
|
||||
paymentMethods: [],
|
||||
totalCount: 0,
|
||||
page: 0,
|
||||
|
||||
@ -10,8 +10,13 @@ class ListTable with _$ListTable {
|
||||
required int totalPages,
|
||||
}) = _ListTable;
|
||||
|
||||
factory ListTable.empty() =>
|
||||
ListTable(tables: [], totalCount: 0, page: 0, limit: 0, totalPages: 0);
|
||||
factory ListTable.empty() => const ListTable(
|
||||
tables: [],
|
||||
totalCount: 0,
|
||||
page: 0,
|
||||
limit: 0,
|
||||
totalPages: 0,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
|
||||
@ -36,7 +36,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final dashboard = DashboardAnalyticDto.fromJson(
|
||||
@ -65,7 +65,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final sales = SalesAnalyticDto.fromJson(
|
||||
@ -94,7 +94,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final products = ProductAnalyticDto.fromJson(
|
||||
@ -123,7 +123,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final paymentMethods = PaymentMethodAnalyticDto.fromJson(
|
||||
@ -152,7 +152,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final profitLoss = ProfitLossAnalyticDto.fromJson(
|
||||
@ -181,7 +181,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final categories = CategoryAnalyticDto.fromJson(
|
||||
@ -211,7 +211,7 @@ class AnalyticRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AnalyticFailure.unexpectedError());
|
||||
return DC.error(const AnalyticFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final inventory = InventoryAnalyticDto.fromJson(
|
||||
|
||||
@ -30,7 +30,7 @@ class AuthRemoteDataProvider {
|
||||
|
||||
if (response.data['code'] == 401) {
|
||||
return DC.error(
|
||||
AuthFailure.serverError(
|
||||
const AuthFailure.serverError(
|
||||
ApiFailure.unauthorized('Incorrect email or password'),
|
||||
),
|
||||
);
|
||||
@ -52,7 +52,7 @@ class AuthRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(AuthFailure.unexpectedError());
|
||||
return DC.error(const AuthFailure.unexpectedError());
|
||||
}
|
||||
|
||||
return DC.data(unit);
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
|
||||
part of '../auth_dtos.dart';
|
||||
|
||||
@freezed
|
||||
|
||||
@ -17,7 +17,9 @@ class CategoryLocalDataProvider {
|
||||
CategoryLocalDataProvider(this._databaseHelper);
|
||||
|
||||
final Map<String, List<CategoryDto>> _queryCache = {};
|
||||
final Duration _cacheExpiry = Duration(minutes: AppConstant.cacheExpire);
|
||||
final Duration _cacheExpiry = const Duration(
|
||||
minutes: AppConstant.cacheExpire,
|
||||
);
|
||||
final Map<String, DateTime> _cacheTimestamps = {};
|
||||
|
||||
Future<DC<CategoryFailure, void>> saveCategoriesBatch(
|
||||
@ -203,7 +205,7 @@ class CategoryLocalDataProvider {
|
||||
|
||||
if (maps.isEmpty) {
|
||||
log('❌ Category not found: $id', name: _logName);
|
||||
return DC.error(CategoryFailure.empty());
|
||||
return DC.error(const CategoryFailure.empty());
|
||||
}
|
||||
|
||||
final category = CategoryDto.fromMap(maps.first);
|
||||
|
||||
@ -29,7 +29,7 @@ class CategoryRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['data'] == null) {
|
||||
return DC.error(CategoryFailure.empty());
|
||||
return DC.error(const CategoryFailure.empty());
|
||||
}
|
||||
|
||||
final categories = ListCategoryDto.fromJson(
|
||||
|
||||
@ -29,7 +29,7 @@ class CustomerRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(CustomerFailure.unexpectedError());
|
||||
return DC.error(const CustomerFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final customers = ListCustomerDto.fromJson(
|
||||
|
||||
@ -46,7 +46,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final orders = ListOrderDto.fromJson(
|
||||
@ -68,7 +68,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final order = OrderDto.fromJson(
|
||||
@ -93,7 +93,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final order = OrderDto.fromJson(
|
||||
@ -119,7 +119,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
} else {
|
||||
final order = OrderDto.fromJson(
|
||||
response.data['data'] as Map<String, dynamic>,
|
||||
@ -161,7 +161,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final payment = PaymentDto.fromJson(
|
||||
@ -190,7 +190,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final order = OrderDto.fromJson(
|
||||
@ -227,7 +227,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
return DC.data(unit);
|
||||
@ -249,7 +249,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final payment = PaymentDto.fromJson(
|
||||
@ -276,7 +276,7 @@ class OrderRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(OrderFailure.unexpectedError());
|
||||
return DC.error(const OrderFailure.unexpectedError());
|
||||
}
|
||||
|
||||
return DC.data(unit);
|
||||
|
||||
@ -29,7 +29,7 @@ class OutletRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['data'] == null) {
|
||||
return DC.error(OutletFailure.empty());
|
||||
return DC.error(const OutletFailure.empty());
|
||||
}
|
||||
|
||||
final outlets = (response.data['data']['outlets'] as List)
|
||||
@ -51,7 +51,7 @@ class OutletRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['data'] == null) {
|
||||
return DC.error(OutletFailure.empty());
|
||||
return DC.error(const OutletFailure.empty());
|
||||
}
|
||||
|
||||
final outlet = OutletDto.fromJson(
|
||||
|
||||
@ -29,7 +29,7 @@ class PaymentMethodRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(PaymentMethodFailure.unexpectedError());
|
||||
return DC.error(const PaymentMethodFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final paymentMethods = ListPaymentMethodDto.fromJson(
|
||||
|
||||
@ -26,7 +26,7 @@ class PrinterLocalDataProvider {
|
||||
|
||||
if (printerExist.hasData) {
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Printer Telah Terdaftar'),
|
||||
const PrinterFailure.dynamicErrorMessage('Printer Telah Terdaftar'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ class PrinterLocalDataProvider {
|
||||
log('Error creating printer', name: _logName, error: e);
|
||||
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Error creating printer'),
|
||||
const PrinterFailure.dynamicErrorMessage('Error creating printer'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ class PrinterLocalDataProvider {
|
||||
|
||||
if (updatedRows == 0) {
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Printer not found'),
|
||||
const PrinterFailure.dynamicErrorMessage('Printer not found'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ class PrinterLocalDataProvider {
|
||||
log('Error updating printer', name: _logName, error: e);
|
||||
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Error updating printer'),
|
||||
const PrinterFailure.dynamicErrorMessage('Error updating printer'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ class PrinterLocalDataProvider {
|
||||
|
||||
if (deletedRows == 0) {
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Printer not found'),
|
||||
const PrinterFailure.dynamicErrorMessage('Printer not found'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ class PrinterLocalDataProvider {
|
||||
log('Error deleting printer', name: _logName, error: e);
|
||||
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Error deleting printer'),
|
||||
const PrinterFailure.dynamicErrorMessage('Error deleting printer'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ class PrinterLocalDataProvider {
|
||||
|
||||
if (result.isEmpty) {
|
||||
log('Printer with code $code not found');
|
||||
return DC.error(PrinterFailure.empty());
|
||||
return DC.error(const PrinterFailure.empty());
|
||||
}
|
||||
|
||||
final printer = PrinterDto.fromJson(result.first);
|
||||
@ -133,7 +133,7 @@ class PrinterLocalDataProvider {
|
||||
log('findPrinterByCode', name: _logName, error: e);
|
||||
|
||||
return DC.error(
|
||||
PrinterFailure.dynamicErrorMessage('Error getting printer'),
|
||||
const PrinterFailure.dynamicErrorMessage('Error getting printer'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
);
|
||||
log("Error connecting to Bluetooth printer", name: _logName, error: e);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage(
|
||||
const PrinterFailure.dynamicErrorMessage(
|
||||
'Error connecting to Bluetooth printer',
|
||||
),
|
||||
);
|
||||
@ -102,7 +102,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
} catch (e) {
|
||||
log("Error disconnecting Bluetooth printer", error: e, name: _logName);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage(
|
||||
const PrinterFailure.dynamicErrorMessage(
|
||||
'Error disconnecting Bluetooth printer',
|
||||
),
|
||||
);
|
||||
@ -121,7 +121,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
} catch (e) {
|
||||
log("Error getting paired Bluetooth devices", name: _logName, error: e);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage(
|
||||
const PrinterFailure.dynamicErrorMessage(
|
||||
'Error getting paired Bluetooth devices',
|
||||
),
|
||||
);
|
||||
@ -137,7 +137,9 @@ class PrinterRepository implements IPrinterRepository {
|
||||
} catch (e) {
|
||||
log("Error checking Bluetooth status", name: _logName, error: e);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage('Error checking Bluetooth status'),
|
||||
const PrinterFailure.dynamicErrorMessage(
|
||||
'Error checking Bluetooth status',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -254,7 +256,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
],
|
||||
);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage(
|
||||
const PrinterFailure.dynamicErrorMessage(
|
||||
'Printer cannot connect to bluetooth, Please connect in printer setting!',
|
||||
),
|
||||
);
|
||||
@ -306,7 +308,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
],
|
||||
);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage('Error printing struct'),
|
||||
const PrinterFailure.dynamicErrorMessage('Error printing struct'),
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -339,7 +341,7 @@ class PrinterRepository implements IPrinterRepository {
|
||||
information: ['Printer: ${printer.name}', 'IP: ${printer.address}'],
|
||||
);
|
||||
return left(
|
||||
PrinterFailure.dynamicErrorMessage('Error printing struct'),
|
||||
const PrinterFailure.dynamicErrorMessage('Error printing struct'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,9 @@ class ProductLocalDataProvider {
|
||||
final _logName = 'ProductLocalDataProvider';
|
||||
|
||||
final Map<String, List<ProductDto>> _queryCache = {};
|
||||
final Duration _cacheExpiry = Duration(minutes: AppConstant.cacheExpire);
|
||||
final Duration _cacheExpiry = const Duration(
|
||||
minutes: AppConstant.cacheExpire,
|
||||
);
|
||||
final Map<String, DateTime> _cacheTimestamps = {};
|
||||
|
||||
ProductLocalDataProvider(this._databaseHelper);
|
||||
@ -281,7 +283,7 @@ class ProductLocalDataProvider {
|
||||
|
||||
if (maps.isEmpty) {
|
||||
log('❌ Product not found: $id', name: _logName);
|
||||
return DC.error(ProductFailure.empty());
|
||||
return DC.error(const ProductFailure.empty());
|
||||
}
|
||||
|
||||
final variants = await _getProductVariants(db, id);
|
||||
|
||||
@ -41,7 +41,7 @@ class ProductRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['data'] == null) {
|
||||
return DC.error(ProductFailure.empty());
|
||||
return DC.error(const ProductFailure.empty());
|
||||
}
|
||||
|
||||
final categories = ListProductDto.fromJson(
|
||||
|
||||
@ -38,7 +38,7 @@ class TableRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['data'] == null) {
|
||||
return DC.error(TableFailure.empty());
|
||||
return DC.error(const TableFailure.empty());
|
||||
}
|
||||
|
||||
final tables = ListTableDto.fromJson(
|
||||
@ -71,7 +71,7 @@ class TableRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(TableFailure.unexpectedError());
|
||||
return DC.error(const TableFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final table = TableDto.fromJson(
|
||||
@ -99,7 +99,7 @@ class TableRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(TableFailure.unexpectedError());
|
||||
return DC.error(const TableFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final table = TableDto.fromJson(
|
||||
@ -124,7 +124,7 @@ class TableRemoteDataProvider {
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(TableFailure.unexpectedError());
|
||||
return DC.error(const TableFailure.unexpectedError());
|
||||
}
|
||||
|
||||
return DC.data(unit);
|
||||
|
||||
@ -10,7 +10,7 @@ class AppIconButton extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
border: Border.all(color: AppColor.border),
|
||||
|
||||
@ -35,7 +35,7 @@ class CustomerCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
const CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: AppColor.primary,
|
||||
child: Icon(Icons.person, color: Colors.white),
|
||||
|
||||
@ -20,21 +20,21 @@ class ErrorCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 48, color: Colors.red.shade400),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||
child: Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.grey.shade600),
|
||||
style: const TextStyle(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
AppElevatedButton.filled(
|
||||
width: 120,
|
||||
onPressed: onTap,
|
||||
|
||||
@ -84,7 +84,7 @@ class OrderCard extends StatelessWidget {
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
const CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: AppColor.primary,
|
||||
child: Icon(Icons.person, color: Colors.white),
|
||||
@ -107,7 +107,7 @@ class OrderCard extends StatelessWidget {
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
const Icon(
|
||||
Icons.table_bar,
|
||||
size: 16,
|
||||
color: AppColor.textSecondary,
|
||||
@ -145,7 +145,7 @@ class OrderCard extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
(order.createdAt).toFormattedDateTime(),
|
||||
style: TextStyle(color: AppColor.black),
|
||||
style: const TextStyle(color: AppColor.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -182,7 +182,7 @@ class OrderCard extends StatelessWidget {
|
||||
),
|
||||
child: Text(
|
||||
(order.status).toUpperCase(),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: AppColor.success,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
@ -199,7 +199,7 @@ class OrderCard extends StatelessWidget {
|
||||
),
|
||||
child: Text(
|
||||
(order.status).toUpperCase(),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
|
||||
@ -50,7 +50,7 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
|
||||
child: AppNetworkImage(
|
||||
url: widget.data.product.imageUrl,
|
||||
width: 50.0,
|
||||
@ -150,7 +150,7 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(8.0),
|
||||
const SpaceHeight(8.0),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
@ -160,7 +160,9 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
cursorColor: AppColor.primary,
|
||||
controller: _controller,
|
||||
style: const TextStyle(fontSize: 12, color: AppColor.black),
|
||||
decoration: InputDecoration(hintText: 'Catatan Pesanan'),
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Catatan Pesanan',
|
||||
),
|
||||
),
|
||||
),
|
||||
const SpaceWidth(16.0),
|
||||
@ -180,7 +182,10 @@ class _OrderMenuState extends State<OrderMenu> {
|
||||
color: AppColor.primary,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
child: Icon(Icons.delete_outline, color: AppColor.white),
|
||||
child: const Icon(
|
||||
Icons.delete_outline,
|
||||
color: AppColor.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -13,7 +13,7 @@ class OutletCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
||||
margin: EdgeInsets.only(bottom: 12),
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColor.primary.withOpacity(0.1) : AppColor.white,
|
||||
border: Border.all(color: AppColor.primary),
|
||||
@ -21,8 +21,8 @@ class OutletCard extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.store, color: AppColor.primary),
|
||||
SpaceWidth(12),
|
||||
const Icon(Icons.store, color: AppColor.primary),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@ -28,7 +28,7 @@ class PaymentCard extends StatelessWidget {
|
||||
),
|
||||
checkmarkColor: AppColor.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: AppColor.primary),
|
||||
side: const BorderSide(color: AppColor.primary),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
|
||||
@ -44,7 +44,7 @@ class ProductCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
|
||||
child: product.imageUrl == ""
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
@ -71,7 +71,7 @@ class ProductCard extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
@ -82,7 +82,7 @@ class ProductCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -126,7 +126,7 @@ class ProductCard extends StatelessWidget {
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
|
||||
color: AppColor.disabled.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
|
||||
@ -45,7 +45,7 @@ class CustomModalDialog extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
@ -74,9 +74,9 @@ class CustomModalDialog extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
IconButton(
|
||||
icon: Icon(Icons.close, color: AppColor.white),
|
||||
icon: const Icon(Icons.close, color: AppColor.white),
|
||||
onPressed: () {
|
||||
if (onClose != null) {
|
||||
onClose!();
|
||||
|
||||
@ -68,7 +68,7 @@ class _DeliveryDialogState extends State<DeliveryDialog> {
|
||||
height: 40.0,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
SpaceWidth(12.0),
|
||||
const SpaceWidth(12.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
delivery.name,
|
||||
@ -83,7 +83,7 @@ class _DeliveryDialogState extends State<DeliveryDialog> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12.0),
|
||||
const SpaceWidth(12.0),
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: selectedType?.id == delivery.id
|
||||
|
||||
@ -17,7 +17,7 @@ class LogoutModalDialog extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
return CustomModalDialog(
|
||||
title: 'Konfirmasi',
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
bottom: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
@ -28,7 +28,7 @@ class LogoutModalDialog extends StatelessWidget {
|
||||
label: 'Batal',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
onPressed: state.isLoggingOut
|
||||
|
||||
@ -27,7 +27,7 @@ class _OrderAddItemDialogState extends State<OrderAddItemDialog> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<OrderLoaderBloc>().add(
|
||||
OrderLoaderEvent.fetched(status: 'pending', isRefresh: true),
|
||||
const OrderLoaderEvent.fetched(status: 'pending', isRefresh: true),
|
||||
);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class _OrderAddItemDialogState extends State<OrderAddItemDialog> {
|
||||
BlocBuilder<OrderLoaderBloc, OrderLoaderState>(
|
||||
builder: (context, state) {
|
||||
if (state.isFetching) {
|
||||
return Center(child: LoaderWithText());
|
||||
return const Center(child: LoaderWithText());
|
||||
}
|
||||
|
||||
final availableOrders = state.orders;
|
||||
@ -258,7 +258,7 @@ class _OrderAddItemDialogState extends State<OrderAddItemDialog> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
BlocBuilder<OrderFormBloc, OrderFormState>(
|
||||
builder: (context, state) {
|
||||
return AppElevatedButton.filled(
|
||||
|
||||
@ -195,7 +195,7 @@ class OrderPayLaterDialog extends StatelessWidget {
|
||||
Text(
|
||||
searchEntry.isEmpty
|
||||
? "Tidak ada meja tersedia"
|
||||
: "Tidak ditemukan meja dengan '${searchEntry}'",
|
||||
: "Tidak ditemukan meja dengan '$searchEntry'",
|
||||
style: TextStyle(
|
||||
color: Colors.grey.shade600,
|
||||
fontSize: 14,
|
||||
@ -233,7 +233,7 @@ class OrderPayLaterDialog extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
BlocBuilder<OrderFormBloc, OrderFormState>(
|
||||
builder: (context, orderState) {
|
||||
return AppElevatedButton.filled(
|
||||
|
||||
@ -29,7 +29,7 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
minWidth: context.deviceWidth * 0.5,
|
||||
minHeight: context.deviceHeight * 0.8,
|
||||
bottom: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -38,7 +38,7 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
label: 'Batalkan',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
isLoading: state.isCreating,
|
||||
@ -63,7 +63,7 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.textSecondary.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@ -75,7 +75,7 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (checkoutState.items.isNotEmpty) ...[
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@ -87,22 +87,22 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(6),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.list_alt_rounded,
|
||||
color: AppColor.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Item yang akan dipesan:',
|
||||
style: AppStyle.md.copyWith(
|
||||
@ -114,10 +114,10 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 120),
|
||||
constraints: const BoxConstraints(maxHeight: 120),
|
||||
child: Scrollbar(
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 16,
|
||||
@ -125,8 +125,8 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
child: Column(
|
||||
children: checkoutState.items.map((item) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 6),
|
||||
padding: EdgeInsets.all(10),
|
||||
margin: const EdgeInsets.only(bottom: 6),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
@ -134,7 +134,7 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.03),
|
||||
blurRadius: 2,
|
||||
offset: Offset(0, 1),
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -143,12 +143,12 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
Container(
|
||||
width: 6,
|
||||
height: 6,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
@ -172,7 +172,7 @@ class OrderSaveConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
|
||||
@ -39,14 +39,14 @@ class OrderSaveDialog extends StatelessWidget {
|
||||
context.maybePop();
|
||||
|
||||
if (checkoutState.orderType == OrderType.dineIn) {
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => OrderPayLaterDialog(tables: tables),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
@ -56,7 +56,7 @@ class OrderSaveDialog extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
SpaceHeight(16.0),
|
||||
const SpaceHeight(16.0),
|
||||
_item(
|
||||
icon: Icons.shopping_cart_checkout_outlined,
|
||||
title: 'Tambahkan Pesanan',
|
||||
@ -92,7 +92,7 @@ class OrderSaveDialog extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: AppColor.primary, size: 26.0),
|
||||
SpaceWidth(12.0),
|
||||
const SpaceWidth(12.0),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@ -21,7 +21,7 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
return CustomModalDialog(
|
||||
title: 'Konfirmasi Void',
|
||||
subtitle: 'Tindakan ini tidak dapat dibatalkan',
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
bottom: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Row(
|
||||
@ -37,7 +37,7 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
child: AppElevatedButton.filled(
|
||||
onPressed: () {
|
||||
context.read<VoidFormBloc>().add(
|
||||
VoidFormEvent.submitted(),
|
||||
const VoidFormEvent.submitted(),
|
||||
);
|
||||
},
|
||||
label: state.voidType.isAll ? 'Void Pesanan' : 'Void Item',
|
||||
@ -60,7 +60,7 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
|
||||
if (state.voidType.isItem &&
|
||||
state.selectedItemQuantities.isNotEmpty) ...[
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Items section
|
||||
Container(
|
||||
@ -74,22 +74,22 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(6),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.list_alt_rounded,
|
||||
color: AppColor.primary,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Item yang akan divoid:',
|
||||
style: AppStyle.md.copyWith(
|
||||
@ -101,10 +101,10 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 120),
|
||||
constraints: const BoxConstraints(maxHeight: 120),
|
||||
child: Scrollbar(
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 16,
|
||||
@ -117,8 +117,8 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
(item) => item.id == entry.key,
|
||||
);
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 6),
|
||||
padding: EdgeInsets.all(10),
|
||||
margin: const EdgeInsets.only(bottom: 6),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
@ -128,7 +128,7 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
0.03,
|
||||
),
|
||||
blurRadius: 2,
|
||||
offset: Offset(0, 1),
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -137,12 +137,12 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
Container(
|
||||
width: 6,
|
||||
height: 6,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
@ -169,7 +169,7 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
@ -201,11 +201,11 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
// Reason section
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue[50],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@ -215,18 +215,18 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(6),
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.info.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.note_alt_rounded,
|
||||
color: AppColor.info,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -239,7 +239,7 @@ class OrderVoidConfirmDialog extends StatelessWidget {
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
state.voidReason ?? "",
|
||||
style: TextStyle(
|
||||
|
||||
@ -89,7 +89,7 @@ class OrderTypeDialog extends StatelessWidget {
|
||||
? AppColor.white
|
||||
: AppColor.black,
|
||||
),
|
||||
SpaceWidth(12.0),
|
||||
const SpaceWidth(12.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
type['label']!,
|
||||
@ -103,7 +103,7 @@ class OrderTypeDialog extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12.0),
|
||||
const SpaceWidth(12.0),
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: selectedType == type['value']
|
||||
|
||||
@ -12,7 +12,7 @@ class _OutletDialogState extends State<OutletDialog> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<OutletLoaderBloc>().add(
|
||||
OutletLoaderEvent.fetched(isRefresh: true),
|
||||
const OutletLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ class _OutletDialogState extends State<OutletDialog> {
|
||||
child: BlocBuilder<OutletLoaderBloc, OutletLoaderState>(
|
||||
builder: (context, state) {
|
||||
if (state.isFetching) {
|
||||
return LoaderWithText();
|
||||
return const LoaderWithText();
|
||||
}
|
||||
|
||||
return Column(
|
||||
@ -46,8 +46,11 @@ class _OutletDialogState extends State<OutletDialog> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SpaceHeight(24),
|
||||
AppElevatedButton.filled(onPressed: null, label: 'Terapkan'),
|
||||
const SpaceHeight(24),
|
||||
const AppElevatedButton.filled(
|
||||
onPressed: null,
|
||||
label: 'Terapkan',
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@ -13,7 +13,9 @@ class _PrinterBluetoothDialogState extends State<PrinterBluetoothDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
loadPermissionBluetooth();
|
||||
context.read<BluetoothLoaderBloc>().add(BluetoothLoaderEvent.fetched());
|
||||
context.read<BluetoothLoaderBloc>().add(
|
||||
const BluetoothLoaderEvent.fetched(),
|
||||
);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@ -21,13 +23,13 @@ class _PrinterBluetoothDialogState extends State<PrinterBluetoothDialog> {
|
||||
Widget build(BuildContext context) {
|
||||
return CustomModalDialog(
|
||||
title: 'Bluetooth',
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
minHeight: context.deviceHeight * 0.6,
|
||||
minWidth: context.deviceWidth * 0.4,
|
||||
child: BlocBuilder<BluetoothLoaderBloc, BluetoothLoaderState>(
|
||||
builder: (context, state) {
|
||||
if (state.isFetching) {
|
||||
return Center(child: LoaderWithText());
|
||||
return const Center(child: LoaderWithText());
|
||||
}
|
||||
|
||||
if (state.bluetoothDevices.isEmpty) {
|
||||
@ -50,7 +52,7 @@ class _PrinterBluetoothDialogState extends State<PrinterBluetoothDialog> {
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColor.border, width: 1),
|
||||
),
|
||||
@ -66,7 +68,7 @@ class _PrinterBluetoothDialogState extends State<PrinterBluetoothDialog> {
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
item.macAdress,
|
||||
style: AppStyle.sm.copyWith(
|
||||
|
||||
@ -31,7 +31,7 @@ class TableCreateDialog extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
AppTextFormField(
|
||||
label: 'Kapasitas',
|
||||
keyboardType: TextInputType.number,
|
||||
@ -41,7 +41,7 @@ class TableCreateDialog extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
AppElevatedButton.filled(
|
||||
onPressed: () {
|
||||
context.read<TableFormBloc>().add(
|
||||
|
||||
@ -29,7 +29,7 @@ class _TableTransferDialogState extends State<TableTransferDialog> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<TableLoaderBloc>().add(
|
||||
TableLoaderEvent.fetched(isRefresh: true, status: 'available'),
|
||||
const TableLoaderEvent.fetched(isRefresh: true, status: 'available'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class _TableTransferDialogState extends State<TableTransferDialog> {
|
||||
final availableTables = state.tables;
|
||||
|
||||
if (state.isFetching) {
|
||||
return Center(child: const LoaderWithText());
|
||||
return const Center(child: LoaderWithText());
|
||||
}
|
||||
|
||||
if (selectTable == null && availableTables.isNotEmpty) {
|
||||
@ -252,7 +252,7 @@ class _TableTransferDialogState extends State<TableTransferDialog> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
BlocBuilder<TableFormBloc, TableFormState>(
|
||||
builder: (context, state) {
|
||||
return AppElevatedButton.filled(
|
||||
|
||||
@ -10,7 +10,7 @@ class VariantDialog extends StatelessWidget {
|
||||
title: 'Pilih Varian',
|
||||
subtitle: 'Silahkan pilih varian yang sesuai',
|
||||
minWidth: context.deviceWidth * 0.4,
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 12,
|
||||
@ -44,7 +44,7 @@ class VariantDialog extends StatelessWidget {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
variant.priceModifier.currencyFormatRpV2,
|
||||
style: TextStyle(color: AppColor.black),
|
||||
style: const TextStyle(color: AppColor.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -17,7 +17,7 @@ class PaymentMethodErrorStateWidget extends StatelessWidget {
|
||||
message: 'Terjadi Kesalahan saat memuat metode pembayaran',
|
||||
onTap: () {
|
||||
context.read<PaymentMethodLoaderBloc>().add(
|
||||
PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
const PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -26,7 +26,7 @@ class PaymentMethodErrorStateWidget extends StatelessWidget {
|
||||
message: value.erroMessage,
|
||||
onTap: () {
|
||||
context.read<PaymentMethodLoaderBloc>().add(
|
||||
PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
const PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -36,7 +36,7 @@ class PaymentMethodErrorStateWidget extends StatelessWidget {
|
||||
'Metode pembayaran masih kosong, silahkan tambahkan metode pembayaran',
|
||||
onTap: () {
|
||||
context.read<PaymentMethodLoaderBloc>().add(
|
||||
PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
const PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -45,7 +45,7 @@ class PaymentMethodErrorStateWidget extends StatelessWidget {
|
||||
message: 'Terjadi Kesalahan saat memuat metode pembayaran',
|
||||
onTap: () {
|
||||
context.read<PaymentMethodLoaderBloc>().add(
|
||||
PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
const PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -54,7 +54,7 @@ class PaymentMethodErrorStateWidget extends StatelessWidget {
|
||||
message: value.erroMessage,
|
||||
onTap: () {
|
||||
context.read<PaymentMethodLoaderBloc>().add(
|
||||
PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
const PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -63,7 +63,7 @@ class PaymentMethodErrorStateWidget extends StatelessWidget {
|
||||
message: 'Terjadi Kesalahan saat memuat metode pembayaran',
|
||||
onTap: () {
|
||||
context.read<PaymentMethodLoaderBloc>().add(
|
||||
PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
const PaymentMethodLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@ -21,7 +21,7 @@ class _CustomerAutocompleteState extends State<CustomerAutocomplete> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<CustomerLoaderBloc>().add(CustomerLoaderEvent.fetched());
|
||||
context.read<CustomerLoaderBloc>().add(const CustomerLoaderEvent.fetched());
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -18,7 +18,7 @@ class AppDropdownSearch<T> extends StatelessWidget {
|
||||
final bool isRequired;
|
||||
|
||||
const AppDropdownSearch({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.hintText,
|
||||
required this.items,
|
||||
@ -34,7 +34,7 @@ class AppDropdownSearch<T> extends StatelessWidget {
|
||||
this.itemBuilder,
|
||||
this.showSearchBox = true,
|
||||
this.isRequired = false,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -46,14 +46,14 @@ class AppDropdownSearch<T> extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (isRequired)
|
||||
Text(
|
||||
const Text(
|
||||
' *',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
@ -74,7 +74,10 @@ class AppDropdownSearch<T> extends StatelessWidget {
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
hintStyle: TextStyle(color: AppColor.textSecondary, fontSize: 14),
|
||||
hintStyle: const TextStyle(
|
||||
color: AppColor.textSecondary,
|
||||
fontSize: 14,
|
||||
),
|
||||
prefixIcon: Icon(
|
||||
prefixIcon,
|
||||
color: AppColor.textSecondary,
|
||||
@ -82,23 +85,29 @@ class AppDropdownSearch<T> extends StatelessWidget {
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: AppColor.border, width: 1.5),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.border,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: AppColor.border, width: 1.5),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.border,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: AppColor.primary, width: 2),
|
||||
borderSide: const BorderSide(color: AppColor.primary, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: AppColor.error, width: 1.5),
|
||||
borderSide: const BorderSide(color: AppColor.error, width: 1.5),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: AppColor.error, width: 2),
|
||||
borderSide: const BorderSide(color: AppColor.error, width: 2),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
|
||||
@ -64,7 +64,7 @@ class _AppPasswordTextFormFieldState extends State<AppPasswordTextFormField> {
|
||||
prefixIcon: widget.prefixIcon,
|
||||
suffixIcon: isPasswordVisible
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.visibility,
|
||||
color: AppColor.textSecondary,
|
||||
size: 20,
|
||||
@ -78,7 +78,7 @@ class _AppPasswordTextFormFieldState extends State<AppPasswordTextFormField> {
|
||||
},
|
||||
)
|
||||
: IconButton(
|
||||
icon: Icon(
|
||||
icon: const Icon(
|
||||
Icons.visibility_off,
|
||||
color: AppColor.textSecondary,
|
||||
size: 20,
|
||||
|
||||
@ -52,7 +52,10 @@ class AppTextFormField extends StatelessWidget {
|
||||
maxLines: maxLines,
|
||||
validator: validator,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
vertical: 4,
|
||||
horizontal: 12,
|
||||
),
|
||||
prefixIcon: prefixIcon,
|
||||
suffixIcon: suffixIcon,
|
||||
hintText: label,
|
||||
|
||||
@ -12,8 +12,8 @@ class LoaderWithText extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SpinKitFadingCircle(color: AppColor.primary, size: 24),
|
||||
SpaceWidth(10),
|
||||
const SpinKitFadingCircle(color: AppColor.primary, size: 24),
|
||||
const SpaceWidth(10),
|
||||
Text(
|
||||
'Loading...',
|
||||
style: AppStyle.md.copyWith(
|
||||
|
||||
@ -28,7 +28,7 @@ class PageTitle extends StatelessWidget {
|
||||
Container(
|
||||
height: context.deviceHeight * 0.123,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColor.border, width: 1.0),
|
||||
@ -39,13 +39,13 @@ class PageTitle extends StatelessWidget {
|
||||
if (isBack) ...[
|
||||
GestureDetector(
|
||||
onTap: () => context.router.maybePop(),
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.arrow_back,
|
||||
color: AppColor.primary,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
const SpaceWidth(16),
|
||||
],
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
||||
@ -213,16 +213,9 @@ class _DateRangePickerDialogState extends State<_DateRangePickerDialog>
|
||||
// ── Header ──────────────────────────────────────────
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
widget.primaryColor,
|
||||
widget.primaryColor.withOpacity(0.8),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: const BorderRadius.only(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
@ -254,7 +247,7 @@ class _DateRangePickerDialogState extends State<_DateRangePickerDialog>
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
// ── TableCalendar ────────────────────────────
|
||||
Padding(
|
||||
|
||||
@ -27,7 +27,7 @@ class CustomTabBar extends StatelessWidget {
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
labelColor: AppColor.primary,
|
||||
labelStyle: TextStyle(fontWeight: FontWeight.bold),
|
||||
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||
dividerColor: AppColor.border,
|
||||
unselectedLabelColor: AppColor.primary,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../../common/data/report_menu.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
@ -32,7 +31,7 @@ class ReportHeader extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
menu.subtitle,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
|
||||
@ -37,7 +37,7 @@ class ReportSummaryCard extends StatelessWidget {
|
||||
),
|
||||
child: Icon(icon, color: color, size: 22),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -49,7 +49,7 @@ class ReportSummaryCard extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
title,
|
||||
style: AppStyle.sm.copyWith(
|
||||
@ -58,7 +58,7 @@ class ReportSummaryCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
SpaceHeight(2),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
subtitle!,
|
||||
style: AppStyle.sm.copyWith(
|
||||
|
||||
@ -72,15 +72,15 @@ class LoginPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
),
|
||||
),
|
||||
const SpaceHeight(20.0),
|
||||
LoginEmailField(),
|
||||
const LoginEmailField(),
|
||||
const SpaceHeight(12.0),
|
||||
LoginPasswordField(),
|
||||
const LoginPasswordField(),
|
||||
const SpaceHeight(24.0),
|
||||
AppElevatedButton.filled(
|
||||
onPressed: state.isSubmitting
|
||||
? null
|
||||
: () => context.read<LoginFormBloc>().add(
|
||||
LoginFormEvent.submitted(),
|
||||
const LoginFormEvent.submitted(),
|
||||
),
|
||||
textColor: state.isSubmitting
|
||||
? AppColor.primary
|
||||
|
||||
@ -33,7 +33,7 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
(order) {
|
||||
if (context.mounted) {
|
||||
context.read<CheckoutFormBloc>().add(
|
||||
CheckoutFormEvent.started([]),
|
||||
const CheckoutFormEvent.started([]),
|
||||
);
|
||||
context.router.replace(SuccessOrderRoute(order: order));
|
||||
}
|
||||
@ -52,7 +52,7 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
(order) {
|
||||
if (context.mounted) {
|
||||
context.read<CheckoutFormBloc>().add(
|
||||
CheckoutFormEvent.started([]),
|
||||
const CheckoutFormEvent.started([]),
|
||||
);
|
||||
context.router.replace(SuccessOrderRoute(order: order));
|
||||
}
|
||||
@ -70,7 +70,7 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
(f) => AppFlushbar.showOrderFailureToast(context, f),
|
||||
(order) {
|
||||
if (context.mounted) {
|
||||
context.router.replace(SuccessAddItemOrderRoute());
|
||||
context.router.replace(const SuccessAddItemOrderRoute());
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -103,7 +103,7 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
price: price,
|
||||
),
|
||||
),
|
||||
SpaceWidth(2),
|
||||
const SpaceWidth(2),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: CheckoutRightPanel(
|
||||
@ -127,11 +127,16 @@ class CheckoutPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
BlocProvider(
|
||||
create: (context) =>
|
||||
getIt<PaymentMethodLoaderBloc>()
|
||||
..add(PaymentMethodLoaderEvent.fetched(isRefresh: true)),
|
||||
..add(const PaymentMethodLoaderEvent.fetched(isRefresh: true)),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) => getIt<TableLoaderBloc>()
|
||||
..add(TableLoaderEvent.fetched(isRefresh: true, status: 'available')),
|
||||
..add(
|
||||
const TableLoaderEvent.fetched(
|
||||
isRefresh: true,
|
||||
status: 'available',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: this,
|
||||
|
||||
@ -36,7 +36,7 @@ class CheckoutLeftPanel extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
checkoutState.orderType.value,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: AppColor.primary,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
@ -62,7 +62,7 @@ class CheckoutLeftPanel extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SpaceWidth(160),
|
||||
const SpaceWidth(160),
|
||||
SizedBox(
|
||||
width: 50.0,
|
||||
child: Text(
|
||||
@ -95,7 +95,7 @@ class CheckoutLeftPanel extends StatelessWidget {
|
||||
itemCount: checkoutState.items.length,
|
||||
),
|
||||
),
|
||||
DashedDivider(color: AppColor.border),
|
||||
const DashedDivider(color: AppColor.border),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@ -123,7 +123,7 @@ class CheckoutLeftPanel extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SpaceHeight(8.0),
|
||||
DashedDivider(color: AppColor.border),
|
||||
const DashedDivider(color: AppColor.border),
|
||||
const SpaceHeight(8.0),
|
||||
],
|
||||
),
|
||||
@ -168,7 +168,7 @@ class CheckoutLeftPanel extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SpaceHeight(8.0),
|
||||
DashedDivider(color: AppColor.border),
|
||||
const DashedDivider(color: AppColor.border),
|
||||
const SpaceHeight(8.0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
|
||||
@ -67,7 +67,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
builder: (context, orderState) {
|
||||
return Column(
|
||||
children: [
|
||||
PageTitle(
|
||||
const PageTitle(
|
||||
title: 'Pembayaran',
|
||||
isBack: false,
|
||||
subtitle: 'Silahkan lakukan pembayaran',
|
||||
@ -78,7 +78,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
@ -100,7 +100,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
@ -125,7 +125,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
>(
|
||||
builder: (context, state) {
|
||||
if (state.isFetching) {
|
||||
return Center(child: LoaderWithText());
|
||||
return const Center(child: LoaderWithText());
|
||||
}
|
||||
return state.failureOption.fold(
|
||||
() => Wrap(
|
||||
@ -172,7 +172,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
orderState.paymentMethod!.type == 'cash')
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
@ -261,8 +261,8 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border(
|
||||
top: BorderSide(color: AppColor.border, width: 1.0),
|
||||
@ -276,7 +276,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
label: 'Batalkan',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: BlocBuilder<TableLoaderBloc, TableLoaderState>(
|
||||
builder: (context, tableState) {
|
||||
@ -304,7 +304,7 @@ class _CheckoutRightPanelState extends State<CheckoutRightPanel> {
|
||||
},
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
isLoading: orderState.isCreatingWithPayment,
|
||||
|
||||
@ -49,7 +49,7 @@ class _MainPageState extends State<MainPage> {
|
||||
);
|
||||
},
|
||||
child: AutoTabsRouter(
|
||||
routes: [
|
||||
routes: const [
|
||||
HomeRoute(),
|
||||
TableRoute(),
|
||||
ReportRoute(),
|
||||
@ -83,7 +83,7 @@ class _MainPageState extends State<MainPage> {
|
||||
),
|
||||
minExtendedWidth: 56,
|
||||
leading: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Assets.images.logoWhite.image(
|
||||
width: 40,
|
||||
height: 40,
|
||||
@ -103,7 +103,8 @@ class _MainPageState extends State<MainPage> {
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => LogoutModalDialog(),
|
||||
builder: (context) =>
|
||||
const LogoutModalDialog(),
|
||||
);
|
||||
},
|
||||
tooltip: 'Logout',
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import 'package:apskel_pos_flutter_v2/domain/customer/customer.dart';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@ -6,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../application/customer/customer_loader/customer_loader_bloc.dart';
|
||||
import '../../../../../common/extension/extension.dart';
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../../domain/customer/customer.dart';
|
||||
import '../../../../../injection.dart';
|
||||
import '../../../../components/border/dashed_border.dart';
|
||||
import '../../../../components/card/customer_card.dart';
|
||||
@ -32,10 +32,10 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
color: AppColor.white,
|
||||
child: Column(
|
||||
children: [
|
||||
PageTitle(title: 'Daftar Pelanggan'),
|
||||
const PageTitle(title: 'Daftar Pelanggan'),
|
||||
Expanded(
|
||||
child: state.isFetching
|
||||
? Center(child: const LoaderWithText())
|
||||
? const Center(child: LoaderWithText())
|
||||
: state.failureOrOption.fold(
|
||||
() => ListView.builder(
|
||||
itemCount: state.customers.length,
|
||||
@ -91,7 +91,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
const CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: AppColor.primary,
|
||||
child: Icon(
|
||||
@ -102,7 +102,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
state.selectedCustomer?.name ?? "",
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@ -110,7 +110,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
],
|
||||
),
|
||||
),
|
||||
DashedDivider(color: AppColor.border),
|
||||
const DashedDivider(color: AppColor.border),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0,
|
||||
@ -122,7 +122,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'No. Handphone',
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
@ -135,19 +135,19 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
? "-"
|
||||
: state.selectedCustomer?.phone ??
|
||||
"-",
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Email',
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
@ -160,19 +160,19 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
? "-"
|
||||
: state.selectedCustomer?.email ??
|
||||
"-",
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Alamat',
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
@ -187,7 +187,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
.selectedCustomer
|
||||
?.address ??
|
||||
"-",
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@ -216,7 +216,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
message: "Terjadi kesalahan saat memuat pelanggan",
|
||||
onTap: () {
|
||||
context.read<CustomerLoaderBloc>().add(
|
||||
CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
const CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -225,7 +225,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
message: "Pelanggan masih kosong, silahkan tambahkan pelanggan",
|
||||
onTap: () {
|
||||
context.read<CustomerLoaderBloc>().add(
|
||||
CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
const CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -234,7 +234,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
message: "Terjadi kesalahan saat memuat pelanggan",
|
||||
onTap: () {
|
||||
context.read<CustomerLoaderBloc>().add(
|
||||
CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
const CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -243,7 +243,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
message: value.erroMessage,
|
||||
onTap: () {
|
||||
context.read<CustomerLoaderBloc>().add(
|
||||
CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
const CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -252,7 +252,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
message: "Terjadi kesalahan saat memuat pelanggan",
|
||||
onTap: () {
|
||||
context.read<CustomerLoaderBloc>().add(
|
||||
CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
const CustomerLoaderEvent.fetched(isRefresh: true),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -263,7 +263,7 @@ class CustomerPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
Widget wrappedRoute(BuildContext context) => BlocProvider(
|
||||
create: (context) =>
|
||||
getIt<CustomerLoaderBloc>()
|
||||
..add(CustomerLoaderEvent.fetched(isRefresh: true)),
|
||||
..add(const CustomerLoaderEvent.fetched(isRefresh: true)),
|
||||
child: this,
|
||||
);
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ class HomePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Hero(
|
||||
return const Hero(
|
||||
tag: 'confirmation_screen',
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColor.white,
|
||||
@ -41,11 +41,12 @@ class HomePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
BlocProvider(
|
||||
create: (context) =>
|
||||
getIt<CategoryLoaderBloc>()
|
||||
..add(CategoryLoaderEvent.getCategories()),
|
||||
..add(const CategoryLoaderEvent.getCategories()),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) =>
|
||||
getIt<ProductLoaderBloc>()..add(ProductLoaderEvent.getProduct()),
|
||||
getIt<ProductLoaderBloc>()
|
||||
..add(const ProductLoaderEvent.getProduct()),
|
||||
),
|
||||
],
|
||||
child: this,
|
||||
|
||||
@ -35,7 +35,7 @@ class _CategoryTabBarState extends State<CategoryTabBar>
|
||||
if (_tabController.indexIsChanging) {
|
||||
if (_tabController.index == 0) {
|
||||
context.read<ProductLoaderBloc>().add(
|
||||
ProductLoaderEvent.getProduct(),
|
||||
const ProductLoaderEvent.getProduct(),
|
||||
);
|
||||
} else {
|
||||
selectedCategoryId = widget.categories[_tabController.index].id;
|
||||
@ -64,7 +64,7 @@ class _CategoryTabBarState extends State<CategoryTabBar>
|
||||
if (_tabController.indexIsChanging) {
|
||||
if (_tabController.index == 0) {
|
||||
context.read<ProductLoaderBloc>().add(
|
||||
ProductLoaderEvent.getProduct(),
|
||||
const ProductLoaderEvent.getProduct(),
|
||||
);
|
||||
} else {
|
||||
selectedCategoryId = widget.categories[_tabController.index].id;
|
||||
@ -99,7 +99,7 @@ class _CategoryTabBarState extends State<CategoryTabBar>
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
labelColor: AppColor.primary,
|
||||
labelStyle: TextStyle(fontWeight: FontWeight.bold),
|
||||
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||
dividerColor: AppColor.primary,
|
||||
unselectedLabelColor: AppColor.primary,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
|
||||
@ -33,7 +33,9 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
if (notification is ScrollEndNotification &&
|
||||
scrollController.position.extentAfter == 0) {
|
||||
log('📄 Loading more products...');
|
||||
context.read<ProductLoaderBloc>().add(ProductLoaderEvent.loadMore());
|
||||
context.read<ProductLoaderBloc>().add(
|
||||
const ProductLoaderEvent.loadMore(),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -44,7 +46,7 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
return BlocBuilder<CategoryLoaderBloc, CategoryLoaderState>(
|
||||
builder: (context, state) {
|
||||
if (state.isLoadingMore) {
|
||||
return Center(child: LoaderWithText());
|
||||
return const Center(child: LoaderWithText());
|
||||
}
|
||||
return state.failureOptionCategory.fold(
|
||||
() => _buildContent(context, state.categories),
|
||||
@ -53,42 +55,42 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
title: 'Error Kategori',
|
||||
message: 'Terjadi kesalahan saat memuat kategori',
|
||||
onTap: () => context.read<CategoryLoaderBloc>().add(
|
||||
CategoryLoaderEvent.getCategories(),
|
||||
const CategoryLoaderEvent.getCategories(),
|
||||
),
|
||||
),
|
||||
dynamicErrorMessage: (value) => ErrorCard(
|
||||
title: 'Error Kategori',
|
||||
message: value.erroMessage,
|
||||
onTap: () => context.read<CategoryLoaderBloc>().add(
|
||||
CategoryLoaderEvent.getCategories(),
|
||||
const CategoryLoaderEvent.getCategories(),
|
||||
),
|
||||
),
|
||||
localStorageError: (value) => ErrorCard(
|
||||
title: 'Error Kategori',
|
||||
message: value.erroMessage,
|
||||
onTap: () => context.read<CategoryLoaderBloc>().add(
|
||||
CategoryLoaderEvent.getCategories(),
|
||||
const CategoryLoaderEvent.getCategories(),
|
||||
),
|
||||
),
|
||||
serverError: (value) => ErrorCard(
|
||||
title: 'Error Kategori',
|
||||
message: 'Terjadi kesalahan saat memuat kategori',
|
||||
onTap: () => context.read<CategoryLoaderBloc>().add(
|
||||
CategoryLoaderEvent.getCategories(),
|
||||
const CategoryLoaderEvent.getCategories(),
|
||||
),
|
||||
),
|
||||
unexpectedError: (value) => ErrorCard(
|
||||
title: 'Error Kategori',
|
||||
message: 'Terjadi kesalahan saat memuat kategori',
|
||||
onTap: () => context.read<CategoryLoaderBloc>().add(
|
||||
CategoryLoaderEvent.getCategories(),
|
||||
const CategoryLoaderEvent.getCategories(),
|
||||
),
|
||||
),
|
||||
empty: (value) => ErrorCard(
|
||||
title: 'Error Kategori',
|
||||
message: 'Kategori kosong',
|
||||
onTap: () => context.read<CategoryLoaderBloc>().add(
|
||||
CategoryLoaderEvent.getCategories(),
|
||||
const CategoryLoaderEvent.getCategories(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -108,7 +110,7 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
});
|
||||
|
||||
// Fast local search
|
||||
Future.delayed(Duration(milliseconds: 200), () {
|
||||
Future.delayed(const Duration(milliseconds: 200), () {
|
||||
if (value == searchController.text) {
|
||||
log('🔍 Local search: "$value"');
|
||||
context.read<ProductLoaderBloc>().add(
|
||||
@ -139,7 +141,7 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
title: 'Error Produk',
|
||||
message: 'Terjadi kesalahan saat memuat produk',
|
||||
onTap: () => context.read<ProductLoaderBloc>().add(
|
||||
ProductLoaderEvent.getProduct(),
|
||||
const ProductLoaderEvent.getProduct(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -165,7 +167,7 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
children: [
|
||||
if (products.isNotEmpty)
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 0,
|
||||
).copyWith(bottom: 6),
|
||||
@ -175,9 +177,9 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
'${products.length} produk ditemukan',
|
||||
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
if (isLoadingMore)
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
height: 12,
|
||||
child: SpinKitFadingCircle(
|
||||
@ -198,7 +200,7 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.all(16),
|
||||
cacheExtent: 200.0,
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: 180,
|
||||
mainAxisSpacing: 30,
|
||||
crossAxisSpacing: 30,
|
||||
@ -212,7 +214,7 @@ class _HomeLeftPanelState extends State<HomeLeftPanel> {
|
||||
|
||||
if (hasReachedMax && products.isNotEmpty)
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
'Semua produk telah dimuat',
|
||||
style: AppStyle.sm.copyWith(
|
||||
|
||||
@ -37,7 +37,7 @@ class HomeRightPanel extends StatelessWidget {
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
HomeRightTitle(),
|
||||
const HomeRightTitle(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
16.0,
|
||||
@ -54,7 +54,7 @@ class HomeRightPanel extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 130),
|
||||
const SizedBox(width: 130),
|
||||
SizedBox(
|
||||
width: 50.0,
|
||||
child: Text(
|
||||
@ -140,7 +140,7 @@ class HomeRightPanel extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(16.0),
|
||||
const SpaceHeight(16.0),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: AppElevatedButton.filled(
|
||||
@ -164,7 +164,7 @@ class HomeRightPanel extends StatelessWidget {
|
||||
);
|
||||
return;
|
||||
}
|
||||
context.router.push(CheckoutRoute());
|
||||
context.router.push(const CheckoutRoute());
|
||||
},
|
||||
label: 'Lanjutkan Pembayaran',
|
||||
),
|
||||
|
||||
@ -19,9 +19,9 @@ class HomeRightTitle extends StatelessWidget {
|
||||
return BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||
builder: (context, state) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
height: context.deviceHeight * 0.15,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
border: Border(left: BorderSide(color: Colors.white, width: 1.0)),
|
||||
),
|
||||
@ -47,7 +47,7 @@ class HomeRightTitle extends StatelessWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return OrderTypeDialog();
|
||||
return const OrderTypeDialog();
|
||||
},
|
||||
);
|
||||
},
|
||||
@ -66,7 +66,7 @@ class HomeRightTitle extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
OrderType.takeAway => SizedBox.shrink(),
|
||||
OrderType.takeAway => const SizedBox.shrink(),
|
||||
OrderType.delivery => _buildButton(
|
||||
state.delivery == null
|
||||
? 'Pilih Pengiriman'
|
||||
@ -76,12 +76,12 @@ class HomeRightTitle extends StatelessWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DeliveryDialog();
|
||||
return const DeliveryDialog();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
OrderType.freeTable => SizedBox.shrink(),
|
||||
OrderType.freeTable => const SizedBox.shrink(),
|
||||
},
|
||||
],
|
||||
),
|
||||
|
||||
@ -21,7 +21,7 @@ class HomeTitle extends StatelessWidget {
|
||||
horizontal: 16.0,
|
||||
vertical: 0,
|
||||
).copyWith(top: 20),
|
||||
decoration: BoxDecoration(color: AppColor.white),
|
||||
decoration: const BoxDecoration(color: AppColor.white),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -30,7 +30,7 @@ class HomeTitle extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => OutletDialog(),
|
||||
builder: (context) => const OutletDialog(),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -44,8 +44,8 @@ class HomeTitle extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SpaceWidth(2),
|
||||
Icon(
|
||||
const SpaceWidth(2),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: AppColor.primary,
|
||||
size: 18,
|
||||
|
||||
@ -64,9 +64,9 @@ class ReportPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
AppIconButton(icons: Icons.download_outlined, onTap: () {}),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
AppIconButton(
|
||||
icons: Icons.refresh_outlined,
|
||||
onTap: () => onFetched(context, state),
|
||||
|
||||
@ -43,10 +43,10 @@ class ReportCategorySection extends StatelessWidget {
|
||||
endDate: endDate,
|
||||
startDate: startDate,
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
_buildSummary(state),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
@ -56,7 +56,7 @@ class ReportCategorySection extends StatelessWidget {
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.disabled.withOpacity(0.8),
|
||||
borderRadius: BorderRadius.vertical(
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(14),
|
||||
),
|
||||
),
|
||||
@ -113,7 +113,7 @@ class ReportCategorySection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.vertical(
|
||||
bottom: Radius.circular(14),
|
||||
@ -246,7 +246,7 @@ class ReportCategorySection extends StatelessWidget {
|
||||
value: state.categoryAnalytic.totalRevenue.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
@ -255,7 +255,7 @@ class ReportCategorySection extends StatelessWidget {
|
||||
value: "${state.categoryAnalytic.totalQuantity} pcs",
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.primary,
|
||||
|
||||
@ -70,7 +70,7 @@ class ReportDashboardSection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ReportDashboardProductChart(
|
||||
@ -91,7 +91,7 @@ class ReportDashboardSection extends StatelessWidget {
|
||||
data: state.dashboardAnalytic.topProducts,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ReportDashboardOrder(data: state.dashboardAnalytic),
|
||||
@ -139,7 +139,7 @@ class ReportDashboardSection extends StatelessWidget {
|
||||
.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
@ -151,7 +151,7 @@ class ReportDashboardSection extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -166,7 +166,7 @@ class ReportDashboardSection extends StatelessWidget {
|
||||
.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.primary,
|
||||
|
||||
@ -51,7 +51,7 @@ class _ReportInventorySectionState extends State<ReportInventorySection> {
|
||||
return Future.value();
|
||||
},
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
ReportHeader(
|
||||
menu: widget.menu,
|
||||
@ -64,12 +64,12 @@ class _ReportInventorySectionState extends State<ReportInventorySection> {
|
||||
child: Row(
|
||||
children: [
|
||||
_buildTab('Produk', 0),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
_buildTab('Bahan Baku', 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
_selectedTabIndex == 0
|
||||
? ReportInventoryProductTab(
|
||||
@ -98,7 +98,7 @@ class _ReportInventorySectionState extends State<ReportInventorySection> {
|
||||
|
||||
Padding _buildSummary() {
|
||||
return Padding(
|
||||
padding: EdgeInsetsGeometry.only(top: 16),
|
||||
padding: const EdgeInsetsGeometry.only(top: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -110,7 +110,7 @@ class _ReportInventorySectionState extends State<ReportInventorySection> {
|
||||
.toString(),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
@ -120,7 +120,7 @@ class _ReportInventorySectionState extends State<ReportInventorySection> {
|
||||
.toString(),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.primary,
|
||||
|
||||
@ -43,13 +43,13 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
return Future.value();
|
||||
},
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
ReportHeader(menu: menu, endDate: endDate, startDate: startDate),
|
||||
_buildSummary(),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
@ -65,7 +65,7 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
...List.generate(state.paymentMethodAnalytic.data.length, (
|
||||
index,
|
||||
@ -115,10 +115,10 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.primary, width: 1),
|
||||
),
|
||||
child: Icon(Icons.money, color: AppColor.white, size: 20),
|
||||
child: const Icon(Icons.money, color: AppColor.white, size: 20),
|
||||
),
|
||||
|
||||
SpaceWidth(16),
|
||||
const SpaceWidth(16),
|
||||
|
||||
// Payment Method Details
|
||||
Expanded(
|
||||
@ -145,7 +145,7 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@ -167,7 +167,7 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
|
||||
// Progress Bar
|
||||
Container(
|
||||
@ -215,7 +215,7 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
@ -227,7 +227,7 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -242,7 +242,7 @@ class ReportPaymentMethodSection extends StatelessWidget {
|
||||
.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
|
||||
@ -46,7 +46,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
return Future.value();
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
ReportHeader(
|
||||
@ -56,7 +56,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
),
|
||||
Container(
|
||||
height: 90,
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: state.productAnalytic.categories.length,
|
||||
@ -85,7 +85,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
@ -127,7 +127,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
ListView.builder(
|
||||
itemCount: state.productAnalytic.data.length,
|
||||
shrinkWrap: true,
|
||||
@ -172,8 +172,8 @@ class ReportProductSection extends StatelessWidget {
|
||||
|
||||
Widget _buildBottomSummary() {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
decoration: BoxDecoration(color: AppColor.white),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
decoration: const BoxDecoration(color: AppColor.white),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
@ -185,7 +185,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.star, color: AppColor.success, size: 16),
|
||||
const Icon(Icons.star, color: AppColor.success, size: 16),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@ -244,7 +244,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
|
||||
// Product Info
|
||||
Expanded(
|
||||
@ -296,7 +296,7 @@ class ReportProductSection extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(6),
|
||||
const SpaceHeight(6),
|
||||
Row(
|
||||
children: [
|
||||
// Category Badge
|
||||
|
||||
@ -47,7 +47,7 @@ class ReportProfitLossSection extends StatelessWidget {
|
||||
return Future.value();
|
||||
},
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
ReportHeader(menu: menu, endDate: endDate, startDate: startDate),
|
||||
_buildSummary(),
|
||||
@ -63,7 +63,7 @@ class ReportProfitLossSection extends StatelessWidget {
|
||||
data: state.profitLossAnalytic.productData,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: ReportProfitLossBreakdown(
|
||||
@ -111,7 +111,7 @@ class ReportProfitLossSection extends StatelessWidget {
|
||||
.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
@ -124,7 +124,7 @@ class ReportProfitLossSection extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -137,7 +137,7 @@ class ReportProfitLossSection extends StatelessWidget {
|
||||
.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.primary,
|
||||
|
||||
@ -43,12 +43,12 @@ class ReportSalesSection extends StatelessWidget {
|
||||
return Future.value();
|
||||
},
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
ReportHeader(menu: menu, endDate: endDate, startDate: startDate),
|
||||
_buildSummary(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
@ -64,7 +64,7 @@ class ReportSalesSection extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
ListView.builder(
|
||||
itemCount: state.salesAnalytic.sortedDailyData.length,
|
||||
shrinkWrap: true,
|
||||
@ -85,7 +85,7 @@ class ReportSalesSection extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
_buildSummaryFooter(),
|
||||
],
|
||||
),
|
||||
@ -118,7 +118,7 @@ class ReportSalesSection extends StatelessWidget {
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.success,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
@ -127,10 +127,10 @@ class ReportSalesSection extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Kinerja puncak pada ${state.salesAnalytic.highestRevenueDay.date.toSimpleMonthDate()} dengan pendapatan ${state.salesAnalytic.highestRevenueDay.sales.currencyFormatRpV2} (pesanan ${state.salesAnalytic.highestRevenueDay.orders})',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: const Color(0xFF374151),
|
||||
color: Color(0xFF374151),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -159,17 +159,17 @@ class ReportSalesSection extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 60,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
date,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF111827),
|
||||
color: Color(0xFF111827),
|
||||
),
|
||||
),
|
||||
if (isHighest)
|
||||
@ -183,7 +183,7 @@ class ReportSalesSection extends StatelessWidget {
|
||||
color: const Color(0xFF10B981),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'TOP',
|
||||
style: TextStyle(
|
||||
fontSize: 8,
|
||||
@ -203,18 +203,18 @@ class ReportSalesSection extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
sales,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF111827),
|
||||
color: Color(0xFF111827),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
const Text(
|
||||
'Pendapatan',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: const Color(0xFF6B7280),
|
||||
color: Color(0xFF6B7280),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -227,18 +227,18 @@ class ReportSalesSection extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'$orders pesanan',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: const Color(0xFF374151),
|
||||
color: Color(0xFF374151),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$items item',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: const Color(0xFF6B7280),
|
||||
color: Color(0xFF6B7280),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -265,7 +265,7 @@ class ReportSalesSection extends StatelessWidget {
|
||||
state.salesAnalytic.summary.totalSales.currencyFormatRpV2,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.info,
|
||||
@ -276,7 +276,7 @@ class ReportSalesSection extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
ReportSummaryCard(
|
||||
color: AppColor.primary,
|
||||
icon: Icons.attach_money_outlined,
|
||||
|
||||
@ -32,7 +32,7 @@ class ReportDashboardOrder extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(20),
|
||||
const SpaceHeight(20),
|
||||
_buildSummaryItem(
|
||||
'Total Pesanan',
|
||||
'${data.overview.totalOrders}',
|
||||
|
||||
@ -35,7 +35,7 @@ class ReportDashboardProductChart extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
SizedBox(
|
||||
height: 160,
|
||||
child: PieChart(
|
||||
@ -57,7 +57,7 @@ class ReportDashboardProductChart extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
Column(
|
||||
children: data.take(3).map((product) {
|
||||
final index = data.indexOf(product);
|
||||
|
||||
@ -51,7 +51,7 @@ class ReportDashboardSalesChart extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
SizedBox(
|
||||
height: 220,
|
||||
child: LineChart(
|
||||
|
||||
@ -27,7 +27,7 @@ class ReportDashboardTopProduct extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
Column(
|
||||
children: data.map((product) {
|
||||
return Container(
|
||||
@ -50,7 +50,7 @@ class ReportDashboardTopProduct extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SpaceHeight(2),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
product.categoryName,
|
||||
style: AppStyle.sm.copyWith(
|
||||
|
||||
@ -23,7 +23,7 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
value: data.summary.lowStockIngredients.toString(),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.error,
|
||||
@ -32,7 +32,7 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
value: data.summary.zeroStockIngredients.toString(),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.error,
|
||||
@ -44,8 +44,8 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary, // Purple color
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
@ -72,9 +72,9 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(color: AppColor.white),
|
||||
decoration: const BoxDecoration(color: AppColor.white),
|
||||
child: Table(
|
||||
columnWidths: {
|
||||
columnWidths: const {
|
||||
0: FlexColumnWidth(2.5), // Name
|
||||
1: FlexColumnWidth(1), // Stock
|
||||
2: FlexColumnWidth(2), // Masuk
|
||||
@ -91,7 +91,7 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary, // Purple color
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(8),
|
||||
@ -165,7 +165,7 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
Color? textColor,
|
||||
}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
alignment: alignment,
|
||||
child: Text(
|
||||
text,
|
||||
@ -182,7 +182,7 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
|
||||
Widget _buildHeaderCell(String text) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
child: Text(
|
||||
text,
|
||||
style: AppStyle.sm.copyWith(
|
||||
@ -196,7 +196,7 @@ class ReportInventoryIngredientTab extends StatelessWidget {
|
||||
|
||||
Widget _buildTotalCell(String text) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
child: Text(
|
||||
text,
|
||||
style: AppStyle.sm.copyWith(
|
||||
|
||||
@ -23,7 +23,7 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
value: data.summary.lowStockProducts.toString(),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.error,
|
||||
@ -32,7 +32,7 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
value: data.summary.zeroStockProducts.toString(),
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: ReportSummaryCard(
|
||||
color: AppColor.error,
|
||||
@ -44,8 +44,8 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary, // Purple color
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
@ -74,9 +74,9 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(color: AppColor.white),
|
||||
decoration: const BoxDecoration(color: AppColor.white),
|
||||
child: Table(
|
||||
columnWidths: {
|
||||
columnWidths: const {
|
||||
0: FlexColumnWidth(2.5), // Produk
|
||||
1: FlexColumnWidth(2), // Kategori
|
||||
2: FlexColumnWidth(1), // Stock
|
||||
@ -94,7 +94,7 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.primary, // Purple color
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(8),
|
||||
@ -171,7 +171,7 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
Color? textColor,
|
||||
}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
alignment: alignment,
|
||||
child: Text(
|
||||
text,
|
||||
@ -188,7 +188,7 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
|
||||
Widget _buildHeaderCell(String text) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
child: Text(
|
||||
text,
|
||||
style: AppStyle.sm.copyWith(
|
||||
@ -202,7 +202,7 @@ class ReportInventoryProductTab extends StatelessWidget {
|
||||
|
||||
Widget _buildTotalCell(String text) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
child: Text(
|
||||
text,
|
||||
style: AppStyle.sm.copyWith(
|
||||
|
||||
@ -52,12 +52,12 @@ class ReportProfitLossBreakdown extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
'Komponen pembentuk profit',
|
||||
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
SpaceHeight(20),
|
||||
const SpaceHeight(20),
|
||||
|
||||
// Grafik Donut
|
||||
SizedBox(
|
||||
@ -93,7 +93,7 @@ class ReportProfitLossBreakdown extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
// Legenda
|
||||
Column(
|
||||
@ -132,7 +132,7 @@ class ReportProfitLossBreakdown extends StatelessWidget {
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
// Rasio Profitabilitas
|
||||
Container(
|
||||
@ -159,7 +159,7 @@ class ReportProfitLossBreakdown extends StatelessWidget {
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
Text(
|
||||
'${safeRound(data.summary.profitabilityRatio)}%',
|
||||
style: AppStyle.h5.copyWith(
|
||||
@ -167,7 +167,7 @@ class ReportProfitLossBreakdown extends StatelessWidget {
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
'Tingkat Pengembalian Pendapatan',
|
||||
style: AppStyle.xs.copyWith(
|
||||
|
||||
@ -15,7 +15,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
@ -30,7 +30,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
@ -43,7 +43,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
AppColor.info,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: _buildMetricCard(
|
||||
'Keuntungan Rata-rata',
|
||||
@ -53,7 +53,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
AppColor.success,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: _buildMetricCard(
|
||||
'Rasio Biaya',
|
||||
@ -66,7 +66,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
|
||||
// Tabel rincian harian
|
||||
Container(
|
||||
@ -246,7 +246,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(icon, color: color, size: 24),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
Text(
|
||||
value,
|
||||
style: AppStyle.lg.copyWith(
|
||||
@ -254,7 +254,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
@ -263,7 +263,7 @@ class ReportProfitLossMetric extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(2),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
subtitle,
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
@ -28,12 +28,12 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
'Analisis margin keuntungan per produk',
|
||||
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
Column(
|
||||
children: data.take(4).map((product) {
|
||||
return _buildProductItem(product);
|
||||
@ -72,10 +72,10 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
product.productName,
|
||||
style: AppStyle.md.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF0F172A),
|
||||
color: const Color(0xFF0F172A),
|
||||
),
|
||||
),
|
||||
SpaceHeight(2),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
'${product.quantitySold} unit • ${product.categoryName}',
|
||||
style: AppStyle.sm.copyWith(
|
||||
@ -105,7 +105,7 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SpaceHeight(4),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
product.grossProfit.toString().currencyFormatRpV2,
|
||||
style: AppStyle.md.copyWith(
|
||||
@ -118,7 +118,7 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -128,7 +128,7 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
AppColor.info,
|
||||
),
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Expanded(
|
||||
child: _buildProductMetric(
|
||||
'Biaya',
|
||||
@ -136,7 +136,7 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
AppColor.error,
|
||||
),
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Expanded(
|
||||
child: _buildProductMetric(
|
||||
'Laba/Unit',
|
||||
@ -168,7 +168,7 @@ class ReportProfitLossProductProfitability extends StatelessWidget {
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
SpaceHeight(2),
|
||||
const SpaceHeight(2),
|
||||
Text(
|
||||
value.toString().currencyFormatRpV2,
|
||||
style: TextStyle(
|
||||
|
||||
@ -12,7 +12,7 @@ class ReportProfitLossTrendChart extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
|
||||
@ -45,7 +45,7 @@ class ReportMenuCard extends StatelessWidget {
|
||||
menu.title,
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SpaceHeight(4.0),
|
||||
const SpaceHeight(4.0),
|
||||
Text(
|
||||
menu.subtitle,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
|
||||
@ -87,7 +87,7 @@ class _SettingPrinterBarState extends State<SettingPrinterBar> {
|
||||
code: 'bar',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('bar'),
|
||||
const PrinterLoaderEvent.getByCode('bar'),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -105,7 +105,7 @@ class _SettingPrinterBarState extends State<SettingPrinterBar> {
|
||||
},
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('bar'),
|
||||
const PrinterLoaderEvent.getByCode('bar'),
|
||||
);
|
||||
setState(() {
|
||||
isEdit = false;
|
||||
@ -143,7 +143,7 @@ class _SettingPrinterBarState extends State<SettingPrinterBar> {
|
||||
code: 'bar',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('bar'),
|
||||
const PrinterLoaderEvent.getByCode('bar'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@ -87,7 +87,7 @@ class _SettingPrinterCheckerState extends State<SettingPrinterChecker> {
|
||||
code: 'checker',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('checker'),
|
||||
const PrinterLoaderEvent.getByCode('checker'),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -105,7 +105,7 @@ class _SettingPrinterCheckerState extends State<SettingPrinterChecker> {
|
||||
},
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('checker'),
|
||||
const PrinterLoaderEvent.getByCode('checker'),
|
||||
);
|
||||
setState(() {
|
||||
isEdit = false;
|
||||
@ -143,7 +143,7 @@ class _SettingPrinterCheckerState extends State<SettingPrinterChecker> {
|
||||
code: 'checker',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('checker'),
|
||||
const PrinterLoaderEvent.getByCode('checker'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@ -141,7 +141,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
state.type == 'Bluetooth'
|
||||
? SizedBox(
|
||||
width: double.infinity,
|
||||
@ -169,7 +169,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
AppTextFormField(
|
||||
label: 'Nama Printer',
|
||||
controller: _nameController,
|
||||
@ -179,7 +179,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
AppDropdownSearch<String>(
|
||||
label: 'Kertas',
|
||||
hintText: 'Kertas Tipe',
|
||||
@ -192,7 +192,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceHeight(20),
|
||||
const SpaceHeight(20),
|
||||
Row(
|
||||
children: [
|
||||
if (widget.printer != null) ...[
|
||||
@ -202,7 +202,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
label: 'Batal',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
],
|
||||
Expanded(
|
||||
child: AppElevatedButton.outlined(
|
||||
@ -217,7 +217,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
label: 'Test Print',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: AppElevatedButton.filled(
|
||||
onPressed: () {
|
||||
@ -228,7 +228,7 @@ class _SettingPrinterFormState extends State<SettingPrinterForm> {
|
||||
);
|
||||
|
||||
context.read<PrinterFormBloc>().add(
|
||||
PrinterFormEvent.created(),
|
||||
const PrinterFormEvent.created(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -87,7 +87,7 @@ class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
||||
code: 'kitchen',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('kitchen'),
|
||||
const PrinterLoaderEvent.getByCode('kitchen'),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -105,7 +105,7 @@ class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
||||
},
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('kitchen'),
|
||||
const PrinterLoaderEvent.getByCode('kitchen'),
|
||||
);
|
||||
setState(() {
|
||||
isEdit = false;
|
||||
@ -143,7 +143,7 @@ class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
||||
code: 'kitchen',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('kitchen'),
|
||||
const PrinterLoaderEvent.getByCode('kitchen'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@ -87,7 +87,7 @@ class _SettingPrinterReceiptState extends State<SettingPrinterReceipt> {
|
||||
code: 'receipt',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('receipt'),
|
||||
const PrinterLoaderEvent.getByCode('receipt'),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -105,7 +105,7 @@ class _SettingPrinterReceiptState extends State<SettingPrinterReceipt> {
|
||||
},
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('receipt'),
|
||||
const PrinterLoaderEvent.getByCode('receipt'),
|
||||
);
|
||||
setState(() {
|
||||
isEdit = false;
|
||||
@ -143,7 +143,7 @@ class _SettingPrinterReceiptState extends State<SettingPrinterReceipt> {
|
||||
code: 'receipt',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('receipt'),
|
||||
const PrinterLoaderEvent.getByCode('receipt'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@ -87,7 +87,7 @@ class _SettingPrinterTicketState extends State<SettingPrinterTicket> {
|
||||
code: 'ticket',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('ticket'),
|
||||
const PrinterLoaderEvent.getByCode('ticket'),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -105,7 +105,7 @@ class _SettingPrinterTicketState extends State<SettingPrinterTicket> {
|
||||
},
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('ticket'),
|
||||
const PrinterLoaderEvent.getByCode('ticket'),
|
||||
);
|
||||
setState(() {
|
||||
isEdit = false;
|
||||
@ -140,7 +140,7 @@ class _SettingPrinterTicketState extends State<SettingPrinterTicket> {
|
||||
code: 'ticket',
|
||||
onSuccess: () {
|
||||
context.read<PrinterLoaderBloc>().add(
|
||||
PrinterLoaderEvent.getByCode('ticket'),
|
||||
const PrinterLoaderEvent.getByCode('ticket'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@ -13,7 +13,7 @@ class SettingPrinterSection extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
return const Column(
|
||||
children: [
|
||||
PageTitle(
|
||||
isBack: false,
|
||||
|
||||
@ -79,7 +79,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
children: [
|
||||
PageTitle(
|
||||
const PageTitle(
|
||||
title: 'Sinkronisasi',
|
||||
subtitle: 'Sinkronisasi data dengan server',
|
||||
isBack: false,
|
||||
@ -91,11 +91,11 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
_buildQuickActions(context, state),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
_buildSyncTables(context, state),
|
||||
SpaceHeight(24),
|
||||
const SpaceHeight(24),
|
||||
_buildDatabaseStats(context, state),
|
||||
],
|
||||
),
|
||||
@ -123,7 +123,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
'Aksi Cepat',
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -136,7 +136,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
: 'Sync Semua Data',
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: AppElevatedButton.outlined(
|
||||
onPressed: state.isLoading || state.isSyncing
|
||||
@ -168,7 +168,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
'Sinkronisasi per Tabel',
|
||||
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
_buildSyncTableItem(
|
||||
context: context,
|
||||
state: state,
|
||||
@ -184,9 +184,9 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
},
|
||||
onClear: () => _clearCategories(context),
|
||||
),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
const Divider(),
|
||||
SpaceHeight(12),
|
||||
const SpaceHeight(12),
|
||||
_buildSyncTableItem(
|
||||
context: context,
|
||||
state: state,
|
||||
@ -228,7 +228,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
),
|
||||
child: Icon(icon, color: color, size: 24),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
const SpaceWidth(12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -239,7 +239,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
title,
|
||||
style: AppStyle.md.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
@ -278,7 +278,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
foregroundColor: color,
|
||||
),
|
||||
),
|
||||
SpaceWidth(4),
|
||||
const SpaceWidth(4),
|
||||
IconButton(
|
||||
onPressed: state.isLoading || state.isSyncing ? null : onClear,
|
||||
icon: const Icon(Icons.delete_outline, size: 20),
|
||||
@ -320,7 +320,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
),
|
||||
const Spacer(),
|
||||
if (state.isLoading)
|
||||
Center(child: LoaderWithText())
|
||||
const Center(child: LoaderWithText())
|
||||
else
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
@ -333,7 +333,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(16),
|
||||
const SpaceHeight(16),
|
||||
if (state.isLoading)
|
||||
const Center(child: LoaderWithText())
|
||||
else
|
||||
@ -345,28 +345,28 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
Icons.category,
|
||||
Colors.blue,
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
_buildStatRow(
|
||||
'Produk',
|
||||
state.productStats['total_products']?.toString() ?? '0',
|
||||
Icons.inventory_2,
|
||||
Colors.green,
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
_buildStatRow(
|
||||
'Variant',
|
||||
state.productStats['total_variants']?.toString() ?? '0',
|
||||
Icons.tune,
|
||||
Colors.orange,
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
_buildStatRow(
|
||||
'Cache Entries',
|
||||
'$totalCacheEntries',
|
||||
Icons.memory,
|
||||
Colors.purple,
|
||||
),
|
||||
SpaceHeight(8),
|
||||
const SpaceHeight(8),
|
||||
_buildStatRow(
|
||||
'Ukuran Database',
|
||||
'${totalDatabaseSize.toStringAsFixed(2)} MB',
|
||||
@ -384,7 +384,7 @@ class _SettingSyncPageContent extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, size: 16, color: color),
|
||||
SpaceWidth(8),
|
||||
const SpaceWidth(8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
|
||||
@ -25,8 +25,8 @@ class SettingPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: switch (state.index) {
|
||||
0 => SettingPrinterSection(),
|
||||
1 => SettingSyncSection(),
|
||||
0 => const SettingPrinterSection(),
|
||||
1 => const SettingSyncSection(),
|
||||
_ => Container(),
|
||||
},
|
||||
),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user