const constructure

This commit is contained in:
Efril
2026-03-01 20:02:12 +07:00
parent 5058f99fe0
commit e625bd3d2a
142 changed files with 817 additions and 760 deletions
+4 -3
View File
@@ -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(),
},
),
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../../../../application/printer/printer_bloc.dart';
@@ -17,7 +16,7 @@ class SettingLeftPanel extends StatelessWidget {
color: AppColor.white,
child: Column(
children: [
PageTitle(
const PageTitle(
title: 'Pengaturan',
subtitle: 'Kelola pengaturan aplikasi',
isBack: false,
@@ -33,7 +32,7 @@ class SettingLeftPanel extends StatelessWidget {
subtitle: 'Kelola printer',
icon: Icons.print_outlined,
onTap: () => context.read<PrinterBloc>().add(
PrinterEvent.indexChanged(0),
const PrinterEvent.indexChanged(0),
),
),
SettingTile(
@@ -43,7 +42,7 @@ class SettingLeftPanel extends StatelessWidget {
subtitle: 'Sinkronisasi data',
icon: Icons.sync_outlined,
onTap: () => context.read<PrinterBloc>().add(
PrinterEvent.indexChanged(1),
const PrinterEvent.indexChanged(1),
),
),
],
@@ -55,7 +55,7 @@ class SettingTile extends StatelessWidget {
title,
style: AppStyle.lg.copyWith(fontWeight: FontWeight.bold),
),
SpaceHeight(4.0),
const SpaceHeight(4.0),
Text(
subtitle,
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
@@ -30,7 +30,7 @@ class TablePage extends StatefulWidget implements AutoRouteWrapper {
BlocProvider(
create: (context) =>
getIt<TableLoaderBloc>()
..add(TableLoaderEvent.fetched(isRefresh: true)),
..add(const TableLoaderEvent.fetched(isRefresh: true)),
),
],
child: this,
@@ -94,7 +94,7 @@ class _TablePageState extends State<TablePage>
if (context.mounted) {
context.router.maybePop();
context.read<TableLoaderBloc>().add(
TableLoaderEvent.fetched(isRefresh: true),
const TableLoaderEvent.fetched(isRefresh: true),
);
}
},
@@ -113,7 +113,7 @@ class _TablePageState extends State<TablePage>
if (context.mounted) {
context.router.maybePop();
context.read<TableLoaderBloc>().add(
TableLoaderEvent.fetched(isRefresh: true),
const TableLoaderEvent.fetched(isRefresh: true),
);
}
},
@@ -143,7 +143,7 @@ class _TablePageState extends State<TablePage>
onPressed: () {
showDialog(
context: context,
builder: (context) => TableCreateDialog(),
builder: (context) => const TableCreateDialog(),
);
},
),
@@ -298,7 +298,7 @@ class _TablePageState extends State<TablePage>
onLongPress: () {
if (table.status.isOccupied) {
context.read<TableLoaderBloc>().add(
TableLoaderEvent.setSelectedTable(
const TableLoaderEvent.setSelectedTable(
null,
),
);
@@ -349,7 +349,7 @@ class _TablePageState extends State<TablePage>
position: RelativeRect.fromRect(
tapPosition != null
? Rect.fromLTWH(tapPosition!.dx, tapPosition!.dy, 0, 0)
: Rect.fromLTWH(100, 100, 0, 0),
: const Rect.fromLTWH(100, 100, 0, 0),
Offset.zero & overlay.size,
),
color: AppColor.white,
@@ -363,7 +363,7 @@ class _TablePageState extends State<TablePage>
builder: (context) => TableTransferDialog(fromTable: table),
);
},
child: Row(
child: const Row(
children: [
Icon(Icons.swap_horiz),
SizedBox(width: 8),
@@ -48,9 +48,9 @@ class TableFloatingBottomNavbar extends StatelessWidget {
children: [
const Icon(Icons.table_bar, color: Colors.white, size: 24),
const SizedBox(width: 12),
Text(
const Text(
"1 Meja Dipilih",
style: const TextStyle(
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
@@ -87,7 +87,9 @@ class TableFloatingBottomNavbar extends StatelessWidget {
GestureDetector(
onTap: () {
context.read<TableLoaderBloc>().add(
TableLoaderEvent.setSelectedTable(null),
const TableLoaderEvent.setSelectedTable(
null,
),
);
},
child: const Icon(
@@ -123,7 +125,7 @@ class TableFloatingBottomNavbar extends StatelessWidget {
CheckoutFormEvent.updateTable(selectedTable),
);
context.read<TableLoaderBloc>().add(
TableLoaderEvent.setSelectedTable(null),
const TableLoaderEvent.setSelectedTable(null),
);
context.router.navigate(
const MainRoute(children: [HomeRoute()]),