feat: customer

This commit is contained in:
efrilm
2025-08-03 15:28:27 +07:00
parent 7a195705af
commit 52bedee66d
12 changed files with 1297 additions and 4 deletions
@@ -0,0 +1,65 @@
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/data/models/response/customer_response_model.dart';
import 'package:flutter/material.dart';
class CustomerCard extends StatelessWidget {
final Customer customer;
final bool isActive;
final Function() onTap;
const CustomerCard({
super.key,
required this.customer,
required this.isActive,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color:
isActive ? AppColors.primary.withOpacity(0.1) : AppColors.white,
border: Border.all(
color: isActive ? AppColors.primary : AppColors.stroke),
borderRadius: BorderRadius.circular(8),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
radius: 22,
backgroundColor: AppColors.primary,
child: Icon(Icons.person, color: Colors.white),
),
const SizedBox(width: 12),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
customer.name ?? '',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
],
),
),
],
),
],
),
),
);
}
}
@@ -0,0 +1,113 @@
import 'package:enaklo_pos/core/components/components.dart';
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:flutter/material.dart';
class CustomerTitle extends StatelessWidget {
final String title;
final Function(String) onChanged;
const CustomerTitle(
{super.key,
required this.onChanged,
required this.title});
@override
Widget build(BuildContext context) {
return Column(
children: [
Container(
height: context.deviceHeight * 0.1,
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
decoration: BoxDecoration(
color: AppColors.white,
border: Border(
bottom: BorderSide(
color: AppColors.background,
width: 1.0,
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
onPressed: () => context.pop(),
icon: Icon(Icons.arrow_back, color: AppColors.black),
),
SpaceWidth(16),
Expanded(
child: Text(
title,
style: TextStyle(
color: AppColors.black,
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 12.0,
),
decoration: BoxDecoration(
color: AppColors.white,
border: Border(
bottom: BorderSide(
color: AppColors.background,
width: 1.0,
),
),
),
child: Column(
children: [
Row(
children: [
Expanded(
child: SizedBox(
height: 40,
child: TextFormField(
onChanged: onChanged,
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
),
hintText: 'Cari Customer',
),
),
),
),
SpaceWidth(12),
GestureDetector(
onTap: () => showDialog(
context: context,
builder: (context) => Container(),
),
child: Container(
height: 40,
width: 40,
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: AppColors.primary,
borderRadius: BorderRadius.circular(12),
),
child: Icon(
Icons.add,
color: AppColors.white,
size: 20,
),
),
),
],
),
],
),
),
],
);
}
}