فهرست منبع

text size in input fields

milan jurkulák 2 سال پیش
والد
کامیت
2220387767

+ 2 - 0
src/main/kotlin/eu/mjdev/desktop/components/appsmenu/AppsBottomBar.kt

@@ -12,6 +12,7 @@ import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.text.TextStyle
 import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.sp
 import eu.mjdev.desktop.components.icon.ShapedIcon
 import eu.mjdev.desktop.components.input.SearchFieldPassive
 import eu.mjdev.desktop.extensions.Compose.clear
@@ -38,6 +39,7 @@ fun AppsBottomBar(
                 modifier = Modifier.fillMaxWidth().focusable(true),
                 textState = searchTextState,
                 textColor = iconsTintColor,
+                textSize = 20.sp,
                 textStyle = TextStyle(
                     fontWeight = FontWeight.Bold
                 ),

+ 4 - 0
src/main/kotlin/eu/mjdev/desktop/components/input/SearchFieldPassive.kt

@@ -21,7 +21,9 @@ import androidx.compose.runtime.mutableStateOf
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.unit.TextUnit
 import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
 import eu.mjdev.desktop.icons.Icons
 
 @OptIn(ExperimentalFoundationApi::class)
@@ -31,6 +33,7 @@ fun SearchFieldPassive(
     textState: MutableState<String> = mutableStateOf(""),
     textColor: Color = Color.White,
     textStyle: TextStyle = TextStyle.Default,
+    textSize:TextUnit = 18.sp,
     onClearClick: () -> Unit = {}
 ) = SelectableOutlineEditText(
     value = textState.value,
@@ -38,6 +41,7 @@ fun SearchFieldPassive(
     enabled = false,
     singleLine = true,
     textStyle = textStyle,
+    textSize=textSize,
     colors = TextFieldDefaults.outlinedTextFieldColors(
         backgroundColor = Color.Transparent,
         textColor = textColor,

+ 3 - 1
src/main/kotlin/eu/mjdev/desktop/components/input/SelectableOutlineEditText.kt

@@ -14,6 +14,7 @@ import androidx.compose.ui.graphics.Shape
 import androidx.compose.ui.text.TextStyle
 import androidx.compose.ui.text.input.TextFieldValue
 import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.unit.TextUnit
 
 @Composable
 fun SelectableOutlineEditText(
@@ -23,6 +24,7 @@ fun SelectableOutlineEditText(
     enabled: Boolean = true,
     readOnly: Boolean = false,
     textStyle: TextStyle = TextStyle.Default,
+    textSize: TextUnit = TextUnit.Unspecified,
     label: @Composable (() -> Unit)? = null,
     placeholder: @Composable (() -> Unit)? = null,
     leadingIcon: @Composable (() -> Unit)? = null,
@@ -45,7 +47,7 @@ fun SelectableOutlineEditText(
         onValueChange = onValueChange,
         enabled = enabled,
         readOnly = readOnly,
-        textStyle = textStyle,
+        textStyle = textStyle.copy(fontSize = textSize),
         label = label,
         placeholder = placeholder,
         leadingIcon = leadingIcon,