update printer bar

This commit is contained in:
efrilm 2025-11-13 13:04:32 +07:00
parent d3974b8eda
commit d8a28c084d
2 changed files with 128 additions and 113 deletions

View File

@ -201,32 +201,23 @@ class PrintUi {
paperSize: 58,
);
for (final item in order.orderItems) {
bytes += generator.reset();
bytes += builder.header(
outletName: outlet.name,
address: outlet.address,
phoneNumber: outlet.phoneNumber,
);
bytes += builder.printerType(printerType: 'BAR');
bytes += builder.separator();
bytes += builder.printerType(printerType: 'BAR');
bytes += builder.separator();
bytes += builder.dateTime(DateTime.now());
bytes += builder.orderInfo(
orderNumber: order.orderNumber,
customerName: order.metadata['customer_name'] ?? 'John Doe',
cashierName: cashierName,
paymentMethod: order.payments.last.paymentMethodName,
tableNumber: order.tableNumber,
);
bytes += builder.orderType(order.orderType);
bytes += builder.separator();
bytes += builder.emptyLines(1);
for (final item in order.orderItems) {
bytes += builder.orderItem(
productName: item.productName,
quantity: item.quantity,
@ -235,10 +226,10 @@ class PrintUi {
variantName: item.productVariantName,
notes: item.notes,
);
}
bytes += builder.separator();
bytes += builder.footer();
}
return bytes;
}

View File

@ -62,12 +62,21 @@ class _MainPageState extends State<MainPage> {
return Scaffold(
body: Row(
children: [
NavigationRail(
// Bungkus NavigationRail dengan SingleChildScrollView
SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height,
),
child: IntrinsicHeight(
child: NavigationRail(
selectedIndex: tabsRouter.activeIndex,
onDestinationSelected: tabsRouter.setActiveIndex,
labelType: NavigationRailLabelType.none,
backgroundColor: AppColor.primary,
selectedIconTheme: const IconThemeData(color: Colors.white),
selectedIconTheme: const IconThemeData(
color: Colors.white,
),
indicatorColor: AppColor.disabled.withOpacity(0.25),
indicatorShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
@ -104,8 +113,14 @@ class _MainPageState extends State<MainPage> {
),
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.home_outlined, color: AppColor.disabled),
selectedIcon: Icon(Icons.home, color: AppColor.white),
icon: Icon(
Icons.home_outlined,
color: AppColor.disabled,
),
selectedIcon: Icon(
Icons.home,
color: AppColor.white,
),
label: Text('POS'),
padding: EdgeInsets.symmetric(vertical: 8),
),
@ -138,7 +153,10 @@ class _MainPageState extends State<MainPage> {
Icons.person_2_outlined,
color: AppColor.disabled,
),
selectedIcon: Icon(Icons.person_2, color: AppColor.white),
selectedIcon: Icon(
Icons.person_2,
color: AppColor.white,
),
label: Text('Pelanggan'),
padding: EdgeInsets.symmetric(vertical: 8),
),
@ -147,12 +165,18 @@ class _MainPageState extends State<MainPage> {
Icons.settings_outlined,
color: AppColor.disabled,
),
selectedIcon: Icon(Icons.settings, color: AppColor.white),
selectedIcon: Icon(
Icons.settings,
color: AppColor.white,
),
label: Text('Pengaturan'),
padding: EdgeInsets.symmetric(vertical: 8),
),
],
),
),
),
),
const VerticalDivider(thickness: 1, width: 1),
// Main content area
Expanded(child: child),