flutter pub run build_runner build --delete-conflicting-outputs
build_runner generete
Colored Console Log extension
#useful #extension
extension StringExtension on String {
void console({String? info, LogColors? color}) {
debugPrint('${info != null ? '$info: ' : ''}\x1B[${(color ?? LogColors.green).name}$this\x1B[0m');
}
}
enum LogColors {
black("30m"),
red("31m"),
green("32m"),
yellow("33m"),
blue("34m"),
magenta("35m"),
cyan("36m"),
white("37m");
final String name;
const LogColors(this.name);
}
#useful #extension
Standart Text Styles and Easy SizedBox extensions
#useful #extension
extension NumExtension on num {
double _s() => toDouble().spMin;
String _f() => AppFonts.exo;
SizedBox get ph => SizedBox(height: _s());
SizedBox get pw => SizedBox(width: _s());
TextStyle thin([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w100, fontFamily: _f());
TextStyle extraLight([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w200, fontFamily: _f());
TextStyle light([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w300, fontFamily: _f());
TextStyle regular([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w400, fontFamily: _f());
TextStyle medium([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w500, fontFamily: _f());
TextStyle semiBold([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w600, fontFamily: _f());
TextStyle bold([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w700, fontFamily: _f());
TextStyle extraBold([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w800, fontFamily: _f());
TextStyle black([Color? color]) => TextStyle(fontSize: _s(), color: color, fontWeight: FontWeight.w900, fontFamily: _f());
}#useful #extension
Easy Widgets extensions
#useful #extension
extension WidgetExtension on Widget {
Widget paddingAll([double all = 0.0]) => Padding(padding: EdgeInsets.all(all), child: this);
Widget paddingSymmetric({double horizontal = 0, double vertical = 0}) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical),
child: this,
);
}
Widget paddingOnly({double left = 0, double right = 0, double top = 0, double bottom = 0}) {
return Padding(
padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom),
child: this,
);
}
Widget radius([double radius = 0]) => ClipRRect(borderRadius: BorderRadius.circular(radius), child: this);
Widget opacity([double opacity = 1.0]) => Opacity(opacity: opacity, child: this);
Widget visibility([bool visible = true]) => Visibility(visible: visible, child: this);
Widget expanded([int flex = 1]) => Expanded(flex: flex, child: this);
Widget flexible([int flex = 1, FlexFit fit = FlexFit.loose]) => Flexible(flex: flex, fit: fit, child: this);
Widget sizedBox({double? width, double? height}) => SizedBox(width: width, height: height, child: this);
Widget center() => Center(child: this);
Widget align([Alignment alignment = Alignment.center]) => Align(alignment: alignment, child: this);
Widget backgroundColor([Color color = Colors.transparent]) => Material(color: color, child: this);
}#useful #extension
pip install [package] - package o'rnatishpip install -r requirements.txt - file yaratishpip freeze > requirements.txt - o'rnatilgan kutubxonalar ro'yxatini saqlashsource venv/bin/activate - vertuval muhit yaratishdeactivate - vertuval muhitdan chiqish#python
💩1