update
This commit is contained in:
parent
5537edb6c5
commit
5f38ce753f
14 changed files with 322 additions and 191 deletions
99
lib/widgets/menu_widget2.dart
Normal file
99
lib/widgets/menu_widget2.dart
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
|
||||
class MenuWidget2 extends StatelessWidget {
|
||||
final String text;
|
||||
final IconData? icon;
|
||||
final VoidCallback? onPressed;
|
||||
final String? color;
|
||||
final String description;
|
||||
|
||||
final List<Color> blue = [
|
||||
const Color.fromRGBO(59, 101, 156, 1),
|
||||
const Color.fromRGBO(59, 101, 156, 1),
|
||||
const Color.fromRGBO(59, 156, 156, 1),
|
||||
];
|
||||
|
||||
final List<Color> green = [
|
||||
const Color.fromRGBO(59, 156, 103, 1),
|
||||
const Color.fromRGBO(59, 156, 103, 1),
|
||||
const Color.fromRGBO(122, 182, 70, 1),
|
||||
];
|
||||
|
||||
final List<Color> red = [
|
||||
const Color.fromRGBO(156, 59, 59, 1),
|
||||
const Color.fromRGBO(164, 62, 62, 1),
|
||||
const Color.fromRGBO(186, 120, 70, 1),
|
||||
];
|
||||
|
||||
final List<Color> yellow = [
|
||||
const Color.fromRGBO(156, 156, 59, 1),
|
||||
const Color.fromRGBO(156, 156, 59, 1),
|
||||
const Color.fromRGBO(104, 156, 59, 1),
|
||||
];
|
||||
|
||||
MenuWidget2({super.key, required this.text, required this.description, this.icon, this.onPressed, this.color});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width - 96,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
gradient: LinearGradient(
|
||||
colors: _getColorList(color!),
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Gap(24),
|
||||
// Icon(icon, size: 28, color: Colors.white),
|
||||
FaIcon(icon, size: 28, color: Colors.white),
|
||||
const Gap(32),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: text,
|
||||
size: 20,
|
||||
),
|
||||
const Gap(4),
|
||||
TextWidget(
|
||||
text: description,
|
||||
size: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Color> _getColorList(String color) {
|
||||
switch (color.toLowerCase()) {
|
||||
case 'green':
|
||||
return green;
|
||||
case 'blue':
|
||||
return blue;
|
||||
case 'red':
|
||||
return red;
|
||||
case 'yellow':
|
||||
return yellow;
|
||||
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