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

66 lines
1.7 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
class PickedImagesContainer extends StatelessWidget {
final List<File> pickedImages;
final Function(String filePath) onCrossPressed;
const PickedImagesContainer({
Key? key,
required this.pickedImages,
required this.onCrossPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Wrap(
children: pickedImages.map((file) => BuildImageContainer(file: file, onCrossPressed: onCrossPressed,)).toList(),
);
}
}
class BuildImageContainer extends StatelessWidget {
final File file;
final Function(String filePath) onCrossPressed;
const BuildImageContainer({
Key? key,
required this.file,
required this.onCrossPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
height: 80,
width: 80,
child: Stack(
children: [
Image.file(
file,
fit: BoxFit.fill,
height: 72,
width: 70,
).paddingAll(8),
Align(
alignment: Alignment.topRight,
child: MyAssets.closeWithOrangeBg.buildSvg(
fit: BoxFit.fill,
height: 25,
width: 25,
),
).onPress(() {
onCrossPressed(file.path);
})
],
)),
],
);
}
}