update printer bar
This commit is contained in:
parent
d3974b8eda
commit
d8a28c084d
@ -201,32 +201,23 @@ class PrintUi {
|
|||||||
paperSize: 58,
|
paperSize: 58,
|
||||||
);
|
);
|
||||||
|
|
||||||
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.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.emptyLines(1);
|
|
||||||
|
|
||||||
for (final item in order.orderItems) {
|
for (final item in order.orderItems) {
|
||||||
|
bytes += generator.reset();
|
||||||
|
|
||||||
|
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,
|
||||||
|
tableNumber: order.tableNumber,
|
||||||
|
);
|
||||||
|
|
||||||
|
bytes += builder.separator();
|
||||||
|
bytes += builder.emptyLines(1);
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,96 +62,120 @@ class _MainPageState extends State<MainPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
NavigationRail(
|
// Bungkus NavigationRail dengan SingleChildScrollView
|
||||||
selectedIndex: tabsRouter.activeIndex,
|
SingleChildScrollView(
|
||||||
onDestinationSelected: tabsRouter.setActiveIndex,
|
child: ConstrainedBox(
|
||||||
labelType: NavigationRailLabelType.none,
|
constraints: BoxConstraints(
|
||||||
backgroundColor: AppColor.primary,
|
minHeight: MediaQuery.of(context).size.height,
|
||||||
selectedIconTheme: const IconThemeData(color: Colors.white),
|
|
||||||
indicatorColor: AppColor.disabled.withOpacity(0.25),
|
|
||||||
indicatorShape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
minExtendedWidth: 56,
|
|
||||||
leading: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Assets.images.logoWhite.image(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
),
|
||||||
),
|
child: IntrinsicHeight(
|
||||||
trailing: Expanded(
|
child: NavigationRail(
|
||||||
child: Align(
|
selectedIndex: tabsRouter.activeIndex,
|
||||||
alignment: Alignment.bottomCenter,
|
onDestinationSelected: tabsRouter.setActiveIndex,
|
||||||
child: Padding(
|
labelType: NavigationRailLabelType.none,
|
||||||
padding: const EdgeInsets.only(bottom: 16.0),
|
backgroundColor: AppColor.primary,
|
||||||
child: IconButton(
|
selectedIconTheme: const IconThemeData(
|
||||||
icon: const Icon(
|
color: Colors.white,
|
||||||
Icons.logout,
|
|
||||||
color: AppColor.disabled,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => LogoutModalDialog(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
tooltip: 'Logout',
|
|
||||||
),
|
),
|
||||||
|
indicatorColor: AppColor.disabled.withOpacity(0.25),
|
||||||
|
indicatorShape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
minExtendedWidth: 56,
|
||||||
|
leading: Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Assets.images.logoWhite.image(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
child: IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.logout,
|
||||||
|
color: AppColor.disabled,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => LogoutModalDialog(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tooltip: 'Logout',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
destinations: const [
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.home_outlined,
|
||||||
|
color: AppColor.disabled,
|
||||||
|
),
|
||||||
|
selectedIcon: Icon(
|
||||||
|
Icons.home,
|
||||||
|
color: AppColor.white,
|
||||||
|
),
|
||||||
|
label: Text('POS'),
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.table_bar_outlined,
|
||||||
|
color: AppColor.disabled,
|
||||||
|
),
|
||||||
|
selectedIcon: Icon(
|
||||||
|
Icons.table_bar,
|
||||||
|
color: AppColor.white,
|
||||||
|
),
|
||||||
|
label: Text('Meja'),
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.pie_chart_outline_outlined,
|
||||||
|
color: AppColor.disabled,
|
||||||
|
),
|
||||||
|
selectedIcon: Icon(
|
||||||
|
Icons.pie_chart,
|
||||||
|
color: AppColor.white,
|
||||||
|
),
|
||||||
|
label: Text('Laporan'),
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.person_2_outlined,
|
||||||
|
color: AppColor.disabled,
|
||||||
|
),
|
||||||
|
selectedIcon: Icon(
|
||||||
|
Icons.person_2,
|
||||||
|
color: AppColor.white,
|
||||||
|
),
|
||||||
|
label: Text('Pelanggan'),
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.settings_outlined,
|
||||||
|
color: AppColor.disabled,
|
||||||
|
),
|
||||||
|
selectedIcon: Icon(
|
||||||
|
Icons.settings,
|
||||||
|
color: AppColor.white,
|
||||||
|
),
|
||||||
|
label: Text('Pengaturan'),
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
destinations: const [
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.home_outlined, color: AppColor.disabled),
|
|
||||||
selectedIcon: Icon(Icons.home, color: AppColor.white),
|
|
||||||
label: Text('POS'),
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.table_bar_outlined,
|
|
||||||
color: AppColor.disabled,
|
|
||||||
),
|
|
||||||
selectedIcon: Icon(
|
|
||||||
Icons.table_bar,
|
|
||||||
color: AppColor.white,
|
|
||||||
),
|
|
||||||
label: Text('Meja'),
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.pie_chart_outline_outlined,
|
|
||||||
color: AppColor.disabled,
|
|
||||||
),
|
|
||||||
selectedIcon: Icon(
|
|
||||||
Icons.pie_chart,
|
|
||||||
color: AppColor.white,
|
|
||||||
),
|
|
||||||
label: Text('Laporan'),
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.person_2_outlined,
|
|
||||||
color: AppColor.disabled,
|
|
||||||
),
|
|
||||||
selectedIcon: Icon(Icons.person_2, color: AppColor.white),
|
|
||||||
label: Text('Pelanggan'),
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.settings_outlined,
|
|
||||||
color: AppColor.disabled,
|
|
||||||
),
|
|
||||||
selectedIcon: Icon(Icons.settings, color: AppColor.white),
|
|
||||||
label: Text('Pengaturan'),
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const VerticalDivider(thickness: 1, width: 1),
|
const VerticalDivider(thickness: 1, width: 1),
|
||||||
// Main content area
|
// Main content area
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user