dev #1
@ -168,11 +168,10 @@ class _HomePageState extends State<HomePage> {
|
|||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
gridDelegate:
|
gridDelegate:
|
||||||
SliverGridDelegateWithMaxCrossAxisExtent(
|
SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
maxCrossAxisExtent:
|
maxCrossAxisExtent: 180,
|
||||||
200, // Lebar maksimal tiap item (bisa kamu ubah)
|
|
||||||
mainAxisSpacing: 30,
|
mainAxisSpacing: 30,
|
||||||
crossAxisSpacing: 30,
|
crossAxisSpacing: 30,
|
||||||
childAspectRatio: 0.85,
|
childAspectRatio: 180 / 240,
|
||||||
),
|
),
|
||||||
itemBuilder: (context, index) =>
|
itemBuilder: (context, index) =>
|
||||||
ProductCard(
|
ProductCard(
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class HomeTitle extends StatelessWidget {
|
|||||||
'DEFAULT OUTLET',
|
'DEFAULT OUTLET',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.primary,
|
color: AppColors.primary,
|
||||||
fontSize: 28,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
|||||||
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
|
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
|
||||||
|
|
||||||
import '../../../core/components/spaces.dart';
|
|
||||||
import '../../../core/constants/colors.dart';
|
import '../../../core/constants/colors.dart';
|
||||||
|
|
||||||
class ProductCard extends StatelessWidget {
|
class ProductCard extends StatelessWidget {
|
||||||
@ -27,88 +26,80 @@ class ProductCard extends StatelessWidget {
|
|||||||
context.read<CheckoutBloc>().add(CheckoutEvent.addItem(data));
|
context.read<CheckoutBloc>().add(CheckoutEvent.addItem(data));
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.white,
|
color: AppColors.white,
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: AppColors.disabled,
|
color: AppColors.disabled,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding: const EdgeInsets.all(4.0),
|
||||||
children: [
|
child: Column(
|
||||||
SpaceHeight(8),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Container(
|
children: [
|
||||||
alignment: Alignment.center,
|
ClipRRect(
|
||||||
padding: const EdgeInsets.all(12.0),
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: AppColors.disabled.withOpacity(0.4),
|
|
||||||
),
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(40.0)),
|
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: data.image!.contains('http')
|
imageUrl: data.image!.contains('http')
|
||||||
? data.image!
|
? data.image!
|
||||||
: '${Variables.baseUrl}/${data.image}',
|
: '${Variables.baseUrl}/${data.image}',
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
width: 60,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 120,
|
||||||
errorWidget: (context, url, error) => Container(
|
errorWidget: (context, url, error) => Container(
|
||||||
width: 60,
|
width: double.infinity,
|
||||||
height: 60,
|
height: 120,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: AppColors.disabled.withOpacity(0.4),
|
color: AppColors.disabled.withOpacity(0.4),
|
||||||
),
|
),
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.image_not_supported,
|
Icons.image,
|
||||||
color: AppColors.grey,
|
color: AppColors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Spacer(),
|
||||||
const Spacer(),
|
Text(
|
||||||
Text(
|
"${data.name}",
|
||||||
"${data.name}",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
|
||||||
data.category?.name ?? '-',
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: AppColors.grey,
|
fontWeight: FontWeight.w700,
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
),
|
||||||
maxLines: 2,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
const Spacer(),
|
||||||
const Spacer(),
|
Align(
|
||||||
Align(
|
alignment: Alignment.center,
|
||||||
alignment: Alignment.center,
|
child: Text(
|
||||||
child: Text(
|
data.category?.name ?? '-',
|
||||||
data.price!.toIntegerFromText.currencyFormatRp,
|
style: const TextStyle(
|
||||||
style: const TextStyle(
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
color: AppColors.grey,
|
||||||
fontSize: 13,
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Spacer(),
|
||||||
const Spacer(),
|
Align(
|
||||||
],
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
data.price!.toIntegerFromText.currencyFormatRp,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
BlocBuilder<CheckoutBloc, CheckoutState>(
|
BlocBuilder<CheckoutBloc, CheckoutState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user