Update to add ressource on detail view

This commit is contained in:
Thomas Fransolet 2024-06-21 22:44:26 +02:00
parent 5564810e75
commit 214fe574e6
3 changed files with 6 additions and 3 deletions

View File

@ -78,7 +78,7 @@ class _ResourceInputContainerState extends State<ResourceInputContainer> {
widget.inResourceTypes,
context,
true, // IS SELECT
false, // IS ADD FALSE only for geopoint for now
true, // IS ADD FALSE only for geopoint for now
true // IS REMOVE BUTTON
);

View File

@ -13,6 +13,7 @@ class ResourceBodyGrid extends StatefulWidget {
final List<ResourceDTO> resources; //return ResourceDTO
final Function onSelect;
final bool isAddButton;
final bool isSelectModal;
final List<ResourceType> resourceTypesIn;
const ResourceBodyGrid({
Key? key,
@ -20,6 +21,7 @@ class ResourceBodyGrid extends StatefulWidget {
required this.onSelect,
required this.isAddButton,
required this.resourceTypesIn,
this.isSelectModal = false
}) : super(key: key);
@override
@ -86,7 +88,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
if (widget.isAddButton)
InkWell(
onTap: () {
widget.onSelect(ResourceDTO(id: null));
widget.onSelect(ResourceDTO(id: widget.isSelectModal ? "-1" : null));
},
child: Padding(
padding: const EdgeInsets.all(8.0),

View File

@ -64,9 +64,10 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
resources: tempOutput,
resourceTypesIn: widget.isImage ? resource_types.where((rt) => rt.type == ResourceType.Image || rt.type == ResourceType.ImageUrl).map((rt) => rt.type).toList() : widget.resourceTypes,
isAddButton: widget.isAddButton,
isSelectModal: widget.isSelect,
onSelect: (value) async {
if(widget.isSelect) {
if (value.id == null && widget.isAddButton) {
if (value.id == "-1" && widget.isAddButton) {
List<dynamic>? result = await showNewResource(appContext, context);
if (result != null)
{