You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/widget/views/bee_grid_image_view.dart

53 lines
1.6 KiB

3 years ago
import 'package:aku_new_community/constants/saas_api.dart';
3 years ago
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
import 'package:flutter/material.dart';
class BeeGridImageView extends StatelessWidget {
4 years ago
final List<String?> urls;
final EdgeInsetsGeometry padding;
3 years ago
final int? crossCount;
const BeeGridImageView({
4 years ago
Key? key,
required this.urls,
this.padding = EdgeInsets.zero,
3 years ago
this.crossCount = 3,
}) : super(key: key);
@override
Widget build(BuildContext context) {
if (urls.isEmpty) return SizedBox();
return GridView.builder(
padding: padding,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
3 years ago
crossAxisCount: crossCount!,
crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w,
),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
BeeImagePreview.toPath(path: urls[index], tag: urls[index]);
},
child: Hero(
4 years ago
tag: urls[index]!,
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: FadeInImage.assetNetwork(
height: 184.w,
width: 184.w,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
3 years ago
image: SAASAPI.image(urls[index]),
fit: BoxFit.cover,
),
),
),
);
},
itemCount: urls.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
);
}
}