-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated toolbars to not be shared on the homepage
- Loading branch information
Showing
6 changed files
with
113 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/movie/metropolis/app/screen/home/component/ScreenState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package movie.metropolis.app.screen.home.component | ||
|
||
import androidx.compose.foundation.lazy.* | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.* | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.ViewModel | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
data class ScreenState<T>( | ||
val behavior: TopAppBarScrollBehavior, | ||
val list: LazyListState, | ||
val viewModel: T | ||
) | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
inline fun <reified V : ViewModel> rememberScreenState(): ScreenState<V> { | ||
return ScreenState( | ||
behavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(), | ||
list = rememberLazyListState(), | ||
viewModel = hiltViewModel() | ||
) | ||
} |
Oops, something went wrong.