99package com.example.executorchllamademo.ui.screens
1010
1111import androidx.compose.foundation.background
12+ import androidx.compose.foundation.border
1213import androidx.compose.foundation.clickable
1314import androidx.compose.foundation.layout.Column
1415import androidx.compose.foundation.layout.Row
@@ -20,6 +21,7 @@ import androidx.compose.foundation.layout.padding
2021import androidx.compose.foundation.layout.size
2122import androidx.compose.foundation.rememberScrollState
2223import androidx.compose.foundation.shape.RoundedCornerShape
24+ import androidx.compose.foundation.text.BasicTextField
2325import androidx.compose.foundation.text.KeyboardOptions
2426import androidx.compose.foundation.verticalScroll
2527import androidx.compose.material.icons.Icons
@@ -30,7 +32,6 @@ import androidx.compose.material3.Button
3032import androidx.compose.material3.ButtonDefaults
3133import androidx.compose.material3.Icon
3234import androidx.compose.material3.IconButton
33- import androidx.compose.material3.OutlinedTextField
3435import androidx.compose.material3.RadioButton
3536import androidx.compose.material3.Switch
3637import androidx.compose.material3.SwitchDefaults
@@ -45,7 +46,9 @@ import androidx.compose.runtime.setValue
4546import androidx.compose.ui.Alignment
4647import androidx.compose.ui.Modifier
4748import androidx.compose.ui.graphics.Color
49+ import androidx.compose.ui.graphics.SolidColor
4850import androidx.compose.ui.platform.LocalContext
51+ import androidx.compose.ui.text.TextStyle
4952import androidx.compose.ui.text.font.FontWeight
5053import androidx.compose.ui.text.input.KeyboardType
5154import androidx.compose.ui.unit.dp
@@ -162,7 +165,7 @@ fun AppSettingsScreen(
162165 fontWeight = FontWeight .Medium
163166 )
164167 Spacer (modifier = Modifier .height(8 .dp))
165- OutlinedTextField (
168+ BasicTextField (
166169 value = maxSeqLenText,
167170 onValueChange = { newValue ->
168171 maxSeqLenText = newValue
@@ -173,10 +176,31 @@ fun AppSettingsScreen(
173176 prefs.saveAppSettings(appSettings)
174177 }
175178 },
176- label = { Text (" Enter max sequence length" ) },
177179 keyboardOptions = KeyboardOptions (keyboardType = KeyboardType .Number ),
180+ singleLine = true ,
181+ textStyle = TextStyle (
182+ color = appColors.settingsText,
183+ fontSize = 16 .sp
184+ ),
185+ cursorBrush = SolidColor (appColors.settingsText),
178186 modifier = Modifier .fillMaxWidth(),
179- singleLine = true
187+ decorationBox = { innerTextField ->
188+ Row (
189+ modifier = Modifier
190+ .fillMaxWidth()
191+ .border(1 .dp, appColors.settingsText.copy(alpha = 0.5f ), RoundedCornerShape (4 .dp))
192+ .padding(horizontal = 12 .dp, vertical = 14 .dp)
193+ ) {
194+ if (maxSeqLenText.isEmpty()) {
195+ Text (
196+ text = " Enter max sequence length" ,
197+ color = appColors.settingsText.copy(alpha = 0.5f ),
198+ fontSize = 16 .sp
199+ )
200+ }
201+ innerTextField()
202+ }
203+ }
180204 )
181205 Text (
182206 text = " Maximum number of tokens to generate (default: ${AppSettings .DEFAULT_MAX_SEQ_LEN } )" ,
0 commit comments