customer page
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DashedDivider extends StatelessWidget {
|
||||
final double height;
|
||||
final double dashWidth;
|
||||
final double dashSpacing;
|
||||
final Color color;
|
||||
|
||||
const DashedDivider({
|
||||
super.key,
|
||||
this.height = 1,
|
||||
this.dashWidth = 5,
|
||||
this.dashSpacing = 3,
|
||||
this.color = Colors.grey,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final boxWidth = constraints.constrainWidth();
|
||||
final dashCount = (boxWidth / (dashWidth + dashSpacing)).floor();
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: List.generate(dashCount, (_) {
|
||||
return SizedBox(
|
||||
width: dashWidth,
|
||||
height: height,
|
||||
child: DecoratedBox(decoration: BoxDecoration(color: color)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/customer/customer.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).copyWith(bottom: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isActive ? AppColor.primary.withOpacity(0.1) : AppColor.white,
|
||||
border: Border.all(
|
||||
color: isActive ? AppColor.primary : AppColor.border,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: AppColor.primary,
|
||||
child: Icon(Icons.person, color: Colors.white),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
customer.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
customer.email.isNotEmpty ? customer.email : '-',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../spaces/space.dart';
|
||||
|
||||
class PageTitle extends StatelessWidget {
|
||||
final String title;
|
||||
final String? subtitle;
|
||||
final bool isBack;
|
||||
final List<Widget>? actionWidget;
|
||||
const PageTitle({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.isBack = true,
|
||||
this.actionWidget,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: context.deviceHeight * 0.123,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
border: Border(bottom: BorderSide(color: AppColor.border, width: 1.0)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (isBack) ...[
|
||||
GestureDetector(
|
||||
onTap: () => context.maybePop(),
|
||||
child: Icon(Icons.arrow_back, color: AppColor.primary, size: 24),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
],
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: AppStyle.xxl.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 4.0),
|
||||
Text(
|
||||
subtitle!,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (actionWidget != null) ...actionWidget!,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user