|
|
|
|
@ -55,30 +55,31 @@ extension WidgetExtensions on Widget {
|
|
|
|
|
|
|
|
|
|
Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this);
|
|
|
|
|
|
|
|
|
|
Widget handlePopScope({required BuildContext cxt, required VoidCallback onSave, bool? showPopUp =true}) {
|
|
|
|
|
return showPopUp! ? PopScope(
|
|
|
|
|
canPop: false,
|
|
|
|
|
onPopInvokedWithResult: (didPop, result) {
|
|
|
|
|
if (didPop) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
showDialog(
|
|
|
|
|
context: cxt,
|
|
|
|
|
builder: (BuildContext cxt) => AcknowledgeWorkDialog(
|
|
|
|
|
onSave: () => onSave(),
|
|
|
|
|
onDiscard: () {
|
|
|
|
|
Navigator.of(cxt).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: this): this;
|
|
|
|
|
Widget handlePopScope({required BuildContext cxt, required VoidCallback onSave, bool? showPopUp = true}) {
|
|
|
|
|
return showPopUp!
|
|
|
|
|
? PopScope(
|
|
|
|
|
canPop: false,
|
|
|
|
|
onPopInvokedWithResult: (didPop, result) {
|
|
|
|
|
if (didPop) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
showDialog(
|
|
|
|
|
context: cxt,
|
|
|
|
|
builder: (BuildContext cxt) => AcknowledgeWorkDialog(
|
|
|
|
|
onSave: () => onSave(),
|
|
|
|
|
onDiscard: () {
|
|
|
|
|
Navigator.of(cxt).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: this)
|
|
|
|
|
: this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget toShimmer({bool isShow = true, double radius = 20,required BuildContext context}) => isShow
|
|
|
|
|
Widget toShimmer({bool isShow = true, double radius = 20, required BuildContext context}) => isShow
|
|
|
|
|
? Shimmer.fromColors(
|
|
|
|
|
// baseColor: const Color(0xffe8eff0),
|
|
|
|
|
baseColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
baseColor: context.isDark ? AppColor.backgroundDark : const Color(0xffe8eff0),
|
|
|
|
|
highlightColor: AppColor.background(context),
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.circular(radius),
|
|
|
|
|
@ -94,17 +95,26 @@ extension WidgetExtensions on Widget {
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox(width: 250, height: 24).toShimmer(isShow: isShow,context: context),
|
|
|
|
|
const SizedBox(width: 250, height: 24).toShimmer(isShow: isShow, context: context),
|
|
|
|
|
8.height,
|
|
|
|
|
const SizedBox(width: 160, height: 16).toShimmer(isShow: isShow,context: context),
|
|
|
|
|
const SizedBox(width: 160, height: 16).toShimmer(isShow: isShow, context: context),
|
|
|
|
|
8.height,
|
|
|
|
|
const SizedBox(width: 120, height: 18).toShimmer(isShow: isShow,context: context).toShimmer(isShow: isShow,context: context),
|
|
|
|
|
const SizedBox(width: 120, height: 18).toShimmer(isShow: isShow, context: context).toShimmer(isShow: isShow, context: context),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context)
|
|
|
|
|
: this;
|
|
|
|
|
|
|
|
|
|
Widget toShadowContainer(BuildContext context,
|
|
|
|
|
{bool showShadow = true, double borderRadius = 14, bool withShadow = true, Color? backgroundColor, Color borderColor = Colors.transparent, double padding = 16, EdgeInsets? paddingObject, EdgeInsets? margin,}) =>
|
|
|
|
|
Widget toShadowContainer(
|
|
|
|
|
BuildContext context, {
|
|
|
|
|
bool showShadow = true,
|
|
|
|
|
double borderRadius = 14,
|
|
|
|
|
bool withShadow = true,
|
|
|
|
|
Color? backgroundColor,
|
|
|
|
|
Color borderColor = Colors.transparent,
|
|
|
|
|
double padding = 16,
|
|
|
|
|
EdgeInsets? paddingObject,
|
|
|
|
|
EdgeInsets? margin,
|
|
|
|
|
}) =>
|
|
|
|
|
withShadow
|
|
|
|
|
? Container(
|
|
|
|
|
padding: paddingObject ?? EdgeInsets.all(padding),
|
|
|
|
|
|