Gallery/lib/image_tile.dart

42 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:gallery/data_provider/data_provider.dart';
class ImageTile extends StatelessWidget {
const ImageTile(
{Key? key, this.onClick, this.child, this.imageUri, this.dtaProvider})
: super(key: key);
final Function? onClick;
final Widget? child;
final Uri? imageUri;
final DataProvider? dtaProvider;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
onClick?.call();
},
child: Container(
padding: const EdgeInsets.all(5),
child: Container(
decoration: imageUri == null
? const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10.0)),
boxShadow: [
BoxShadow(
color: Colors.black12,
spreadRadius: 2.0,
blurRadius: 5.0),
])
: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: dtaProvider!.getImageProvider(imageUri!),
),
),
child: child)),
);
}
}