52 lines
1.6 KiB
Dart
52 lines
1.6 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
Widget btn({GestureTapCallback? onTap, Widget? child}) {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: onTap,
|
|
child: child,
|
|
);
|
|
}
|
|
|
|
Widget btnWithBorder({
|
|
GestureTapCallback? onTap,
|
|
Widget? child,
|
|
double paddingVertical = 0,
|
|
double paddingHorizontal = 0,
|
|
double marginHorizontal = 0,
|
|
double marginVertical = 0,
|
|
EdgeInsetsGeometry? margin,
|
|
EdgeInsetsGeometry? padding,
|
|
Color borderColor = Colors.transparent,
|
|
double borderWidth = 0,
|
|
Color color = Colors.transparent,
|
|
double radius = 0,
|
|
double? width,
|
|
double? height,
|
|
AlignmentGeometry? alignment,
|
|
Gradient? gradient,
|
|
BorderRadiusGeometry? borderRadius,
|
|
ImageProvider? bgImage,
|
|
}) {
|
|
return btn(
|
|
onTap: onTap,
|
|
child: Container(
|
|
width: width,
|
|
height: height,
|
|
alignment: alignment,
|
|
padding: padding ?? EdgeInsets.symmetric(vertical: paddingVertical.w, horizontal: paddingHorizontal.w),
|
|
margin: margin ?? EdgeInsets.symmetric(horizontal: marginHorizontal, vertical: marginVertical),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: borderColor, width: borderWidth),
|
|
borderRadius: borderRadius ?? BorderRadius.all(Radius.circular(radius)),
|
|
color: color,
|
|
gradient: gradient,
|
|
image: bgImage != null ? DecorationImage(image: bgImage, fit: BoxFit.fill) : null,
|
|
),
|
|
child: child,
|
|
),
|
|
);
|
|
}
|