-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
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
Migrate PlatformsForm.kt to Kotlin UI DSL Version 2 #7310
Milestone
Comments
Dear Google team, as I maintained a fork for WebStorm(the Flutter Storm plugin), please try the following in DSL 2(please make sure to check may be something different or potential bugs): import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.dsl.builder.*
import com.intellij.ui.layout.ComponentPredicate
import io.flutter.FlutterBundle
import io.flutter.sdk.FlutterCreateAdditionalSettings
class PlatformsForm {
var channel: FlutterSdkChannel? = null
private var configAndroid: Boolean = true
private var configIos: Boolean = true
private var configLinux: Boolean = true
private var configMacos: Boolean = true
private var configWeb: Boolean = true
private var configWindows: Boolean = true
var component: DialogPanel? = null
fun panel(settings: FlutterCreateAdditionalSettings) =
panel {
row {
makeCheckBox( FlutterBundle.message("npw_platform_android"), settings.platformAndroidProperty, configAndroid)
makeCheckBox( FlutterBundle.message("npw_platform_ios"), settings.platformIosProperty, configIos)
makeCheckBox( FlutterBundle.message("npw_platform_linux"), settings.platformLinuxProperty, configLinux)
makeCheckBox( FlutterBundle.message("npw_platform_macos"), settings.platformMacosProperty, configMacos)
makeCheckBox( FlutterBundle.message("npw_platform_web"), settings.platformWebProperty, configWeb)
makeCheckBox( FlutterBundle.message("npw_platform_windows"), settings.platformWindowsProperty, configWindows)
}
row {
label(FlutterBundle.message("npw_platform_selection_help"))
}
}.apply { component = this }
private fun Row.makeCheckBox(name: String, property: InitializeOnceBoolValueProperty,
config: Boolean?) {
val wasSelected = config == true
property.initialize(wasSelected)
val names: List<String> = listOfNotNull(
FlutterBundle.message("npw_platform_android"),
FlutterBundle.message("npw_platform_ios"),
FlutterBundle.message("npw_platform_web"),
FlutterBundle.message("npw_platform_windows"),
FlutterBundle.message("npw_platform_linux"),
FlutterBundle.message("npw_platform_macos"),
)
checkBox(name)
.actionListener { _, button -> property.set(button.isSelected) }.selected(property.get())
.enabledIf( ComponentPredicate.fromValue( names.contains(name) || wasSelected ) )
}
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
com.intellij.ui.layout.Cell deprecation, see https://plugins.jetbrains.com/docs/intellij/kotlin-ui-dsl-version-2.html
File in the Flutter IJ plugin:
io/flutter/module/settings/PlatformsForm.kt
.The text was updated successfully, but these errors were encountered: