Skip to content

Commit

Permalink
fix the URL text field was blinking while typing in the Variable tab
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-chung committed Feb 11, 2025
1 parent e7ba0b6 commit 192d0ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ fun AppTextFieldWithVariables(
null
},
decorator = if (isSupportVariables) {
remember(themeColors, fonts, variableKeys) {
remember(themeColors, fonts) {
// reuse the same decorator even if variableKeys is changed
// to avoid text field blinking due to re-initialization
EnvironmentVariableDecorator(
themeColors = themeColors,
font = fonts,
knownVariables = variableKeys
)
}.also {
it.knownVariables = variableKeys // update the cache
}
} else {
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.sunnychung.application.multiplatform.hellohttp.ux.local.AppColor
import com.sunnychung.application.multiplatform.hellohttp.ux.local.AppFont
import com.sunnychung.lib.multiplatform.bigtext.core.BigTextDecorator

class EnvironmentVariableDecorator(themeColors: AppColor, font: AppFont, val knownVariables: Set<String>) :
class EnvironmentVariableDecorator(themeColors: AppColor, font: AppFont, var knownVariables: Set<String>) :
BigTextDecorator {
val knownVariableStyle = SpanStyle(
color = themeColors.variableTextColor,
Expand Down

0 comments on commit 192d0ad

Please sign in to comment.