You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.2 KiB
Dart
96 lines
3.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
extension WidgetExtensions on Widget {
|
|
Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this);
|
|
|
|
Widget get expanded => Expanded(child: this);
|
|
|
|
Widget get center => Center(child: this);
|
|
|
|
Widget circle(double _value) => ClipRRect(borderRadius: BorderRadius.circular(_value), child: this);
|
|
|
|
Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this);
|
|
|
|
Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
|
|
Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this);
|
|
|
|
Widget toShimmer({bool isShow = true}) => isShow
|
|
? Shimmer.fromColors(
|
|
baseColor: Color(0xffe8eff0),
|
|
highlightColor: Colors.white,
|
|
child: Container(
|
|
color: Colors.white,
|
|
child: this,
|
|
),
|
|
)
|
|
: Container(
|
|
child: this,
|
|
);
|
|
|
|
Widget animatedSwither() => AnimatedSwitcher(
|
|
duration: const Duration(milliseconds: 500),
|
|
// transitionBuilder: (Widget child, Animation<double> animation) {
|
|
// return ScaleTransition(scale: animation, child: child);
|
|
// },
|
|
switchInCurve: Curves.linearToEaseOut,
|
|
switchOutCurve: Curves.linearToEaseOut,
|
|
child: this,
|
|
);
|
|
|
|
Widget objectContainerView({String title = "", String note = "", bool disablePadding = false}) {
|
|
return Container(
|
|
padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(15),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xff000000).withOpacity(.05),
|
|
blurRadius: 26,
|
|
offset: const Offset(0, -3),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (title.isNotEmpty) title.toText16(),
|
|
if (title.isNotEmpty) 12.height,
|
|
this,
|
|
if (note.isNotEmpty) note.toText11(),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget objectContainerBorderView({String title = "", String note = ""}) {
|
|
return Container(
|
|
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(15),
|
|
border: Border.all(
|
|
color: MyColors.lightGreyEFColor,
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (title.isNotEmpty) title.toText16(),
|
|
if (title.isNotEmpty) 12.height,
|
|
this,
|
|
if (note.isNotEmpty) note.toText11(),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|