@@ -15,7 +15,9 @@ import androidx.compose.foundation.layout.height
1515import androidx.compose.foundation.layout.padding
1616import androidx.compose.foundation.layout.size
1717import androidx.compose.foundation.layout.wrapContentHeight
18+ import androidx.compose.foundation.rememberScrollState
1819import androidx.compose.foundation.shape.RoundedCornerShape
20+ import androidx.compose.foundation.verticalScroll
1921import androidx.compose.material3.Button
2022import androidx.compose.material3.CircularProgressIndicator
2123import androidx.compose.material3.ExperimentalMaterial3Api
@@ -27,7 +29,6 @@ import androidx.compose.material3.Text
2729import androidx.compose.runtime.Composable
2830import androidx.compose.runtime.LaunchedEffect
2931import androidx.compose.runtime.MutableState
30- import androidx.compose.runtime.State
3132import androidx.compose.runtime.derivedStateOf
3233import androidx.compose.runtime.getValue
3334import androidx.compose.runtime.mutableStateOf
@@ -83,6 +84,7 @@ fun CommandExtrasBottomSheet(
8384 }
8485 }
8586
87+
8688 @Composable
8789 fun bottomSheetContent () {
8890 Box (
@@ -102,6 +104,7 @@ fun CommandExtrasBottomSheet(
102104 Modifier
103105 // .fillMaxSize()
104106 .padding(horizontal = 15 .dp)
107+
105108 ) {
106109
107110 viewModel.currentExtrasDetails.value?.let {
@@ -179,6 +182,8 @@ fun CommandExtraInputs(command: CommandModel, parentSheetState: SheetState? = nu
179182 Timber .d(" Extra commands list: $commandExtraInputs " )
180183 }
181184
185+ val scrollState = rememberScrollState()
186+
182187 Text (
183188 text = command.name,
184189 lineHeight = 32 .sp,
@@ -189,131 +194,134 @@ fun CommandExtraInputs(command: CommandModel, parentSheetState: SheetState? = nu
189194
190195 Spacer (modifier = Modifier .height(20 .dp))
191196
192- FlowRow (
193- horizontalArrangement = Arrangement .spacedBy(20 .dp),
194- verticalArrangement = Arrangement .spacedBy(20 .dp)
195- ) {
197+ Box (){
198+ FlowRow (
199+ horizontalArrangement = Arrangement .spacedBy(20 .dp),
200+ verticalArrangement = Arrangement .spacedBy(20 .dp),
201+ modifier = Modifier .verticalScroll(scrollState).padding(bottom = 90 .dp)
202+ ) {
196203
197- // Timber.d("FileUris: $fileUris")
198- // Timber.d("currentLink: $currentLink")
199204
200- if (fileUris == null && currentLink == null && command.command.contains(" INPUT_FILE" )){
205+ if (fileUris == null && currentLink == null && command.command.contains(" INPUT_FILE" )){
201206
202- GenericTextAndSelectorFormField (text = extraInput, title = " INPUT" , subtitle = " Put file or url here to set as \$ {INPUT_FILE} for the command." )
203- }else {
204- Spacer (modifier = Modifier .height(7 .dp))
205- }
207+ GenericTextAndSelectorFormField (text = extraInput, title = " INPUT" , subtitle = " Put file or url here to set as \$ {INPUT_FILE} for the command." )
208+ }else {
209+ Spacer (modifier = Modifier .height(7 .dp))
210+ }
206211
207- for (extra in command.extras ? : emptyList()) {
208- Column (Modifier .fillMaxWidth(if (extra.description.isNotEmpty()) 1F else 0.47F )) {
209- when (extra.type) {
210- " STRING" -> {
211- val textValue = remember {
212- mutableStateOf(extra.default)
213- }
212+ for (extra in command.extras ? : emptyList()) {
213+ Column (Modifier .fillMaxWidth(if (extra.description.isNotEmpty()) 1F else 0.47F )) {
214+ when (extra.type) {
215+ " STRING" -> {
216+ val textValue = remember {
217+ mutableStateOf(extra.default)
218+ }
214219
215- LaunchedEffect (key1 = textValue.value) {
216- addToExtraInputs(
217- CommandExtraInput (
218- extra.name,
219- extra.default,
220- textValue.value,
221- extra.type,
222- extra.defaultBoolean,
223- extra.id,
224- extra.description
220+ LaunchedEffect (key1 = textValue.value) {
221+ addToExtraInputs(
222+ CommandExtraInput (
223+ extra.name,
224+ extra.default,
225+ textValue.value,
226+ extra.type,
227+ extra.defaultBoolean,
228+ extra.id,
229+ extra.description
230+ )
225231 )
226- )
227- }
228-
229- GenericTextFormField (text = textValue, title = extra.name, subtitle = extra.description)
230- }
231-
232- " BOOLEAN" -> {
233- val booleanExpanded = remember { mutableStateOf(false ) }
234- val selectedOptionForBoolean =
235- rememberSaveable {
236- mutableStateOf(extra.defaultBoolean.toString().uppercase())
237232 }
238- val booleanOptions = listOf (" TRUE" , " FALSE" )
239-
240- LaunchedEffect (key1 = selectedOptionForBoolean.value) {
241- addToExtraInputs(
242- CommandExtraInput (
243- extra.name,
244- extra.default,
245- selectedOptionForBoolean.value,
246- extra.type,
247- extra.defaultBoolean,
248- extra.id,
249- extra.description
250- )
251- )
252- }
253233
254- Text (text = extra.name, fontSize = 18 .sp, fontWeight = FontWeight .SemiBold )
255- if (extra.description.isNotEmpty()){
256- Spacer (modifier = Modifier .height(3 .dp))
257- Text (text = extra.description, fontSize = 14 .sp, fontWeight = FontWeight .Normal )
234+ GenericTextFormField (text = textValue, title = extra.name, subtitle = extra.description)
258235 }
259- Spacer (modifier = Modifier .height(10 .dp))
260-
261236
262- OptionSelector (
263- options = booleanOptions,
264- selectedOption = selectedOptionForBoolean,
265- expanded = booleanExpanded
266- )
267- }
268-
269- " SELECTABLE" -> {
270- val expanded = remember { mutableStateOf(false ) }
271- val selectedOption =
272- rememberSaveable {
273- mutableStateOf(extra.default)
274- }
275- val options = extra.selectableOptions
276-
277- LaunchedEffect (key1 = selectedOption.value) {
278- addToExtraInputs(
279- CommandExtraInput (
280- extra.name,
281- extra.default,
282- selectedOption.value,
283- extra.type,
284- extra.defaultBoolean,
285- extra.id,
286- extra.description
237+ " BOOLEAN" -> {
238+ val booleanExpanded = remember { mutableStateOf(false ) }
239+ val selectedOptionForBoolean =
240+ rememberSaveable {
241+ mutableStateOf(extra.defaultBoolean.toString().uppercase())
242+ }
243+ val booleanOptions = listOf (" TRUE" , " FALSE" )
244+
245+ LaunchedEffect (key1 = selectedOptionForBoolean.value) {
246+ addToExtraInputs(
247+ CommandExtraInput (
248+ extra.name,
249+ extra.default,
250+ selectedOptionForBoolean.value,
251+ extra.type,
252+ extra.defaultBoolean,
253+ extra.id,
254+ extra.description
255+ )
287256 )
288- )
289- }
257+ }
290258
291- Column {
292- Text (
293- text = extra.name,
294- fontSize = 18 .sp,
295- fontWeight = FontWeight .SemiBold
296- )
259+ Text (text = extra.name, fontSize = 18 .sp, fontWeight = FontWeight .SemiBold )
297260 if (extra.description.isNotEmpty()){
298261 Spacer (modifier = Modifier .height(3 .dp))
299262 Text (text = extra.description, fontSize = 14 .sp, fontWeight = FontWeight .Normal )
300263 }
301264 Spacer (modifier = Modifier .height(10 .dp))
302265
266+
303267 OptionSelector (
304- options = options ,
305- selectedOption = selectedOption ,
306- expanded = expanded
268+ options = booleanOptions ,
269+ selectedOption = selectedOptionForBoolean ,
270+ expanded = booleanExpanded
307271 )
308272 }
273+
274+ " SELECTABLE" -> {
275+ val expanded = remember { mutableStateOf(false ) }
276+ val selectedOption =
277+ rememberSaveable {
278+ mutableStateOf(extra.default)
279+ }
280+ val options = extra.selectableOptions
281+
282+ LaunchedEffect (key1 = selectedOption.value) {
283+ addToExtraInputs(
284+ CommandExtraInput (
285+ extra.name,
286+ extra.default,
287+ selectedOption.value,
288+ extra.type,
289+ extra.defaultBoolean,
290+ extra.id,
291+ extra.description
292+ )
293+ )
294+ }
295+
296+ Column {
297+ Text (
298+ text = extra.name,
299+ fontSize = 18 .sp,
300+ fontWeight = FontWeight .SemiBold
301+ )
302+ if (extra.description.isNotEmpty()){
303+ Spacer (modifier = Modifier .height(3 .dp))
304+ Text (text = extra.description, fontSize = 14 .sp, fontWeight = FontWeight .Normal )
305+ }
306+ Spacer (modifier = Modifier .height(10 .dp))
307+
308+ OptionSelector (
309+ options = options,
310+ selectedOption = selectedOption,
311+ expanded = expanded
312+ )
313+ }
314+ }
309315 }
310- }
311316
312317
318+ }
313319 }
320+
314321 }
315322
316- Row {
323+
324+ Row (Modifier .align(Alignment .BottomCenter )){
317325 Button (
318326 modifier = Modifier
319327 .padding(vertical = 15 .dp)
@@ -390,5 +398,8 @@ fun CommandExtraInputs(command: CommandModel, parentSheetState: SheetState? = nu
390398
391399 }
392400 }
401+
402+
393403 }
404+
394405}
0 commit comments