add services and items widgets
parent
456aef0d41
commit
a887d9733e
@ -0,0 +1,48 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class DateHelper {
|
||||
static DateTime parseStringToDate(String dateString) {
|
||||
final formatter = DateFormat('yyyy-MM-dd');
|
||||
return formatter.parse(dateString);
|
||||
}
|
||||
|
||||
static String formatAsShortDate(DateTime date) {
|
||||
final formatter = DateFormat.yMd();
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
static String formatAsLongDate(DateTime date) {
|
||||
final formatter = DateFormat.yMMMMEEEEd();
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
static String formatAsTime(DateTime date) {
|
||||
final formatter = DateFormat.jm();
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
static String formatAsYearMonthDay(DateTime date) {
|
||||
final formatter = DateFormat('y-MM-d');
|
||||
return date != null ? formatter.format(date) : "N/A";
|
||||
}
|
||||
|
||||
static String formatAsCustomPattern(DateTime date, String pattern) {
|
||||
final formatter = DateFormat(pattern);
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
static String formatAsDayMonthYear(DateTime? date) {
|
||||
final formatter = DateFormat('d MMM, y');
|
||||
return date != null ? formatter.format(date) : "N/A";
|
||||
}
|
||||
|
||||
static String formatAsMonthDayYear(DateTime date) {
|
||||
final formatter = DateFormat('MMMM d, y');
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
static String formatAsMonthYear(DateTime date) {
|
||||
final formatter = DateFormat('MMMM y');
|
||||
return formatter.format(date);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||
|
||||
void showMyBottomSheet(BuildContext context, {required Widget child, VoidCallback? callBackFunc}) {
|
||||
showModalBottomSheet<String>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(25),
|
||||
topLeft: Radius.circular(25),
|
||||
),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
13.height,
|
||||
Container(
|
||||
height: 6,
|
||||
width: 60,
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xff9A9A9A),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
),
|
||||
),
|
||||
8.height,
|
||||
child,
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) {
|
||||
// print("BACK FROM DELEGATE!!!!");
|
||||
// print("value: $value");
|
||||
if (value == "delegate_reload") {
|
||||
if (callBackFunc != null) callBackFunc();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class BottomSheetItem extends StatelessWidget {
|
||||
final Function onTap;
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final Color color;
|
||||
|
||||
const BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = Colors.black}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (onTap != null) {
|
||||
Navigator.pop(context);
|
||||
onTap();
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (icon != null)
|
||||
Icon(
|
||||
icon,
|
||||
color: color,
|
||||
size: 18.0,
|
||||
),
|
||||
if (icon != null) SizedBox(width: 24.0),
|
||||
Text(
|
||||
title ?? "",
|
||||
style: TextStyle(color: color),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue