update
This commit is contained in:
parent
c41c19b469
commit
6e4b2249b0
17 changed files with 276 additions and 187 deletions
|
|
@ -4,41 +4,99 @@ import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
|||
|
||||
class ConsultationWidget extends StatelessWidget {
|
||||
final String name;
|
||||
// final IconData? icon;
|
||||
final String description;
|
||||
final String contact;
|
||||
final String imagePath;
|
||||
final VoidCallback? onTap;
|
||||
final double? width;
|
||||
// final String? color;
|
||||
final String? color;
|
||||
final double? margin;
|
||||
// final String description;
|
||||
|
||||
const ConsultationWidget({super.key, required this.name, this.onTap, this.width});
|
||||
final List<Color> blue = [
|
||||
const Color.fromRGBO(59, 101, 156, 0.8),
|
||||
const Color.fromRGBO(59, 101, 156, 0.8),
|
||||
const Color.fromRGBO(59, 156, 156, 0.8),
|
||||
];
|
||||
|
||||
final List<Color> green = [
|
||||
const Color.fromRGBO(59, 156, 103, 0.8),
|
||||
const Color.fromRGBO(59, 156, 103, 0.8),
|
||||
const Color.fromRGBO(122, 182, 70, 0.8),
|
||||
];
|
||||
|
||||
final List<Color> red = [
|
||||
const Color.fromRGBO(156, 59, 59, 0.8),
|
||||
const Color.fromRGBO(164, 62, 62, 0.8),
|
||||
const Color.fromRGBO(186, 120, 70, 0.8),
|
||||
];
|
||||
|
||||
final List<Color> yellow = [
|
||||
const Color.fromRGBO(156, 156, 59, 0.8),
|
||||
const Color.fromRGBO(156, 156, 59, 0.8),
|
||||
const Color.fromRGBO(104, 156, 59, 0.8),
|
||||
];
|
||||
|
||||
final List<Color> pink = [
|
||||
const Color.fromRGBO(130, 59, 156, 0.8),
|
||||
const Color.fromRGBO(130, 59, 156, 0.8),
|
||||
const Color.fromARGB(204, 156, 59, 150),
|
||||
];
|
||||
|
||||
ConsultationWidget({
|
||||
super.key,
|
||||
required this.name,
|
||||
required this.description,
|
||||
required this.contact,
|
||||
required this.imagePath,
|
||||
this.onTap,
|
||||
this.color,
|
||||
this.margin,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: width ?? MediaQuery.of(context).size.width - 96,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
width: MediaQuery.of(context).size.width - (margin ?? 0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// gradient: LinearGradient(
|
||||
// colors: Colors.white,
|
||||
// begin: Alignment.centerLeft,
|
||||
// end: Alignment.centerRight,
|
||||
// ),
|
||||
gradient: LinearGradient(
|
||||
colors: _getColorList(color ?? ''),
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Gap(32),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12), // Adjust the radius as needed
|
||||
child:
|
||||
Image.asset(imagePath, width: 80, cacheWidth: (80 * MediaQuery.of(context).devicePixelRatio).round()),
|
||||
),
|
||||
const Gap(24),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: name,
|
||||
size: 18,
|
||||
size: 16,
|
||||
bold: true,
|
||||
),
|
||||
const Gap(4),
|
||||
TextWidget(
|
||||
text: description,
|
||||
size: 12,
|
||||
),
|
||||
const Gap(4),
|
||||
TextWidget(
|
||||
text: contact,
|
||||
size: 12,
|
||||
color: const Color.fromRGBO(188, 188, 188, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
@ -46,4 +104,25 @@ class ConsultationWidget extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Color> _getColorList(String color) {
|
||||
switch (color.toLowerCase()) {
|
||||
case 'green':
|
||||
return green;
|
||||
case 'blue':
|
||||
return blue;
|
||||
case 'red':
|
||||
return red;
|
||||
case 'yellow':
|
||||
return yellow;
|
||||
case 'pink':
|
||||
return pink;
|
||||
default:
|
||||
return [
|
||||
const Color.fromRGBO(0, 0, 0, 1),
|
||||
const Color.fromRGBO(68, 68, 68, 1),
|
||||
const Color.fromRGBO(158, 158, 158, 1),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue