Support min/max size for match_parent element in gallery

commit_hash:4ff0babf80ce3defbb843e6acde41b8fcc1e1da6
This commit is contained in:
grechka62
2025-09-25 18:44:19 +03:00
parent 34c7b46c48
commit 4b6dddfd99
276 changed files with 1069 additions and 230 deletions
@@ -0,0 +1,87 @@
{
"description": "Horizontal gallery with paddings and elements with match_parent height with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"width": {
"type": "fixed",
"value": 90
},
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "gallery",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 100
},
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"items": [
{
"type": "item",
"height": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"height": {
"type": "match_parent",
"min_size": {
"value": 110
}
},
"text": "min height > gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent",
"max_size": {
"value": 60
}
},
"text": "max height < gallery height"
}
]
}
}
]
}
}
@@ -0,0 +1,105 @@
{
"description": "Horizontal gallery with paddings and elements with match_parent width with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"height": {
"type": "match_parent"
},
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
},
"test_gallery": {
"type": "gallery",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 60
},
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"margins": {
"bottom": 10
},
"items": [
{
"type": "item",
"width": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"width": {
"type": "match_parent",
"min_size": {
"value": 400
}
},
"text": "min width > gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent",
"max_size": {
"value": 200
}
},
"text": "max width < gallery width"
}
]
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "container",
"items": [
{
"type": "test_gallery"
},
{
"type": "test_gallery",
"default_item": 1
},
{
"type": "test_gallery",
"default_item": 2
}
]
}
}
]
}
}
@@ -0,0 +1,116 @@
{
"description": "Horizontal gallery with 2 columns with paddings and elements with match_parent height with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"width": {
"type": "fixed",
"value": 90
},
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "gallery",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 200
},
"column_count": 2,
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"cross_spacing": 16,
"items": [
{
"type": "item",
"height": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"height": {
"type": "match_parent",
"min_size": {
"value": 90
}
},
"text": "min height > gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent",
"max_size": {
"value": 60
}
},
"text": "max height < gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"height": {
"type": "match_parent",
"min_size": {
"value": 90
}
},
"text": "min height > gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent",
"max_size": {
"value": 60
}
},
"text": "max height < gallery height"
}
]
}
}
]
}
}
@@ -0,0 +1,134 @@
{
"description": "Horizontal gallery with 2 columns with paddings and elements with match_parent width with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"height": {
"type": "match_parent"
},
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
},
"test_gallery": {
"type": "gallery",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 140
},
"column_count": 2,
"cross_spacing": 16,
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"margins": {
"bottom": 10
},
"items": [
{
"type": "item",
"width": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"width": {
"type": "match_parent",
"min_size": {
"value": 400
}
},
"text": "min width > gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent",
"max_size": {
"value": 200
}
},
"text": "max width < gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"width": {
"type": "match_parent",
"min_size": {
"value": 400
}
},
"text": "min width > gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent",
"max_size": {
"value": 200
}
},
"text": "max width < gallery width"
}
]
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "container",
"items": [
{
"type": "test_gallery"
},
{
"type": "test_gallery",
"default_item": 2
},
{
"type": "test_gallery",
"default_item": 5
}
]
}
}
]
}
}
@@ -0,0 +1,103 @@
{
"description": "Vertical gallery with paddings and elements with match_parent height with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
},
"test_gallery": {
"type": "gallery",
"orientation": "vertical",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 60
},
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"margins": {
"bottom": 10
},
"items": [
{
"type": "item",
"height": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"height": {
"type": "match_parent",
"min_size": {
"value": 70
}
},
"text": "min height > gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent",
"max_size": {
"value": 30
}
},
"text": "max height < gallery height"
}
]
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "container",
"items": [
{
"type": "test_gallery"
},
{
"type": "test_gallery",
"default_item": 1
},
{
"type": "test_gallery",
"default_item": 2
}
]
}
}
]
}
}
@@ -0,0 +1,88 @@
{
"description": "Vertical gallery with paddings and elements with match_parent width with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"height": {
"type": "fixed",
"value": 40
},
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "gallery",
"orientation": "vertical",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 150
},
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"items": [
{
"type": "item",
"width": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"width": {
"type": "match_parent",
"min_size": {
"value": 400
}
},
"text": "min width > gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent",
"max_size": {
"value": 200
}
},
"text": "max width < gallery width"
}
]
}
}
]
}
}
@@ -0,0 +1,132 @@
{
"description": "Vertical gallery with 2 columns with paddings and elements with match_parent height with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
},
"test_gallery": {
"type": "gallery",
"orientation": "vertical",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 80
},
"column_count": 2,
"cross_spacing": 16,
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"margins": {
"bottom": 10
},
"items": [
{
"type": "item",
"height": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"height": {
"type": "match_parent",
"min_size": {
"value": 90
}
},
"text": "min height > gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent",
"max_size": {
"value": 50
}
},
"text": "max height < gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"height": {
"type": "match_parent",
"min_size": {
"value": 90
}
},
"text": "min height > gallery height"
},
{
"type": "item",
"height": {
"type": "match_parent",
"max_size": {
"value": 50
}
},
"text": "max height < gallery height"
}
]
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "container",
"items": [
{
"type": "test_gallery"
},
{
"type": "test_gallery",
"default_item": 2
},
{
"type": "test_gallery",
"default_item": 5
}
]
}
}
]
}
}
@@ -0,0 +1,117 @@
{
"description": "Vertical gallery with 2 columns with paddings and elements with match_parent width with constraints",
"platforms": [
"android"
],
"templates": {
"item": {
"type": "text",
"height": {
"type": "fixed",
"value": 50
},
"background": [
{
"color": "#AAAAAA",
"type": "solid"
}
],
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
}
}
},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "gallery",
"orientation": "vertical",
"width": {
"type": "fixed",
"value": 300
},
"height": {
"type": "fixed",
"value": 180
},
"column_count": 2,
"cross_spacing": 16,
"paddings": {
"left": 10,
"top": 10,
"right": 10,
"bottom": 10
},
"border": {
"stroke": {
"color": "#BBFF0000",
"width": 2
}
},
"items": [
{
"type": "item",
"width": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"width": {
"type": "match_parent",
"min_size": {
"value": 140
}
},
"text": "min width > gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent",
"max_size": {
"value": 100
}
},
"text": "max width < gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent"
},
"text": "no constraints"
},
{
"type": "item",
"width": {
"type": "match_parent",
"min_size": {
"value": 140
}
},
"text": "min width > gallery width"
},
{
"type": "item",
"width": {
"type": "match_parent",
"max_size": {
"value": 100
}
},
"text": "max width < gallery width"
}
]
}
}
]
}
}