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/horizontal_image_view.dart

50 lines
1.4 KiB

3 years ago
import 'package:flutter/material.dart';
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';
class HorizontalImageView extends StatelessWidget {
4 years ago
final List<String?> urls;
3 years ago
HorizontalImageView(
this.urls, {
4 years ago
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
if (urls.isEmpty) return 15.hb;
return Container(
height: 184.w + 32.w,
child: ListView.separated(
padding: EdgeInsets.all(16.w),
separatorBuilder: (_, __) => 16.wb,
scrollDirection: Axis.horizontal,
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,
),
);
}
}