We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am unable to change the checked setting on both SettingsSwitch and SettingsCheckbox.
Gradle Settings
plugins { id 'com.android.application' id 'kotlin-android' } android { compileSdk 31 defaultConfig { applicationId "com.CliftonSoftware.hobbsLogger" minSdk 29 targetSdk 31 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary true } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' useIR = true } buildFeatures { compose true } composeOptions { kotlinCompilerExtensionVersion compose_version kotlinCompilerVersion '1.5.21' } packagingOptions { resources { excludes += '/META-INF/{AL2.0,LGPL2.1}' } } }
Here is the code I am using:
@Composable fun SettingScreenContent( ){ var darkTheme = remember {false} var icon = remember{Icons.Default.ModeNight} Column() { SettingsSwitch( icon = { Icon(imageVector = icon , contentDescription = "Theme") }, title = { Text(text = "Dark Theme") }, checked = darkTheme, onCheckedChange = { icon = if(icon == Icons.Default.ModeNight){ Icons.Default.LightMode }else{ Icons.Default.ModeNight } darkTheme = !darkTheme }, ) } }
The text was updated successfully, but these errors were encountered:
I could be using this wrong, please let me know if this is the case.
Sorry, something went wrong.
I also notice I do not have the touch button in my compose preview of the item.
You must use:
var darkTheme = remember { mutableStateOf(false) }
No branches or pull requests
I am unable to change the checked setting on both SettingsSwitch and SettingsCheckbox.
Gradle Settings
Here is the code I am using:
The text was updated successfully, but these errors were encountered: