From ecf9396c5ba151eb42da043246a096f4bcaf2242 Mon Sep 17 00:00:00 2001 From: Shivam Goyal Date: Mon, 19 Feb 2024 01:26:51 +0530 Subject: [PATCH] TP-56367 | Disable Default Scroll (#349) --- .../uitron/demo/linkinflator/LinkInflator.kt | 4 +- .../com/uitron/demo/playground/Playground.kt | 4 +- app/src/main/res/raw/mock_buttons.json | 434 +++++++++--------- app/src/main/res/raw/mock_forms.json | 2 +- 4 files changed, 230 insertions(+), 214 deletions(-) diff --git a/app/src/main/java/com/uitron/demo/linkinflator/LinkInflator.kt b/app/src/main/java/com/uitron/demo/linkinflator/LinkInflator.kt index 95d29a6..94a61f1 100644 --- a/app/src/main/java/com/uitron/demo/linkinflator/LinkInflator.kt +++ b/app/src/main/java/com/uitron/demo/linkinflator/LinkInflator.kt @@ -19,8 +19,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.verticalScroll import androidx.compose.material.MaterialTheme import androidx.compose.material.OutlinedTextField import androidx.compose.material.Text @@ -154,7 +152,7 @@ fun LinkInflator(viewModel: LinkInflatorViewModel = hiltViewModel()) { shape = MaterialTheme.shapes.large, ) - Column(modifier = Modifier.verticalScroll(rememberScrollState())) { + Column { if (field.value.trim().isEmpty().not()) { LaunchedEffect(field.value.plus(refreshKey.intValue)) { viewModel.getJsonBlob(field.value.trim()) diff --git a/app/src/main/java/com/uitron/demo/playground/Playground.kt b/app/src/main/java/com/uitron/demo/playground/Playground.kt index 1c2235f..1e9c2dd 100644 --- a/app/src/main/java/com/uitron/demo/playground/Playground.kt +++ b/app/src/main/java/com/uitron/demo/playground/Playground.kt @@ -19,8 +19,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.verticalScroll import androidx.compose.material.MaterialTheme import androidx.compose.material.OutlinedTextField import androidx.compose.material.Text @@ -132,7 +130,7 @@ fun PlaygroundScreen() { shape = MaterialTheme.shapes.large, ) - Column(modifier = Modifier.verticalScroll(rememberScrollState())) { + Column { if (field.value.trim().isEmpty().not()) { var errorMessage: String? = null val uiTronResponse: UiTronResponse? = diff --git a/app/src/main/res/raw/mock_buttons.json b/app/src/main/res/raw/mock_buttons.json index 6665871..e7b2822 100644 --- a/app/src/main/res/raw/mock_buttons.json +++ b/app/src/main/res/raw/mock_buttons.json @@ -1,108 +1,117 @@ { "listOfButtonWidgets": [ { - "title": "Button with text", - "description": "This config is used to create a button with Rounded Corner Shape and a simple text on it.", - "uiTronConfig": { - "view": [{ - "property": { - "shape": { - "size": 100, - "shapeType": "RoundedCornerShape" - }, - "width": "MATCH_PARENT", - "colors": { - "backgroundColor": "#22D081" - }, - "height": "48", - "layoutId": "back_cta_button_permission_footer_widget_id", - "viewType": "Button", - "elevation": { - "defaultElevation": 0 - }, - "isStateFul": true - }, - "childrenViews": [{ - "property": { - "width": "WRAP_CONTENT", - "height": "WRAP_CONTENT", - "fontSize": 14, - "layoutId": "button_text", - "viewType": "Text", - "textColor": "#FFFFFF", - "fontFamily": "ttComposeFontFamily", - "fontWeight": "TT_MEDIUM" + "title": "Button with text", + "description": "This config is used to create a button with Rounded Corner Shape and a simple text on it.", + "uiTronConfig": { + "view": [ + { + "property": { + "shape": { + "size": 100, + "shapeType": "RoundedCornerShape" + }, + "width": "MATCH_PARENT", + "colors": { + "backgroundColor": "#22D081" + }, + "height": "48", + "layoutId": "back_cta_button_permission_footer_widget_id", + "viewType": "Button", + "elevation": { + "defaultElevation": 0 + }, + "isStateFul": true + }, + "childrenViews": [ + { + "property": { + "width": "WRAP_CONTENT", + "height": "WRAP_CONTENT", + "fontSize": 14, + "layoutId": "button_text", + "viewType": "Text", + "textColor": "#FFFFFF", + "fontFamily": "ttComposeFontFamily", + "fontWeight": "TT_MEDIUM" + } + } + ] + } + ], + "data": { + "button_text": { + "text": "Submit", + "viewType": "Text" } - }] - }], - "data": { - "button_text": { - "text": "Submit", - "viewType": "Text" } } - } - }, + }, { "title": "Button with text and trailing icon", "description": "This config is used to create a button with Rounded Corner Shape with a text and a trailing icon on the button.", "uiTronConfig": { - "view": [{ - "property": { - "shape": { - "size": 100, - "shapeType": "RoundedCornerShape" - }, - "width": "MATCH_PARENT", - "colors": { - "backgroundColor": "#22D081" - }, - "height": "48", - "layoutId": "back_cta_button_permission_footer_widget_id", - "viewType": "Button", - "elevation": { - "defaultElevation": 0 - }, - "isStateFul": true - }, - "childrenViews": [{ + "view": [ + { "property": { - "width": "100", - "height": "WRAP_CONTENT", - "layoutId": "button_row", - "viewType": "Row" - }, - "childrenViews": [{ - "property": { - "width": "WRAP_CONTENT", - "height": "WRAP_CONTENT", - "fontSize": 14, - "layoutId": "button_text", - "viewType": "Text", - "textColor": "#FFFFFF", - "fontFamily": "ttComposeFontFamily", - "fontWeight": "TT_MEDIUM" - } - }, - { - "property": { - "width": "8", - "height": "WRAP_CONTENT", - "layoutId": "button_spacer", - "viewType": "Spacer" - } + "shape": { + "size": 100, + "shapeType": "RoundedCornerShape" }, + "width": "MATCH_PARENT", + "colors": { + "backgroundColor": "#22D081" + }, + "height": "48", + "layoutId": "back_cta_button_permission_footer_widget_id", + "viewType": "Button", + "elevation": { + "defaultElevation": 0 + }, + "isStateFul": true + }, + "childrenViews": [ { "property": { - "width": "16", - "height": "16", - "layoutId": "button_icon", - "viewType": "Image" - } + "width": "100", + "height": "WRAP_CONTENT", + "layoutId": "button_row", + "viewType": "Row" + }, + "childrenViews": [ + { + "property": { + "width": "WRAP_CONTENT", + "height": "WRAP_CONTENT", + "fontSize": 14, + "layoutId": "button_text", + "viewType": "Text", + "textColor": "#FFFFFF", + "fontFamily": "ttComposeFontFamily", + "fontWeight": "TT_MEDIUM" + } + }, + { + "property": { + "width": "8", + "height": "WRAP_CONTENT", + "layoutId": "button_spacer", + "viewType": "Spacer" + } + }, + { + "property": { + "width": "16", + "height": "16", + "layoutId": "button_icon", + "viewType": "Image" + } + } + ] } ] - }] - }], + } + ], "data": { "button_text": { "text": "Text Label", @@ -119,63 +128,67 @@ "title": "Button with text and a leading icon", "description": "This config is used to create a button with Rounded Corner Shape with a text and a leading icon on the button.", "uiTronConfig": { - "view": [{ - "property": { - "shape": { - "size": 100, - "shapeType": "RoundedCornerShape" - }, - "width": "MATCH_PARENT", - "colors": { - "backgroundColor": "#22D081" - }, - "height": "48", - "layoutId": "back_cta_button_permission_footer_widget_id", - "viewType": "Button", - "elevation": { - "defaultElevation": 0 - }, - "isStateFul": true - }, - "childrenViews": [{ + "view": [ + { "property": { - "width": "100", - "height": "WRAP_CONTENT", - "layoutId": "button_row", - "viewType": "Row" - }, - "childrenViews": [{ - "property": { - "width": "16", - "height": "16", - "layoutId": "button_icon", - "viewType": "Image" - } - }, - - { - "property": { - "width": "8", - "height": "WRAP_CONTENT", - "layoutId": "button_spacer", - "viewType": "Spacer" - } + "shape": { + "size": 100, + "shapeType": "RoundedCornerShape" }, + "width": "MATCH_PARENT", + "colors": { + "backgroundColor": "#22D081" + }, + "height": "48", + "layoutId": "back_cta_button_permission_footer_widget_id", + "viewType": "Button", + "elevation": { + "defaultElevation": 0 + }, + "isStateFul": true + }, + "childrenViews": [ { "property": { - "width": "WRAP_CONTENT", + "width": "100", "height": "WRAP_CONTENT", - "fontSize": 14, - "layoutId": "button_text", - "viewType": "Text", - "textColor": "#FFFFFF", - "fontFamily": "ttComposeFontFamily", - "fontWeight": "TT_MEDIUM" - } + "layoutId": "button_row", + "viewType": "Row" + }, + "childrenViews": [ + { + "property": { + "width": "16", + "height": "16", + "layoutId": "button_icon", + "viewType": "Image" + } + }, + { + "property": { + "width": "8", + "height": "WRAP_CONTENT", + "layoutId": "button_spacer", + "viewType": "Spacer" + } + }, + { + "property": { + "width": "WRAP_CONTENT", + "height": "WRAP_CONTENT", + "fontSize": 14, + "layoutId": "button_text", + "viewType": "Text", + "textColor": "#FFFFFF", + "fontFamily": "ttComposeFontFamily", + "fontWeight": "TT_MEDIUM" + } + } + ] } ] - }] - }], + } + ], "data": { "button_text": { "text": "Text Label", @@ -192,41 +205,44 @@ "title": "Outlined Rectangle Button", "description": "This config is used to create a button with rectangle shape with a text, shadow and a border.", "uiTronConfig": { - "view": [{ - "property": { - "shape": { - "size": 100, - "shapeType": null - }, - "width": "MATCH_PARENT", - "colors": { - "backgroundColor": "#22D081" - }, - "borderStroke": { - "width": 1, - "color": "#FFFFFF" - }, - "height": "48", - "layoutId": "button_with_border_id", - "viewType": "Button", - "elevation": { - "defaultElevation": 4 - }, - "isStateFul": false - }, - "childrenViews": [{ + "view": [ + { "property": { - "width": "WRAP_CONTENT", - "height": "WRAP_CONTENT", - "fontSize": 14, - "layoutId": "button_text", - "viewType": "Text", - "textColor": "#FFFFFF", - "fontFamily": "ttComposeFontFamily", - "fontWeight": "TT_MEDIUM" - } - }] - }], + "shape": { + "size": 100 + }, + "width": "MATCH_PARENT", + "colors": { + "backgroundColor": "#22D081" + }, + "borderStroke": { + "width": 1, + "color": "#FFFFFF" + }, + "height": "48", + "layoutId": "button_with_border_id", + "viewType": "Button", + "elevation": { + "defaultElevation": 4 + }, + "isStateFul": false + }, + "childrenViews": [ + { + "property": { + "width": "WRAP_CONTENT", + "height": "WRAP_CONTENT", + "fontSize": 14, + "layoutId": "button_text", + "viewType": "Text", + "textColor": "#FFFFFF", + "fontFamily": "ttComposeFontFamily", + "fontWeight": "TT_MEDIUM" + } + } + ] + } + ], "data": { "button_text": { "text": "Submit", @@ -239,41 +255,45 @@ "title": "Outlined Rounded Corner Shape Button", "description": "This config is used to create a button with rounded corner shape with a text, shadow and a border.", "uiTronConfig": { - "view": [{ - "property": { - "shape": { - "size": 40, - "shapeType": "RoundedCornerShape" - }, - "width": "MATCH_PARENT", - "colors": { - "backgroundColor": "#22D081" - }, - "borderStroke": { - "width": 1, - "color": "#00FFFF" - }, - "height": "48", - "layoutId": "button_with_border_id", - "viewType": "Button", - "elevation": { - "defaultElevation": 4 - }, - "isStateFul": false - }, - "childrenViews": [{ + "view": [ + { "property": { - "width": "WRAP_CONTENT", - "height": "WRAP_CONTENT", - "fontSize": 14, - "layoutId": "button_text", - "viewType": "Text", - "textColor": "#FFFFFF", - "fontFamily": "ttComposeFontFamily", - "fontWeight": "TT_MEDIUM" - } - }] - }], + "shape": { + "size": 40, + "shapeType": "RoundedCornerShape" + }, + "width": "MATCH_PARENT", + "colors": { + "backgroundColor": "#22D081" + }, + "borderStroke": { + "width": 1, + "color": "#00FFFF" + }, + "height": "48", + "layoutId": "button_with_border_id", + "viewType": "Button", + "elevation": { + "defaultElevation": 4 + }, + "isStateFul": false + }, + "childrenViews": [ + { + "property": { + "width": "WRAP_CONTENT", + "height": "WRAP_CONTENT", + "fontSize": 14, + "layoutId": "button_text", + "viewType": "Text", + "textColor": "#FFFFFF", + "fontFamily": "ttComposeFontFamily", + "fontWeight": "TT_MEDIUM" + } + } + ] + } + ], "data": { "button_text": { "text": "Next", diff --git a/app/src/main/res/raw/mock_forms.json b/app/src/main/res/raw/mock_forms.json index 944b8f2..f1dfd9e 100644 --- a/app/src/main/res/raw/mock_forms.json +++ b/app/src/main/res/raw/mock_forms.json @@ -1,5 +1,5 @@ { - "listOfFormWidgets" : [ + "listOfFormWidgets": [ { "title": "LabelWithName", "description": "This widget is used to input name. Tt also has validation on text enter.",