Compare commits
No commits in common. "4ed7721bbe734225c0cfbd7ac3d8cdc5d5c69ee6" and "98b152cbc23c5dcac615e8f00ca141df0e2bf50c" have entirely different histories.
4ed7721bbe
...
98b152cbc2
@ -1,103 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
|
||||||
import '../../../../../../components/card/error_card.dart';
|
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
|
||||||
import '../../widgets/printer_card.dart';
|
|
||||||
import 'setting_printer_form.dart';
|
|
||||||
|
|
||||||
class SettingPrinterBar extends StatefulWidget {
|
|
||||||
const SettingPrinterBar({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<SettingPrinterBar> createState() => _SettingPrinterBarState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SettingPrinterBarState extends State<SettingPrinterBar> {
|
|
||||||
bool isEdit = false;
|
|
||||||
@override
|
|
||||||
initState() {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
const PrinterLoaderEvent.getByCode('bar'),
|
|
||||||
);
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Material(
|
|
||||||
color: AppColor.background,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state.isFetching) {
|
|
||||||
return const Center(child: LoaderWithText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
|
||||||
return SettingPrinterForm(
|
|
||||||
code: 'bar',
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('bar'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.failureOption.fold(
|
|
||||||
() => isEdit
|
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'bar',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('bar'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'bar',
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('bar'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
|
||||||
import '../../../../../../components/card/error_card.dart';
|
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
|
||||||
import '../../widgets/printer_card.dart';
|
|
||||||
import 'setting_printer_form.dart';
|
|
||||||
|
|
||||||
class SettingPrinterKitchen extends StatefulWidget {
|
|
||||||
const SettingPrinterKitchen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<SettingPrinterKitchen> createState() => _SettingPrinterKitchenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
|
||||||
bool isEdit = false;
|
|
||||||
@override
|
|
||||||
initState() {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
const PrinterLoaderEvent.getByCode('kitchen'),
|
|
||||||
);
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Material(
|
|
||||||
color: AppColor.background,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state.isFetching) {
|
|
||||||
return const Center(child: LoaderWithText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
|
||||||
return SettingPrinterForm(
|
|
||||||
code: 'kitchen',
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('kitchen'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.failureOption.fold(
|
|
||||||
() => isEdit
|
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'kitchen',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('kitchen'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'kitchen',
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('kitchen'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
|
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
|
||||||
import '../../../../../../components/card/error_card.dart';
|
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
|
||||||
import '../../widgets/printer_card.dart';
|
|
||||||
import 'setting_printer_form.dart';
|
|
||||||
|
|
||||||
class SettingPrinterTicket extends StatefulWidget {
|
|
||||||
const SettingPrinterTicket({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<SettingPrinterTicket> createState() => _SettingPrinterTicketState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SettingPrinterTicketState extends State<SettingPrinterTicket> {
|
|
||||||
bool isEdit = false;
|
|
||||||
@override
|
|
||||||
initState() {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
const PrinterLoaderEvent.getByCode('ticket'),
|
|
||||||
);
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Material(
|
|
||||||
color: AppColor.background,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state.isFetching) {
|
|
||||||
return const Center(child: LoaderWithText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
|
||||||
return SettingPrinterForm(
|
|
||||||
code: 'ticket',
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('ticket'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.failureOption.fold(
|
|
||||||
() => isEdit
|
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'ticket',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('ticket'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'ticket',
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('ticket'),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,11 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../../../components/page/page_title.dart';
|
import '../../../../../components/page/page_title.dart';
|
||||||
import '../../../../../components/tab/custom_tabbar.dart';
|
import '../../../../../components/tab/custom_tabbar.dart';
|
||||||
import 'printer/setting_printer_bar.dart';
|
|
||||||
import 'printer/setting_printer_checker.dart';
|
import 'printer/setting_printer_checker.dart';
|
||||||
import 'printer/setting_printer_kitchen.dart';
|
|
||||||
import 'printer/setting_printer_receipt.dart';
|
import 'printer/setting_printer_receipt.dart';
|
||||||
import 'printer/setting_printer_ticket.dart';
|
|
||||||
|
|
||||||
class SettingPrinterSection extends StatelessWidget {
|
class SettingPrinterSection extends StatelessWidget {
|
||||||
const SettingPrinterSection({super.key});
|
const SettingPrinterSection({super.key});
|
||||||
@ -32,9 +29,9 @@ class SettingPrinterSection extends StatelessWidget {
|
|||||||
tabViews: [
|
tabViews: [
|
||||||
SettingPrinterReceipt(),
|
SettingPrinterReceipt(),
|
||||||
SettingPrinterChecker(),
|
SettingPrinterChecker(),
|
||||||
SettingPrinterKitchen(),
|
Text('Kitchen Printer'),
|
||||||
SettingPrinterBar(),
|
Text('Bar Printer'),
|
||||||
SettingPrinterTicket(),
|
Text('Tiket Printer'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user