feat: setting page and setting product page

This commit is contained in:
efrilm
2025-07-31 20:58:10 +07:00
parent 445a22a5a4
commit 805673755b
7 changed files with 538 additions and 203 deletions
+119 -105
View File
@@ -1,15 +1,14 @@
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:enaklo_pos/presentation/setting/pages/setting_tile.dart';
import 'package:flutter/material.dart';
import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
import 'package:enaklo_pos/presentation/sales/pages/sales_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/discount_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/manage_printer_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/product_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/server_key_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/sync_data_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/tax_page.dart';
import '../../../core/assets/assets.gen.dart';
import '../../../core/components/spaces.dart';
import '../../../core/constants/colors.dart';
class SettingsPage extends StatefulWidget {
@@ -45,6 +44,7 @@ class _SettingsPageState extends State<SettingsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
body: Row(
children: [
// LEFT CONTENT
@@ -52,89 +52,108 @@ class _SettingsPageState extends State<SettingsPage> {
flex: 2,
child: Align(
alignment: Alignment.topCenter,
child: ListView(
padding: const EdgeInsets.all(16.0),
children: [
const Text(
'Settings',
style: TextStyle(
color: AppColors.primary,
fontSize: 28,
fontWeight: FontWeight.w600,
),
),
const SpaceHeight(16.0),
role != null && role! != 'admin'
? const SizedBox()
: ListTile(
contentPadding: const EdgeInsets.all(12.0),
leading: Assets.icons.kelolaProduk.svg(),
title: const Text('Manage Products'),
subtitle: const Text('Manage products in your store'),
textColor: AppColors.primary,
tileColor: currentIndex == 0
? AppColors.blueLight
: Colors.transparent,
onTap: () => indexValue(0),
child: Material(
color: AppColors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 12.0,
),
width: double.infinity,
height: context.deviceHeight * 0.1,
decoration: const BoxDecoration(
color: AppColors.white,
border: Border(
bottom: BorderSide(
color: AppColors.background,
width: 1.0,
),
),
ListTile(
contentPadding: const EdgeInsets.all(12.0),
leading: Assets.icons.kelolaDiskon.svg(),
title: const Text('Kelola Diskon'),
subtitle: const Text('Kelola Diskon Pelanggan'),
textColor: AppColors.primary,
tileColor: currentIndex == 1
? AppColors.blueLight
: Colors.transparent,
onTap: () => indexValue(1),
),
ListTile(
contentPadding: const EdgeInsets.all(12.0),
leading: Assets.icons.dashboard.svg(),
title: const Text('History Transaksi'),
subtitle: const Text('Lihat history transaksi'),
textColor: AppColors.primary,
tileColor: currentIndex == 2
? AppColors.blueLight
: Colors.transparent,
onTap: () => indexValue(2),
),
ListTile(
contentPadding: const EdgeInsets.all(12.0),
leading: Assets.icons.kelolaPajak.svg(),
title: const Text('Perhitungan Biaya'),
subtitle: const Text('Kelola biaya diluar biaya modal'),
textColor: AppColors.primary,
tileColor: currentIndex == 3
? AppColors.blueLight
: Colors.transparent,
onTap: () => indexValue(3),
),
ListTile(
contentPadding: const EdgeInsets.all(12.0),
leading: Assets.icons.kelolaPajak.svg(),
title: const Text('Sync Data'),
subtitle:
const Text('Sinkronisasi data dari dan ke server'),
textColor: AppColors.primary,
tileColor: currentIndex == 4
? AppColors.blueLight
: Colors.transparent,
onTap: () => indexValue(4),
),
ListTile(
contentPadding: const EdgeInsets.all(12.0),
leading: Image.asset(Assets.images.manageQr.path,
fit: BoxFit.contain),
title: const Text('QR Key Setting'),
subtitle: const Text('QR Key Configuration'),
textColor: AppColors.primary,
tileColor: currentIndex == 6
? AppColors.blueLight
: Colors.transparent,
onTap: () => indexValue(6),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Pengaturan',
style: TextStyle(
color: AppColors.black,
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
Text(
'Kelola pengaturan aplikasi',
style: TextStyle(
color: AppColors.grey,
fontSize: 14,
),
),
],
),
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
role != null && role! != 'admin'
? const SizedBox()
: SettingTile(
index: 0,
currentIndex: currentIndex,
title: 'Kelola Produk',
subtitle: 'Kelola produk anda',
icon: Icons.inventory_outlined,
onTap: () => indexValue(0),
),
SettingTile(
index: 1,
currentIndex: currentIndex,
title: 'Kelola Diskon',
subtitle: 'Kelola diskon pelanggan',
icon: Icons.discount_outlined,
onTap: () => indexValue(1),
),
SettingTile(
index: 2,
currentIndex: currentIndex,
title: 'Riwayat Transaksi',
subtitle: 'Lihat riwayat transaksi',
icon: Icons.receipt_long_outlined,
onTap: () => indexValue(2),
),
SettingTile(
index: 3,
currentIndex: currentIndex,
title: 'Perhitungan Biaya',
subtitle: 'Kelola biaya diluar biaya modal',
icon: Icons.attach_money_outlined,
onTap: () => indexValue(3),
),
SettingTile(
index: 4,
currentIndex: currentIndex,
title: 'Sinkronisasi Data',
subtitle: 'Sinkronisasi data dari dan ke server',
icon: Icons.sync_outlined,
onTap: () => indexValue(4),
),
SettingTile(
index: 6,
currentIndex: currentIndex,
title: 'Qr Key Setting',
subtitle: 'Kelola QR Key',
icon: Icons.qr_code_2_outlined,
onTap: () => indexValue(6),
),
],
),
),
),
],
),
),
),
),
@@ -144,26 +163,21 @@ class _SettingsPageState extends State<SettingsPage> {
flex: 4,
child: Align(
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: IndexedStack(
index: currentIndex,
children: [
role != null && role! != 'admin'
? SizedBox()
: ProductPage(),
DiscountPage(),
SalesPage(),
TaxPage(),
SyncDataPage(),
ProductPage(),
ServerKeyPage()
// Text('tax'),
// ManageDiscount(),
// ManagePrinterPage(),
// ManageTax(),
],
),
child: IndexedStack(
index: currentIndex,
children: [
role != null && role! != 'admin' ? SizedBox() : ProductPage(),
DiscountPage(),
SalesPage(),
TaxPage(),
SyncDataPage(),
ProductPage(),
ServerKeyPage()
// Text('tax'),
// ManageDiscount(),
// ManagePrinterPage(),
// ManageTax(),
],
),
),
),