|
|
@@ -10,7 +10,7 @@ class ImageButton extends StatelessWidget {
|
|
|
final double borderRadius;
|
|
|
final Color borderColor;
|
|
|
final double borderWidth;
|
|
|
- final VoidCallback onTap;
|
|
|
+ final VoidCallback? onTap;
|
|
|
|
|
|
ImageButton({
|
|
|
required Size buttonSize,
|
|
|
@@ -20,7 +20,7 @@ class ImageButton extends StatelessWidget {
|
|
|
this.borderRadius = 5,
|
|
|
Color? borderColor,
|
|
|
this.borderWidth = 1,
|
|
|
- required this.onTap,
|
|
|
+ this.onTap,
|
|
|
})
|
|
|
: buttonSize = buttonSize,
|
|
|
imageSize = imageSize ?? buttonSize,
|
|
|
@@ -32,20 +32,167 @@ class ImageButton extends StatelessWidget {
|
|
|
Widget build(BuildContext context) {
|
|
|
return GestureDetector(
|
|
|
onTap: onTap,
|
|
|
- child: Container(
|
|
|
- width: buttonSize.width,
|
|
|
- height: buttonSize.height,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: bgColor,
|
|
|
- shape: BoxShape.rectangle,
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
|
|
|
- border: Border.all(color: borderColor),
|
|
|
+ child: Opacity(
|
|
|
+ opacity: onTap == null ? 0.5 : 1.0,
|
|
|
+ child: Container(
|
|
|
+ width: buttonSize.width,
|
|
|
+ height: buttonSize.height,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: bgColor,
|
|
|
+ shape: BoxShape.rectangle,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
|
|
|
+ border: Border.all(color: borderColor),
|
|
|
+ ),
|
|
|
+ child: Center(
|
|
|
+ child: Image.asset(
|
|
|
+ image,
|
|
|
+ width: imageSize.width,
|
|
|
+ height: imageSize.height,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+class ImageColumnTextButton extends StatelessWidget {
|
|
|
+ final Size buttonSize;
|
|
|
+ final String image;
|
|
|
+ final Size imageSize;
|
|
|
+ final String text;
|
|
|
+ final TextStyle? textStyle;
|
|
|
+ final double space;
|
|
|
+ final Color bgColor;
|
|
|
+ final double borderRadius;
|
|
|
+ final Color borderColor;
|
|
|
+ final double borderWidth;
|
|
|
+ final VoidCallback? onTap;
|
|
|
+
|
|
|
+ ImageColumnTextButton({
|
|
|
+ required Size buttonSize,
|
|
|
+ required this.image,
|
|
|
+ Size? imageSize,
|
|
|
+ required this.text,
|
|
|
+ this.textStyle,
|
|
|
+ this.space = 4,
|
|
|
+ Color bgColor = Colors.white,
|
|
|
+ this.borderRadius = 5,
|
|
|
+ Color? borderColor,
|
|
|
+ this.borderWidth = 1,
|
|
|
+ this.onTap,
|
|
|
+ })
|
|
|
+ : buttonSize = buttonSize,
|
|
|
+ imageSize = imageSize ?? buttonSize,
|
|
|
+ bgColor = bgColor,
|
|
|
+ borderColor = borderColor ?? bgColor
|
|
|
+ ;
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: onTap,
|
|
|
+ child: Opacity(
|
|
|
+ opacity: onTap == null ? 0.5 : 1.0,
|
|
|
+ child: Container(
|
|
|
+ width: buttonSize.width,
|
|
|
+ height: buttonSize.height,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: bgColor,
|
|
|
+ shape: BoxShape.rectangle,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
|
|
|
+ border: Border.all(color: borderColor),
|
|
|
+ ),
|
|
|
+ child: Center(
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Image.asset(
|
|
|
+ image,
|
|
|
+ width: imageSize.width,
|
|
|
+ height: imageSize.height,
|
|
|
+ ),
|
|
|
+ SizedBox(height: space),
|
|
|
+ Text(
|
|
|
+ text,
|
|
|
+ style: textStyle,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- child: Center(
|
|
|
- child: Image.asset(
|
|
|
- image,
|
|
|
- width: imageSize.width,
|
|
|
- height: imageSize.height,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+class ImageRowTextButton extends StatelessWidget {
|
|
|
+ final Size buttonSize;
|
|
|
+ final String image;
|
|
|
+ final Size imageSize;
|
|
|
+ final String text;
|
|
|
+ final TextStyle? textStyle;
|
|
|
+ final double space;
|
|
|
+ final Color bgColor;
|
|
|
+ final double borderRadius;
|
|
|
+ final Color borderColor;
|
|
|
+ final double borderWidth;
|
|
|
+ final VoidCallback? onTap;
|
|
|
+
|
|
|
+ ImageRowTextButton({
|
|
|
+ required Size buttonSize,
|
|
|
+ required this.image,
|
|
|
+ Size? imageSize,
|
|
|
+ required this.text,
|
|
|
+ this.textStyle,
|
|
|
+ this.space = 2,
|
|
|
+ Color bgColor = Colors.white,
|
|
|
+ this.borderRadius = 5,
|
|
|
+ Color? borderColor,
|
|
|
+ this.borderWidth = 1,
|
|
|
+ this.onTap,
|
|
|
+ })
|
|
|
+ : buttonSize = buttonSize,
|
|
|
+ imageSize = imageSize ?? buttonSize,
|
|
|
+ bgColor = bgColor,
|
|
|
+ borderColor = borderColor ?? bgColor
|
|
|
+ ;
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: onTap,
|
|
|
+ child: Opacity(
|
|
|
+ opacity: onTap == null ? 0.5 : 1.0,
|
|
|
+ child: Container(
|
|
|
+ width: buttonSize.width,
|
|
|
+ height: buttonSize.height,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: bgColor,
|
|
|
+ shape: BoxShape.rectangle,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
|
|
|
+ border: Border.all(color: borderColor),
|
|
|
+ ),
|
|
|
+ child: Center(
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Image.asset(
|
|
|
+ image,
|
|
|
+ width: imageSize.width,
|
|
|
+ height: imageSize.height,
|
|
|
+ ),
|
|
|
+ SizedBox(width: space),
|
|
|
+ Text(
|
|
|
+ text,
|
|
|
+ style: textStyle,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|