11package com.codandotv.streamplayerapp.feature_list_streams.detail.presentation.screens
22
33import android.annotation.SuppressLint
4- import androidx.compose.foundation.ScrollState
54import androidx.compose.foundation.layout.*
5+ import androidx.compose.foundation.rememberScrollState
66import androidx.compose.foundation.verticalScroll
77import androidx.compose.material.icons.Icons
88import androidx.compose.material.icons.filled.*
@@ -37,23 +37,20 @@ fun DetailStreamScreen(
3737 val lifecycleOwner = LocalLifecycleOwner .current
3838 Lifecycle (lifecycleOwner, viewModel, disposable)
3939
40- Box (
41- modifier = Modifier
42- .fillMaxSize()
43- .verticalScroll(ScrollState (0 ))
44- ) {
45- when (uiState) {
46- is DetailStreamsLoadedUIState -> {
47- SetupDetailScreen (uiState as DetailStreamsLoadedUIState , navController)
48- }
49- else -> {
40+ when (uiState) {
41+ is DetailStreamsLoadedUIState -> {
42+ SetupDetailScreen (uiState as DetailStreamsLoadedUIState , navController)
43+ }
44+ else -> {
45+ Box (Modifier .fillMaxSize()) {
5046 CircularProgressIndicator (
5147 modifier = Modifier .align(
5248 Alignment .Center
5349 )
5450 )
5551 }
5652 }
53+
5754 }
5855}
5956
@@ -63,69 +60,75 @@ fun DetailStreamScreen(
6360private fun SetupDetailScreen (
6461 uiState : DetailStreamsLoadedUIState , navController : NavController
6562) {
66- Scaffold (topBar = {
67- DetailStreamToolbar (navController = navController)
68- }, content = { innerPadding ->
69- Column (
70- Modifier
71- .fillMaxSize()
72- .padding(innerPadding)
73- ) {
74- DetailStreamImagePreview (uiState)
63+ Scaffold (
64+ topBar = {
65+ DetailStreamToolbar (navController = navController)
66+ },
67+ content = { innerPadding ->
7568 Column (
76- modifier = Modifier
77- .fillMaxSize()
78- .padding(start = 16 .dp, end = 16 .dp, top = 8 .dp)
69+ Modifier
70+ .fillMaxWidth()
71+ .verticalScroll(rememberScrollState())
72+ .padding(innerPadding)
7973 ) {
80- DetailStreamRowHeader ()
81- Text (
82- text = uiState.detailStream.title,
83- style = MaterialTheme .typography.headlineMedium.copy(
84- fontWeight = FontWeight .Bold , fontSize = 28 .sp
74+ DetailStreamImagePreview (uiState)
75+ Column (
76+ modifier = Modifier
77+ .fillMaxWidth()
78+ .padding(start = 16 .dp, end = 16 .dp, top = 8 .dp)
79+ ) {
80+ DetailStreamRowHeader ()
81+ Text (
82+ text = uiState.detailStream.title,
83+ style = MaterialTheme .typography.headlineMedium.copy(
84+ fontWeight = FontWeight .Bold , fontSize = 28 .sp
85+ )
8586 )
86- )
87- Spacer (modifier = Modifier .height( 8 .dp))
88- Text (
89- text = uiState.detailStream.releaseYear,
90- style = MaterialTheme .typography.headlineMedium.copy(
91- color = MaterialTheme .colorScheme.onSurfaceVariant,
92- fontSize = 14 .sp, fontWeight = FontWeight . Bold
87+ Spacer (modifier = Modifier .height( 8 .dp) )
88+ Text (
89+ text = uiState.detailStream.releaseYear,
90+ style = MaterialTheme .typography.headlineMedium.copy(
91+ color = MaterialTheme .colorScheme.onSurfaceVariant,
92+ fontSize = 14 .sp, fontWeight = FontWeight . Bold
93+ )
9394 )
94- )
95- Spacer (modifier = Modifier .height(8 .dp))
96- DetailStreamButtonAction (
97- buttonsColors = ButtonDefaults .buttonColors(
98- containerColor = MaterialTheme .colorScheme.surface
99- ),
100- imageVector = Icons .Filled .PlayArrow ,
101- imageVectorColor = MaterialTheme .colorScheme.onSurface,
102- text = stringResource(R .string.detail_watch_primary_button),
103- textColor = MaterialTheme .colorScheme.onSurface,
104- onClick = {},
105- )
106- Spacer (modifier = Modifier .height(4 .dp))
107- DetailStreamButtonAction (
108- buttonsColors = ButtonDefaults .buttonColors(
109- containerColor = MaterialTheme .colorScheme.onSurfaceVariant
110- ),
111- imageVector = Icons .Filled .FileDownload ,
112- imageVectorColor = MaterialTheme .colorScheme.onSurface,
113- text = stringResource(id = R .string.detail_default_text_secondary_button),
114- textColor = MaterialTheme .colorScheme.onSurface,
115- onClick = {},
116- )
117- Text (
118- text = uiState.detailStream.overview,
119- style = MaterialTheme .typography.headlineMedium.copy(
120- color = MaterialTheme .colorScheme.onSurface, fontSize = 16 .sp, lineHeight = 1.25 .em
121- ),
122- modifier = Modifier .padding(top = 8 .dp, bottom = 16 .dp)
123- )
124- Spacer (modifier = Modifier .height(8 .dp))
125- DetailStreamActionOption ()
95+ Spacer (modifier = Modifier .height(8 .dp))
96+ DetailStreamButtonAction (
97+ buttonsColors = ButtonDefaults .buttonColors(
98+ containerColor = MaterialTheme .colorScheme.surface
99+ ),
100+ imageVector = Icons .Filled .PlayArrow ,
101+ imageVectorColor = MaterialTheme .colorScheme.onSurface,
102+ text = stringResource(R .string.detail_watch_primary_button),
103+ textColor = MaterialTheme .colorScheme.onSurface,
104+ onClick = {},
105+ )
106+ Spacer (modifier = Modifier .height(4 .dp))
107+ DetailStreamButtonAction (
108+ buttonsColors = ButtonDefaults .buttonColors(
109+ containerColor = MaterialTheme .colorScheme.onSurfaceVariant
110+ ),
111+ imageVector = Icons .Filled .FileDownload ,
112+ imageVectorColor = MaterialTheme .colorScheme.onSurface,
113+ text = stringResource(id = R .string.detail_default_text_secondary_button),
114+ textColor = MaterialTheme .colorScheme.onSurface,
115+ onClick = {},
116+ )
117+ Text (
118+ text = uiState.detailStream.overview,
119+ style = MaterialTheme .typography.headlineMedium.copy(
120+ color = MaterialTheme .colorScheme.onSurface,
121+ fontSize = 16 .sp,
122+ lineHeight = 1.25 .em
123+ ),
124+ modifier = Modifier .padding(top = 8 .dp, bottom = 16 .dp)
125+ )
126+ Spacer (modifier = Modifier .height(8 .dp))
127+ DetailStreamActionOption ()
128+ Spacer (modifier = Modifier .height(16 .dp))
129+ }
126130 }
127- }
128- })
131+ })
129132}
130133
131134@Composable
0 commit comments