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, paperSize: 58,
); );
for (final item in order.orderItems) {
bytes += generator.reset(); 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.separator();
bytes += builder.printerType(printerType: 'BAR');
bytes += builder.separator();
bytes += builder.dateTime(DateTime.now()); bytes += builder.dateTime(DateTime.now());
bytes += builder.orderInfo( bytes += builder.orderInfo(
orderNumber: order.orderNumber, orderNumber: order.orderNumber,
customerName: order.metadata['customer_name'] ?? 'John Doe', customerName: order.metadata['customer_name'] ?? 'John Doe',
cashierName: cashierName, cashierName: cashierName,
paymentMethod: order.payments.last.paymentMethodName,
tableNumber: order.tableNumber, tableNumber: order.tableNumber,
); );
bytes += builder.orderType(order.orderType); bytes += builder.separator();
bytes += builder.emptyLines(1); bytes += builder.emptyLines(1);
for (final item in order.orderItems) {
bytes += builder.orderItem( bytes += builder.orderItem(
productName: item.productName, productName: item.productName,
quantity: item.quantity, quantity: item.quantity,
@ -235,10 +226,10 @@ class PrintUi {
variantName: item.productVariantName, variantName: item.productVariantName,
notes: item.notes, notes: item.notes,
); );
}
bytes += builder.separator(); bytes += builder.separator();
bytes += builder.footer(); bytes += builder.footer();
}
return bytes; return bytes;
} }

View File

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