You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

242 lines
4.4 KiB

import 'package:flutter/material.dart';
class Constant {
VerticalDivider getVDivider(num width) {
return VerticalDivider(
width: width.toDouble(),
color: Colors.transparent,
);
}
Divider getDivider(num height) {
return Divider(
height: height.toDouble(),
color: Colors.transparent,
);
}
TextStyle getStyle(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: Colors.white,
);
}
TextStyle getTextStyle(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: const Color(0xFFE7E7E7),
);
}
TextStyle getGrayStyle(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: const Color(0xFF727272),
);
}
TextStyle getCCStyle(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: const Color(0xFFCCCCCC),
);
}
TextStyle get33Style(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: const Color(0xFF333333),
);
}
TextStyle getBlackStyle(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
fontWeight: FontWeight.w600,
color: Colors.black,
);
}
TextStyle getGray1Style(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: const Color(0xFFA1A1A1),
);
}
TextStyle getBlueStyle(num fontSize) {
return TextStyle(
fontSize: fontSize.toDouble(),
color: const Color(0xFF64A4FF),
);
}
EdgeInsets getMpa(num a) {
return EdgeInsets.all(a.toDouble());
}
EdgeInsets getMph(num h) {
return EdgeInsets.symmetric(
horizontal: h.toDouble(),
);
}
EdgeInsets getMpv(num v) {
return EdgeInsets.symmetric(
vertical: v.toDouble(),
);
}
EdgeInsets getMphv(Map<String, num> hv) {
return EdgeInsets.symmetric(
horizontal: hv['h']?.toDouble() ?? 0 ,
vertical: hv['v']?.toDouble() ?? 0,
);
}
EdgeInsets getMpOnly(Map<String, num> hv) {
return EdgeInsets.only(
left: hv['l']?.toDouble() ?? 0 ,
top: hv['t']?.toDouble() ?? 0,
right: hv['r']?.toDouble() ?? 0,
bottom: hv['b']?.toDouble() ?? 0,
);
}
Widget getRoundBg(Widget widget) {
return Container(
padding: 13.mpa,
decoration: BoxDecoration(
color: const Color(0xFF2D2C31),
borderRadius: BorderRadius.circular(12),
),
child: widget,
);
}
Widget getOutlinedBg(Widget widget) {
return Container(
padding: {
'h': 7,
'v': 2,
}.mphv,
decoration: BoxDecoration(
border: Border.all(
color: const Color(0xFF64A4FF),
width: 1,
),
borderRadius: BorderRadius.circular(10.5),
),
child: widget,
);
}
Widget getSlideBg(Widget widget) {
return Container(
alignment: Alignment.center,
padding: {
'l':12
}.mpOnly,
decoration: BoxDecoration(
color: const Color(0xFF64A4FF),
borderRadius: BorderRadius.circular(14),
),
child: widget,
);
}
Widget padding(Widget widget) {
return Padding(
padding: 25.mph,
child: widget,
);
}
}
extension WidgetExtension on Widget {
Widget get roundBg => Constant().getRoundBg(this);
Widget get outlinedBg => Constant().getOutlinedBg(this);
Widget get slideBg => Constant().getSlideBg(this);
Widget get padding => Constant().padding(this);
}
extension NumExtension on num {
VerticalDivider get vd => Constant().getVDivider(this);
Divider get d => Constant().getDivider(this);
TextStyle get whiteStyle => Constant().getStyle(this);
TextStyle get blackStyle => Constant().getBlackStyle(this);
TextStyle get ccStyle => Constant().getCCStyle(this);
TextStyle get c33Style => Constant().get33Style(this);
TextStyle get textStyle => Constant().getTextStyle(this);
TextStyle get grayStyle => Constant().getGrayStyle(this);
TextStyle get gray1Style => Constant().getGray1Style(this);
TextStyle get blueStyle => Constant().getBlueStyle(this);
EdgeInsets get mpa => Constant().getMpa(this);
EdgeInsets get mph => Constant().getMph(this);
EdgeInsets get mpv => Constant().getMpv(this);
}
extension MapExtension on Map<String, num> {
EdgeInsets get mphv => Constant().getMphv(this);
EdgeInsets get mpOnly => Constant().getMpOnly(this);
}
extension OtherExtension on bool {
}