|
@@ -19,7 +19,7 @@ class RInputImageList extends StatefulWidget {
|
|
}
|
|
}
|
|
|
|
|
|
class _RInputImageListState extends State<RInputImageList> {
|
|
class _RInputImageListState extends State<RInputImageList> {
|
|
- late final InputImageList inputImageList;
|
|
|
|
|
|
+ InputImageList? inputImageList;
|
|
InputImageListInfo? inputImageListInfo;
|
|
InputImageListInfo? inputImageListInfo;
|
|
Color _borderColor = Colors.grey;
|
|
Color _borderColor = Colors.grey;
|
|
bool _isSelected = false;
|
|
bool _isSelected = false;
|
|
@@ -31,23 +31,7 @@ class _RInputImageListState extends State<RInputImageList> {
|
|
|
|
|
|
@override
|
|
@override
|
|
initState() {
|
|
initState() {
|
|
- inputImageList = widget.inputImageList;
|
|
|
|
- _hasImageBorder = inputImageList.hasImageBorder!;
|
|
|
|
- _height = PtToPxConverter.ptToPx(inputImageList.imageHeight) + 6;
|
|
|
|
- final element = ReportInfo.instance.getBlockElement(inputImageList);
|
|
|
|
- if (element != null) {
|
|
|
|
- inputImageListInfo = element as InputImageListInfo;
|
|
|
|
- inputImageListInfo!.onSelect!.addListener((sender, e) {
|
|
|
|
- setState(() {
|
|
|
|
- if (_images.contains(e)) {
|
|
|
|
- _images.remove(e);
|
|
|
|
- } else {
|
|
|
|
- _images.add(e);
|
|
|
|
- }
|
|
|
|
- _child = _getChild();
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ _initDatas();
|
|
super.initState();
|
|
super.initState();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -61,14 +45,12 @@ class _RInputImageListState extends State<RInputImageList> {
|
|
setState(() {
|
|
setState(() {
|
|
_borderColor = Colors.grey;
|
|
_borderColor = Colors.grey;
|
|
_isSelected = false;
|
|
_isSelected = false;
|
|
- _hasImageBorder = false;
|
|
|
|
inputImageListInfo!.isSelected = false;
|
|
inputImageListInfo!.isSelected = false;
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
setState(() {
|
|
setState(() {
|
|
_borderColor = const Color.fromARGB(255, 64, 159, 248);
|
|
_borderColor = const Color.fromARGB(255, 64, 159, 248);
|
|
_isSelected = true;
|
|
_isSelected = true;
|
|
- _hasImageBorder = true;
|
|
|
|
inputImageListInfo!.isSelected = true;
|
|
inputImageListInfo!.isSelected = true;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -77,11 +59,11 @@ class _RInputImageListState extends State<RInputImageList> {
|
|
padding: const EdgeInsets.all(3),
|
|
padding: const EdgeInsets.all(3),
|
|
height: _height,
|
|
height: _height,
|
|
width: PtToPxConverter.ptToPx(
|
|
width: PtToPxConverter.ptToPx(
|
|
- inputImageList.imageWidth! * inputImageList.column!),
|
|
|
|
|
|
+ inputImageList!.imageWidth! * inputImageList!.column!),
|
|
alignment: Alignment.center,
|
|
alignment: Alignment.center,
|
|
- margin: MarginConvert.marginConvert(inputImageList.margin),
|
|
|
|
|
|
+ margin: MarginConvert.marginConvert(inputImageList!.margin),
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
- border: _hasImageBorder
|
|
|
|
|
|
+ border: _isSelected
|
|
? Border.all(
|
|
? Border.all(
|
|
width: 0.5,
|
|
width: 0.5,
|
|
color: _borderColor,
|
|
color: _borderColor,
|
|
@@ -97,23 +79,23 @@ class _RInputImageListState extends State<RInputImageList> {
|
|
Widget _getChild() {
|
|
Widget _getChild() {
|
|
if (_images.isNotEmpty) {
|
|
if (_images.isNotEmpty) {
|
|
final rowCount = (_images.length / 2).ceil();
|
|
final rowCount = (_images.length / 2).ceil();
|
|
- _height =
|
|
|
|
- rowCount * (PtToPxConverter.ptToPx(inputImageList.imageHeight!) + 3) +
|
|
|
|
- 6;
|
|
|
|
|
|
+ _height = rowCount *
|
|
|
|
+ (PtToPxConverter.ptToPx(inputImageList!.imageHeight!) + 3) +
|
|
|
|
+ 6;
|
|
return GridView.builder(
|
|
return GridView.builder(
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
- crossAxisCount: inputImageList.column!,
|
|
|
|
|
|
+ crossAxisCount: inputImageList!.column!,
|
|
crossAxisSpacing: 5,
|
|
crossAxisSpacing: 5,
|
|
mainAxisSpacing: 5,
|
|
mainAxisSpacing: 5,
|
|
childAspectRatio:
|
|
childAspectRatio:
|
|
- inputImageList.imageWidth! / inputImageList.imageHeight!,
|
|
|
|
|
|
+ inputImageList!.imageWidth! / inputImageList!.imageHeight!,
|
|
),
|
|
),
|
|
itemCount: _images.length,
|
|
itemCount: _images.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return VidImageView.network(
|
|
return VidImageView.network(
|
|
_images[index],
|
|
_images[index],
|
|
fit: BoxFit.fill,
|
|
fit: BoxFit.fill,
|
|
- width: PtToPxConverter.ptToPx(inputImageList.imageWidth!) - 20,
|
|
|
|
|
|
+ width: PtToPxConverter.ptToPx(inputImageList!.imageWidth!) - 20,
|
|
);
|
|
);
|
|
},
|
|
},
|
|
);
|
|
);
|
|
@@ -127,4 +109,24 @@ class _RInputImageListState extends State<RInputImageList> {
|
|
inputImageListInfo!.onSelect!.dispose();
|
|
inputImageListInfo!.onSelect!.dispose();
|
|
super.dispose();
|
|
super.dispose();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ void _initDatas() {
|
|
|
|
+ inputImageList = widget.inputImageList;
|
|
|
|
+ _hasImageBorder = inputImageList!.hasImageBorder!;
|
|
|
|
+ _height = PtToPxConverter.ptToPx(inputImageList!.imageHeight) + 6;
|
|
|
|
+ final element = ReportInfo.instance.getBlockElement(inputImageList!);
|
|
|
|
+ if (element != null) {
|
|
|
|
+ inputImageListInfo = element as InputImageListInfo;
|
|
|
|
+ inputImageListInfo!.onSelect!.addListener((sender, e) {
|
|
|
|
+ setState(() {
|
|
|
|
+ if (_images.contains(e)) {
|
|
|
|
+ _images.remove(e);
|
|
|
|
+ } else {
|
|
|
|
+ _images.add(e);
|
|
|
|
+ }
|
|
|
|
+ _child = _getChild();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|