flutter_application_1/lib/widgets/custom_image_button_widget....

38 lines
852 B
Dart
Raw Normal View History

2024-05-24 14:04:26 +02:00
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,
),
),
),
);
}
}