Init login screen
Hook up view model TODO: domain logic + make composable components
This commit is contained in:
parent
5847f668d2
commit
3f2cfdee45
@ -6,6 +6,7 @@ import androidx.navigation.NavHostController
|
|||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import com.nto.data.utils.Destinations
|
import com.nto.data.utils.Destinations
|
||||||
|
import com.nto.presentation.screens.loginScreen.LoginScreen
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Navigation(navController: NavHostController, modifier: Modifier = Modifier) {
|
fun Navigation(navController: NavHostController, modifier: Modifier = Modifier) {
|
||||||
@ -15,7 +16,7 @@ fun Navigation(navController: NavHostController, modifier: Modifier = Modifier)
|
|||||||
startDestination = Destinations.Login.toString()
|
startDestination = Destinations.Login.toString()
|
||||||
) {
|
) {
|
||||||
composable(Destinations.Login.toString()) {
|
composable(Destinations.Login.toString()) {
|
||||||
//TODO
|
LoginScreen(navController)
|
||||||
}
|
}
|
||||||
composable(Destinations.Profile.toString()){
|
composable(Destinations.Profile.toString()){
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.nto.presentation.screens.loginScreen
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import androidx.navigation.NavHostController
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun LoginScreen(
|
||||||
|
navController: NavHostController,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
viewModel: LoginViewModel = hiltViewModel<LoginViewModel>(),
|
||||||
|
) {
|
||||||
|
val state = viewModel.state.collectAsState()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.nto.presentation.screens.loginScreen
|
||||||
|
|
||||||
|
|
||||||
|
data class LoginScreenState(
|
||||||
|
var email: String = "",
|
||||||
|
var password: String = "",
|
||||||
|
var disabled: Boolean = true
|
||||||
|
)
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.nto.presentation.screens.loginScreen
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class LoginViewModel @Inject constructor(): ViewModel(){
|
||||||
|
private val _state = MutableStateFlow(LoginScreenState())
|
||||||
|
|
||||||
|
val state: StateFlow<LoginScreenState>
|
||||||
|
get() = _state.asStateFlow()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user