feat: setting page and setting product page
This commit is contained in:
parent
445a22a5a4
commit
805673755b
@ -97,7 +97,7 @@ class Button extends StatelessWidget {
|
|||||||
onPressed: disabled ? null : onPressed,
|
onPressed: disabled ? null : onPressed,
|
||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
backgroundColor: color,
|
backgroundColor: color,
|
||||||
side: const BorderSide(color: Colors.grey),
|
side: const BorderSide(color: AppColors.primary),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(borderRadius),
|
borderRadius: BorderRadius.circular(borderRadius),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -32,7 +32,9 @@ class ProductCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ClipRRect(
|
AspectRatio(
|
||||||
|
aspectRatio: 1.2,
|
||||||
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: data.image!.contains('http')
|
imageUrl: data.image!.contains('http')
|
||||||
@ -40,7 +42,7 @@ class ProductCard extends StatelessWidget {
|
|||||||
: '${Variables.baseUrl}/${data.image}',
|
: '${Variables.baseUrl}/${data.image}',
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: context.deviceHeight * 0.18,
|
height: context.deviceHeight * 0.18,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.cover,
|
||||||
errorWidget: (context, url, error) => Container(
|
errorWidget: (context, url, error) => Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: context.deviceHeight * 0.18,
|
height: context.deviceHeight * 0.18,
|
||||||
@ -56,6 +58,7 @@ class ProductCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SpaceHeight(8.0),
|
const SpaceHeight(8.0),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'package:enaklo_pos/core/components/buttons.dart';
|
||||||
|
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/product_remote_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/product_remote_datasource.dart';
|
||||||
@ -27,40 +29,22 @@ class _ProductPageState extends State<ProductPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: ListView(
|
backgroundColor: AppColors.background,
|
||||||
padding: const EdgeInsets.all(24.0),
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
const SettingsTitle('Manage Products'),
|
SettingsTitle(
|
||||||
const SizedBox(height: 24),
|
'Kelola Produk',
|
||||||
BlocBuilder<GetProductsBloc, GetProductsState>(
|
subtitle: 'Kelola produk anda',
|
||||||
builder: (context, state) {
|
actionWidget: [
|
||||||
return state.maybeWhen(orElse: () {
|
Button.outlined(
|
||||||
return const Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}, success: (products) {
|
|
||||||
return GridView.builder(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
childAspectRatio: 1,
|
|
||||||
crossAxisCount: 3,
|
|
||||||
mainAxisSpacing: 12,
|
|
||||||
crossAxisSpacing: 12,
|
|
||||||
),
|
|
||||||
itemCount: products.length + 1,
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const ScrollPhysics(),
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
if (index == 0) {
|
|
||||||
return AddData(
|
|
||||||
title: 'Add New Product',
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MultiBlocProvider(
|
builder: (context) => MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => AddProductBloc(ProductRemoteDatasource()),
|
create: (context) =>
|
||||||
|
AddProductBloc(ProductRemoteDatasource()),
|
||||||
),
|
),
|
||||||
BlocProvider.value(
|
BlocProvider.value(
|
||||||
value: context.read<SyncProductBloc>(),
|
value: context.read<SyncProductBloc>(),
|
||||||
@ -73,9 +57,30 @@ class _ProductPageState extends State<ProductPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
label: "Tambah Produk",
|
||||||
|
icon: Icon(Icons.add, color: AppColors.primary),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: BlocBuilder<GetProductsBloc, GetProductsState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
return state.maybeWhen(orElse: () {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
);
|
);
|
||||||
}
|
}, success: (products) {
|
||||||
final item = products[index - 1];
|
return GridView.builder(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
|
maxCrossAxisExtent: 200,
|
||||||
|
mainAxisSpacing: 30,
|
||||||
|
crossAxisSpacing: 30,
|
||||||
|
childAspectRatio: 0.85,
|
||||||
|
),
|
||||||
|
itemCount: products.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
final item = products[index];
|
||||||
return MenuProductItem(
|
return MenuProductItem(
|
||||||
data: item,
|
data: item,
|
||||||
onTapEdit: () {
|
onTapEdit: () {
|
||||||
@ -84,7 +89,8 @@ class _ProductPageState extends State<ProductPage> {
|
|||||||
builder: (context) => MultiBlocProvider(
|
builder: (context) => MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => UpdateProductBloc(ProductRemoteDatasource()),
|
create: (context) => UpdateProductBloc(
|
||||||
|
ProductRemoteDatasource()),
|
||||||
),
|
),
|
||||||
BlocProvider.value(
|
BlocProvider.value(
|
||||||
value: context.read<SyncProductBloc>(),
|
value: context.read<SyncProductBloc>(),
|
||||||
@ -103,6 +109,7 @@ class _ProductPageState extends State<ProductPage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// floatingActionButton: FloatingActionButton(
|
// floatingActionButton: FloatingActionButton(
|
||||||
|
|||||||
72
lib/presentation/setting/pages/setting_tile.dart
Normal file
72
lib/presentation/setting/pages/setting_tile.dart
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
import 'package:enaklo_pos/core/components/spaces.dart';
|
||||||
|
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SettingTile extends StatelessWidget {
|
||||||
|
final int index;
|
||||||
|
final int currentIndex;
|
||||||
|
final String title;
|
||||||
|
final String subtitle;
|
||||||
|
final IconData icon;
|
||||||
|
final Function() onTap;
|
||||||
|
|
||||||
|
const SettingTile({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
required this.subtitle,
|
||||||
|
required this.icon,
|
||||||
|
required this.onTap,
|
||||||
|
required this.index,
|
||||||
|
required this.currentIndex,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
right: BorderSide(
|
||||||
|
color: currentIndex == index
|
||||||
|
? AppColors.primary
|
||||||
|
: Colors.transparent,
|
||||||
|
width: 4.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
size: 24.0,
|
||||||
|
color: currentIndex == index ? AppColors.primary : AppColors.grey,
|
||||||
|
),
|
||||||
|
const SpaceWidth(12),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4.0),
|
||||||
|
Text(
|
||||||
|
subtitle,
|
||||||
|
style:
|
||||||
|
const TextStyle(fontSize: 14.0, color: AppColors.grey),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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:flutter/material.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/auth_local_datasource.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/sales/pages/sales_page.dart';
|
||||||
import 'package:enaklo_pos/presentation/setting/pages/discount_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/product_page.dart';
|
||||||
import 'package:enaklo_pos/presentation/setting/pages/server_key_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/sync_data_page.dart';
|
||||||
import 'package:enaklo_pos/presentation/setting/pages/tax_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';
|
import '../../../core/constants/colors.dart';
|
||||||
|
|
||||||
class SettingsPage extends StatefulWidget {
|
class SettingsPage extends StatefulWidget {
|
||||||
@ -45,6 +44,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.background,
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
// LEFT CONTENT
|
// LEFT CONTENT
|
||||||
@ -52,106 +52,121 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: ListView(
|
child: Material(
|
||||||
padding: const EdgeInsets.all(16.0),
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Text(
|
const Text(
|
||||||
'Settings',
|
'Pengaturan',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.primary,
|
color: AppColors.black,
|
||||||
fontSize: 28,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SpaceHeight(16.0),
|
Text(
|
||||||
|
'Kelola pengaturan aplikasi',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.grey,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
role != null && role! != 'admin'
|
role != null && role! != 'admin'
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: ListTile(
|
: SettingTile(
|
||||||
contentPadding: const EdgeInsets.all(12.0),
|
index: 0,
|
||||||
leading: Assets.icons.kelolaProduk.svg(),
|
currentIndex: currentIndex,
|
||||||
title: const Text('Manage Products'),
|
title: 'Kelola Produk',
|
||||||
subtitle: const Text('Manage products in your store'),
|
subtitle: 'Kelola produk anda',
|
||||||
textColor: AppColors.primary,
|
icon: Icons.inventory_outlined,
|
||||||
tileColor: currentIndex == 0
|
|
||||||
? AppColors.blueLight
|
|
||||||
: Colors.transparent,
|
|
||||||
onTap: () => indexValue(0),
|
onTap: () => indexValue(0),
|
||||||
),
|
),
|
||||||
ListTile(
|
SettingTile(
|
||||||
contentPadding: const EdgeInsets.all(12.0),
|
index: 1,
|
||||||
leading: Assets.icons.kelolaDiskon.svg(),
|
currentIndex: currentIndex,
|
||||||
title: const Text('Kelola Diskon'),
|
title: 'Kelola Diskon',
|
||||||
subtitle: const Text('Kelola Diskon Pelanggan'),
|
subtitle: 'Kelola diskon pelanggan',
|
||||||
textColor: AppColors.primary,
|
icon: Icons.discount_outlined,
|
||||||
tileColor: currentIndex == 1
|
|
||||||
? AppColors.blueLight
|
|
||||||
: Colors.transparent,
|
|
||||||
onTap: () => indexValue(1),
|
onTap: () => indexValue(1),
|
||||||
),
|
),
|
||||||
ListTile(
|
SettingTile(
|
||||||
contentPadding: const EdgeInsets.all(12.0),
|
index: 2,
|
||||||
leading: Assets.icons.dashboard.svg(),
|
currentIndex: currentIndex,
|
||||||
title: const Text('History Transaksi'),
|
title: 'Riwayat Transaksi',
|
||||||
subtitle: const Text('Lihat history transaksi'),
|
subtitle: 'Lihat riwayat transaksi',
|
||||||
textColor: AppColors.primary,
|
icon: Icons.receipt_long_outlined,
|
||||||
tileColor: currentIndex == 2
|
|
||||||
? AppColors.blueLight
|
|
||||||
: Colors.transparent,
|
|
||||||
onTap: () => indexValue(2),
|
onTap: () => indexValue(2),
|
||||||
),
|
),
|
||||||
ListTile(
|
SettingTile(
|
||||||
contentPadding: const EdgeInsets.all(12.0),
|
index: 3,
|
||||||
leading: Assets.icons.kelolaPajak.svg(),
|
currentIndex: currentIndex,
|
||||||
title: const Text('Perhitungan Biaya'),
|
title: 'Perhitungan Biaya',
|
||||||
subtitle: const Text('Kelola biaya diluar biaya modal'),
|
subtitle: 'Kelola biaya diluar biaya modal',
|
||||||
textColor: AppColors.primary,
|
icon: Icons.attach_money_outlined,
|
||||||
tileColor: currentIndex == 3
|
|
||||||
? AppColors.blueLight
|
|
||||||
: Colors.transparent,
|
|
||||||
onTap: () => indexValue(3),
|
onTap: () => indexValue(3),
|
||||||
),
|
),
|
||||||
ListTile(
|
SettingTile(
|
||||||
contentPadding: const EdgeInsets.all(12.0),
|
index: 4,
|
||||||
leading: Assets.icons.kelolaPajak.svg(),
|
currentIndex: currentIndex,
|
||||||
title: const Text('Sync Data'),
|
title: 'Sinkronisasi Data',
|
||||||
subtitle:
|
subtitle: 'Sinkronisasi data dari dan ke server',
|
||||||
const Text('Sinkronisasi data dari dan ke server'),
|
icon: Icons.sync_outlined,
|
||||||
textColor: AppColors.primary,
|
|
||||||
tileColor: currentIndex == 4
|
|
||||||
? AppColors.blueLight
|
|
||||||
: Colors.transparent,
|
|
||||||
onTap: () => indexValue(4),
|
onTap: () => indexValue(4),
|
||||||
),
|
),
|
||||||
ListTile(
|
SettingTile(
|
||||||
contentPadding: const EdgeInsets.all(12.0),
|
index: 6,
|
||||||
leading: Image.asset(Assets.images.manageQr.path,
|
currentIndex: currentIndex,
|
||||||
fit: BoxFit.contain),
|
title: 'Qr Key Setting',
|
||||||
title: const Text('QR Key Setting'),
|
subtitle: 'Kelola QR Key',
|
||||||
subtitle: const Text('QR Key Configuration'),
|
icon: Icons.qr_code_2_outlined,
|
||||||
textColor: AppColors.primary,
|
|
||||||
tileColor: currentIndex == 6
|
|
||||||
? AppColors.blueLight
|
|
||||||
: Colors.transparent,
|
|
||||||
onTap: () => indexValue(6),
|
onTap: () => indexValue(6),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
// RIGHT CONTENT
|
// RIGHT CONTENT
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: AlignmentDirectional.topStart,
|
alignment: AlignmentDirectional.topStart,
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: IndexedStack(
|
child: IndexedStack(
|
||||||
index: currentIndex,
|
index: currentIndex,
|
||||||
children: [
|
children: [
|
||||||
role != null && role! != 'admin'
|
role != null && role! != 'admin' ? SizedBox() : ProductPage(),
|
||||||
? SizedBox()
|
|
||||||
: ProductPage(),
|
|
||||||
DiscountPage(),
|
DiscountPage(),
|
||||||
SalesPage(),
|
SalesPage(),
|
||||||
TaxPage(),
|
TaxPage(),
|
||||||
@ -166,7 +181,6 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
||||||
|
|
||||||
@ -11,7 +12,221 @@ import '../../../core/constants/variables.dart';
|
|||||||
class MenuProductItem extends StatelessWidget {
|
class MenuProductItem extends StatelessWidget {
|
||||||
final Product data;
|
final Product data;
|
||||||
final Function() onTapEdit;
|
final Function() onTapEdit;
|
||||||
const MenuProductItem({
|
const MenuProductItem(
|
||||||
|
{super.key, required this.data, required this.onTapEdit});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.white,
|
||||||
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0).copyWith(bottom: 0),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: 1.2,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: data.image!.contains('http')
|
||||||
|
? data.image!
|
||||||
|
: '${Variables.baseUrl}/${data.image}',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
errorWidget: (context, url, error) => Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: context.deviceHeight * 0.18,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.grey.withOpacity(0.1),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.image_outlined,
|
||||||
|
color: AppColors.grey,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 8,
|
||||||
|
right: 8,
|
||||||
|
child: Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.primary,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
data.category?.name ?? "",
|
||||||
|
style: const TextStyle(
|
||||||
|
color: AppColors.white,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"${data.name}",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
// backgroundColor: AppColors.white,
|
||||||
|
builder: (context) {
|
||||||
|
//container for product detail
|
||||||
|
return AlertDialog(
|
||||||
|
contentPadding: const EdgeInsets.all(16.0),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
data.name!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SpaceHeight(10.0),
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(10.0)),
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl:
|
||||||
|
'${Variables.baseUrl}${data.image}',
|
||||||
|
placeholder: (context, url) => const Center(
|
||||||
|
child: CircularProgressIndicator()),
|
||||||
|
errorWidget: (context, url, error) =>
|
||||||
|
const Icon(
|
||||||
|
Icons.food_bank_outlined,
|
||||||
|
size: 80,
|
||||||
|
),
|
||||||
|
width: 80,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SpaceHeight(10.0),
|
||||||
|
Text(
|
||||||
|
data.category?.name ?? '-',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SpaceHeight(10.0),
|
||||||
|
Text(
|
||||||
|
data.price.toString(),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SpaceHeight(10.0),
|
||||||
|
Text(
|
||||||
|
data.stock.toString(),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SpaceHeight(10.0),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.primary,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.visibility_outlined,
|
||||||
|
color: AppColors.white,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
color: AppColors.grey.withOpacity(0.2),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: onTapEdit,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.primary,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
bottomRight: Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.edit_outlined,
|
||||||
|
color: AppColors.white,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MenuProductItemOld extends StatelessWidget {
|
||||||
|
final Product data;
|
||||||
|
final Function() onTapEdit;
|
||||||
|
const MenuProductItemOld({
|
||||||
super.key,
|
super.key,
|
||||||
required this.data,
|
required this.data,
|
||||||
required this.onTapEdit,
|
required this.onTapEdit,
|
||||||
|
|||||||
@ -1,35 +1,57 @@
|
|||||||
|
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/components/search_input.dart';
|
import '../../../core/components/search_input.dart';
|
||||||
import '../../../core/constants/colors.dart';
|
import '../../../core/constants/colors.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SettingsTitle extends StatelessWidget {
|
class SettingsTitle extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
|
final String? subtitle;
|
||||||
final TextEditingController? controller;
|
final TextEditingController? controller;
|
||||||
final Function(String value)? onChanged;
|
final Function(String value)? onChanged;
|
||||||
|
final List<Widget>? actionWidget;
|
||||||
|
|
||||||
const SettingsTitle(
|
const SettingsTitle(
|
||||||
this.title, {
|
this.title, {
|
||||||
super.key,
|
super.key,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
|
this.actionWidget,
|
||||||
|
this.subtitle,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Container(
|
||||||
|
height: context.deviceHeight * 0.1,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.white,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.primary,
|
color: AppColors.black,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (subtitle != null)
|
||||||
|
Text(
|
||||||
|
subtitle ?? '',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.grey,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
if (controller != null)
|
if (controller != null)
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 300.0,
|
width: 300.0,
|
||||||
@ -39,7 +61,9 @@ class SettingsTitle extends StatelessWidget {
|
|||||||
hintText: 'Search for food, coffe, etc..',
|
hintText: 'Search for food, coffe, etc..',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (actionWidget != null) ...actionWidget!,
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user