LazyColumn in progress of being fixed
This commit is contained in:
		
							parent
							
								
									2ca112ee0e
								
							
						
					
					
						commit
						535ef85c6d
					
				
					 1 changed files with 124 additions and 108 deletions
				
			
		|  | @ -1,7 +1,6 @@ | |||
| package be.ugent.sel.studeez.screens.timer_overview.add_timer | ||||
| 
 | ||||
| import androidx.compose.foundation.layout.Arrangement | ||||
| import androidx.compose.foundation.layout.Column | ||||
| import androidx.compose.foundation.layout.Row | ||||
| import androidx.compose.foundation.layout.fillMaxHeight | ||||
| import androidx.compose.foundation.layout.fillMaxWidth | ||||
|  | @ -22,6 +21,7 @@ import be.ugent.sel.studeez.R | |||
| import be.ugent.sel.studeez.common.composable.BasicButton | ||||
| import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate | ||||
| import be.ugent.sel.studeez.resources | ||||
| import be.ugent.sel.studeez.ui.theme.StudeezTheme | ||||
| 
 | ||||
| data class AddTimerActions( | ||||
|     val goBack: () -> Unit, | ||||
|  | @ -79,11 +79,12 @@ fun AddTimerScreen( | |||
|         title = resources().getString(R.string.add_timer), | ||||
|         popUp = addTimerActions.goBack | ||||
|     ) { | ||||
|         Column( | ||||
|         LazyColumn( | ||||
|             modifier = Modifier | ||||
|                 .fillMaxWidth() | ||||
|                 .padding(16.dp) | ||||
|         ) { | ||||
|             item { | ||||
|                 Row( | ||||
|                     modifier = Modifier.fillMaxWidth(), | ||||
|                     verticalAlignment = Alignment.CenterVertically, | ||||
|  | @ -94,15 +95,13 @@ fun AddTimerScreen( | |||
|                         textAlign = TextAlign.Center | ||||
|                     ) | ||||
|                 } | ||||
| 
 | ||||
|             LazyColumn( | ||||
|                 modifier = Modifier | ||||
|                     .padding(16.dp) | ||||
|             ) { | ||||
|             } | ||||
|             item { | ||||
|                 Text( | ||||
|                     text = "${uiState.studyTimeHours.toInt()} hour${ if (uiState.studyTimeHours == 1f) "" else "s"}" | ||||
|                 ) | ||||
|             } | ||||
|             item { | ||||
|                 Slider( | ||||
|                     value = uiState.studyTimeHours, | ||||
|                     onValueChange = { | ||||
|  | @ -112,10 +111,13 @@ fun AddTimerScreen( | |||
|                     valueRange = 1f..10f, | ||||
|                     enabled = true | ||||
|                 ) | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Text( | ||||
|                     text = "${uiState.studyTimeMinutes.toInt()} minutes" | ||||
|                 ) | ||||
|             } | ||||
|             item { | ||||
|                 Slider( | ||||
|                     value = uiState.studyTimeMinutes, | ||||
|                     onValueChange = { | ||||
|  | @ -125,7 +127,8 @@ fun AddTimerScreen( | |||
|                     valueRange = 0f..60f, | ||||
|                     enabled = true | ||||
|                 ) | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Row( | ||||
|                     modifier = Modifier.fillMaxWidth(), | ||||
|                     verticalAlignment = Alignment.CenterVertically, | ||||
|  | @ -139,10 +142,13 @@ fun AddTimerScreen( | |||
|                         onCheckedChange = { addTimerActions.onWithBreaksChange(it) } | ||||
|                     ) | ||||
|                 } | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Text( | ||||
|                     text = if (uiState.withBreaks) "breaks of ${uiState.breakTime.toInt()} minutes" else "", | ||||
|                 ) | ||||
|             } | ||||
|             item { | ||||
|                 Slider( | ||||
|                     value = uiState.breakTime, | ||||
|                     onValueChange = { | ||||
|  | @ -152,10 +158,13 @@ fun AddTimerScreen( | |||
|                     valueRange = 0f..60f, | ||||
|                     enabled = uiState.withBreaks | ||||
|                 ) | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Text( | ||||
|                     text = if (uiState.withBreaks) "${uiState.repeats.toInt()} breaks" else "" | ||||
|                 ) | ||||
|             } | ||||
|             item { | ||||
|                 Slider( | ||||
|                     value = uiState.repeats, | ||||
|                     onValueChange = { | ||||
|  | @ -165,23 +174,30 @@ fun AddTimerScreen( | |||
|                     valueRange = 1f..10f, | ||||
|                     enabled = uiState.withBreaks | ||||
|                 ) | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Text( | ||||
|                     text = "Timer name" | ||||
|                 ) | ||||
|             } | ||||
|             item { | ||||
|                 TextField( | ||||
|                     value = uiState.name, | ||||
|                     onValueChange = { addTimerActions.onNameChange(it) } | ||||
|                 ) | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Text( | ||||
|                     text = "Timer description" | ||||
|                 ) | ||||
|             } | ||||
|             item { | ||||
|                 TextField( | ||||
|                     value = uiState.description, | ||||
|                     onValueChange = { addTimerActions.onDescriptionChange(it) } | ||||
|                 ) | ||||
| 
 | ||||
|             } | ||||
|             item { | ||||
|                 Row( | ||||
|                     modifier = Modifier | ||||
|                         .fillMaxWidth() | ||||
|  | @ -199,13 +215,13 @@ fun AddTimerScreen( | |||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| 
 | ||||
| @Preview | ||||
| @Composable | ||||
| fun AddTimerScreenPreview() { | ||||
| fun AddTimerScreenPreview() { StudeezTheme { | ||||
|     AddTimerScreen( | ||||
|         addTimerActions = AddTimerActions({}, {}, {}, {}, {}, {}, {}, {}, {}), | ||||
|         uiState = AddTimerUiState() | ||||
|         ) | ||||
|     } | ||||
| } | ||||
		Reference in a new issue
	
	 Rune Dyselinck
						Rune Dyselinck