2022-09-25 22:12:57 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:gallery/data_provider/data_provider.dart';
|
2022-09-29 19:01:28 +00:00
|
|
|
import 'package:gallery/utils/tile_size.dart';
|
2022-09-25 22:12:57 +00:00
|
|
|
|
|
|
|
class ImageTile extends StatelessWidget {
|
2022-09-26 22:30:13 +00:00
|
|
|
const ImageTile(
|
|
|
|
{Key? key, this.onClick, this.child, this.imageUri, this.dtaProvider})
|
|
|
|
: super(key: key);
|
2022-09-25 22:12:57 +00:00
|
|
|
final Function? onClick;
|
|
|
|
final Widget? child;
|
|
|
|
final Uri? imageUri;
|
|
|
|
final DataProvider? dtaProvider;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onClick?.call();
|
|
|
|
},
|
2022-09-26 22:30:13 +00:00
|
|
|
child: Container(
|
2022-09-29 19:01:28 +00:00
|
|
|
padding: const EdgeInsets.all(3),
|
2022-09-26 22:30:13 +00:00
|
|
|
child: Container(
|
|
|
|
decoration: imageUri == null
|
2022-09-29 19:01:28 +00:00
|
|
|
? BoxDecoration(
|
2022-09-26 22:30:13 +00:00
|
|
|
color: Colors.white,
|
2022-09-29 19:01:28 +00:00
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(calcTileMaxWidth() / 30)),
|
2022-09-26 22:30:13 +00:00
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black12,
|
2022-09-29 19:01:28 +00:00
|
|
|
spreadRadius: calcTileMaxWidth() / 150,
|
|
|
|
blurRadius: calcTileMaxWidth() / 60),
|
2022-09-26 22:30:13 +00:00
|
|
|
])
|
|
|
|
: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
image: dtaProvider!.getImageProvider(imageUri!),
|
|
|
|
),
|
2022-09-29 19:01:28 +00:00
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(calcTileMaxWidth() / 30)),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black12,
|
|
|
|
spreadRadius: calcTileMaxWidth() / 150,
|
|
|
|
blurRadius: calcTileMaxWidth() / 60),
|
|
|
|
]),
|
2022-09-26 22:30:13 +00:00
|
|
|
child: child)),
|
2022-09-25 22:12:57 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|