Update to add ressource on detail view
This commit is contained in:
parent
5564810e75
commit
214fe574e6
@ -78,7 +78,7 @@ class _ResourceInputContainerState extends State<ResourceInputContainer> {
|
|||||||
widget.inResourceTypes,
|
widget.inResourceTypes,
|
||||||
context,
|
context,
|
||||||
true, // IS SELECT
|
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
|
true // IS REMOVE BUTTON
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class ResourceBodyGrid extends StatefulWidget {
|
|||||||
final List<ResourceDTO> resources; //return ResourceDTO
|
final List<ResourceDTO> resources; //return ResourceDTO
|
||||||
final Function onSelect;
|
final Function onSelect;
|
||||||
final bool isAddButton;
|
final bool isAddButton;
|
||||||
|
final bool isSelectModal;
|
||||||
final List<ResourceType> resourceTypesIn;
|
final List<ResourceType> resourceTypesIn;
|
||||||
const ResourceBodyGrid({
|
const ResourceBodyGrid({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -20,6 +21,7 @@ class ResourceBodyGrid extends StatefulWidget {
|
|||||||
required this.onSelect,
|
required this.onSelect,
|
||||||
required this.isAddButton,
|
required this.isAddButton,
|
||||||
required this.resourceTypesIn,
|
required this.resourceTypesIn,
|
||||||
|
this.isSelectModal = false
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -86,7 +88,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
|
|||||||
if (widget.isAddButton)
|
if (widget.isAddButton)
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.onSelect(ResourceDTO(id: null));
|
widget.onSelect(ResourceDTO(id: widget.isSelectModal ? "-1" : null));
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
|||||||
@ -64,9 +64,10 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
|||||||
resources: tempOutput,
|
resources: tempOutput,
|
||||||
resourceTypesIn: widget.isImage ? resource_types.where((rt) => rt.type == ResourceType.Image || rt.type == ResourceType.ImageUrl).map((rt) => rt.type).toList() : widget.resourceTypes,
|
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,
|
isAddButton: widget.isAddButton,
|
||||||
|
isSelectModal: widget.isSelect,
|
||||||
onSelect: (value) async {
|
onSelect: (value) async {
|
||||||
if(widget.isSelect) {
|
if(widget.isSelect) {
|
||||||
if (value.id == null && widget.isAddButton) {
|
if (value.id == "-1" && widget.isAddButton) {
|
||||||
List<dynamic>? result = await showNewResource(appContext, context);
|
List<dynamic>? result = await showNewResource(appContext, context);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user