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.
64 lines
2.2 KiB
Dart
64 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
extension WidgetExtensions on Widget {
|
|
Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, 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 toContainer({double borderRadius = 8, double paddingAll = 10, EdgeInsetsGeometry? padding, Color backgroundColor = Colors.white, bool isShadowEnabled = false}) => Container(
|
|
decoration: BoxDecoration(
|
|
color: backgroundColor,
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
boxShadow: !isShadowEnabled
|
|
? null
|
|
: [
|
|
BoxShadow(
|
|
color: const Color(0xff000000).withOpacity(.05),
|
|
blurRadius: 26,
|
|
offset: const Offset(0, -3),
|
|
),
|
|
],
|
|
),
|
|
padding: padding ?? EdgeInsets.all(paddingAll),
|
|
child: this,
|
|
);
|
|
|
|
Widget toCircle({double borderRadius = 100, double padding = 0}) => Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xff000000).withOpacity(.1),
|
|
blurRadius: 26,
|
|
offset: const Offset(0, -3),
|
|
),
|
|
],
|
|
),
|
|
clipBehavior: Clip.antiAlias,
|
|
padding: EdgeInsets.all(padding),
|
|
child: this,
|
|
);
|
|
|
|
Widget toWhiteContainer({double borderRadius = 8, double padding = 12, double? width}) => Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(15),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xff000000).withOpacity(.05),
|
|
blurRadius: 26,
|
|
offset: const Offset(0, -3),
|
|
),
|
|
],
|
|
),
|
|
padding: EdgeInsets.all(padding),
|
|
width: width,
|
|
child: this,
|
|
);
|
|
}
|