50 lines
1.1 KiB
Dart
50 lines
1.1 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
|
||
|
import '../utils/image_utils.dart';
|
||
|
|
||
|
class ImageTxtButton extends StatelessWidget {
|
||
|
const ImageTxtButton({
|
||
|
super.key,
|
||
|
required this.text,
|
||
|
required this.imgName,
|
||
|
required this.textStyle,
|
||
|
this.width = 264.0,
|
||
|
this.height = 80.0,
|
||
|
this.onPressed,
|
||
|
});
|
||
|
|
||
|
final String text;
|
||
|
final TextStyle textStyle;
|
||
|
final double? width;
|
||
|
final double? height;
|
||
|
final String imgName;
|
||
|
final VoidCallback? onPressed;
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return GestureDetector(
|
||
|
onTap: () {
|
||
|
onPressed?.call();
|
||
|
},
|
||
|
child: Container(
|
||
|
width: width!.w,
|
||
|
height: height!.h,
|
||
|
decoration: BoxDecoration(
|
||
|
color: Colors.transparent,
|
||
|
image: DecorationImage(
|
||
|
image: ImageUtils.getAssetImage(imgName),
|
||
|
fit: BoxFit.fill,
|
||
|
),
|
||
|
),
|
||
|
child: Center(
|
||
|
child: Text(
|
||
|
text,
|
||
|
style: textStyle,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|