dark mode-v5
This commit is contained in:
parent
de39e1dc6d
commit
33412637dc
2 changed files with 12 additions and 4 deletions
|
|
@ -4,21 +4,29 @@ import android.os.Bundle
|
|||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import com.example.login_v3.auth.HealthCheckScreen
|
||||
import com.example.login_v3.home.setting.setting_detail_page.viewmodel.Theme_ViewModel
|
||||
import com.example.login_v3.ui.theme.AppTheme
|
||||
import com.example.login_v3.ui.theme.Login_V3Theme
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
//color mode viewmodel
|
||||
private val themeViewModel by viewModels<Theme_ViewModel>()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
|
||||
installSplashScreen()
|
||||
setContent {
|
||||
Login_V3Theme(appTheme = AppTheme.DARK) {
|
||||
val currentAppTheme = themeViewModel.currentTheme.value
|
||||
|
||||
Login_V3Theme(appTheme = currentAppTheme) {
|
||||
Technologia()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ fun setting_theme_page(
|
|||
)
|
||||
Text(
|
||||
text = when(theme) {
|
||||
AppTheme.SYSTEM -> "跟隨系統設定"
|
||||
AppTheme.LIGHT -> "淺色模式"
|
||||
AppTheme.DARK -> "深色模式"
|
||||
AppTheme.SYSTEM -> "follow"
|
||||
AppTheme.LIGHT -> "dark"
|
||||
AppTheme.DARK -> "light"
|
||||
},
|
||||
modifier = Modifier.padding(start = 8.dp)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue