38 lines
852 B
Dart
38 lines
852 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CustomImageButton extends StatelessWidget {
|
|
final VoidCallback onPressed;
|
|
final Widget child;
|
|
final String backgroundImage;
|
|
|
|
const CustomImageButton({
|
|
super.key,
|
|
required this.onPressed,
|
|
required this.child,
|
|
required this.backgroundImage,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: Colors.transparent,
|
|
child: InkWell(
|
|
onTap: onPressed,
|
|
child: Container(
|
|
height: 150,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(5),
|
|
image: DecorationImage(
|
|
image: AssetImage(backgroundImage),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
child: Center(
|
|
child: child,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|