@@ -41,6 +41,7 @@ import androidx.compose.material3.HorizontalDivider
4141import androidx.compose.material3.Icon
4242import androidx.compose.material3.LinearProgressIndicator
4343import androidx.compose.material3.MaterialTheme
44+ import androidx.compose.material3.SmallFloatingActionButton
4445import androidx.compose.runtime.Composable
4546import androidx.compose.runtime.LaunchedEffect
4647import androidx.compose.runtime.getValue
@@ -93,15 +94,20 @@ fun TranslationComponent(
9394 viewModel.apiError.collect { apiError ->
9495 when (apiError) {
9596 is HttpException -> {
96- onTranslationError(context.getString(R .string.translation_error_hint) + " (${apiError.message.orEmpty()} )" , true )
97+ onTranslationError(
98+ context.getString(R .string.translation_error_hint) + " (${apiError.message.orEmpty()} )" ,
99+ true
100+ )
97101 }
98102
99103 is UnsupportedLanguageException -> {
100- onTranslationError(context.getString(
101- R .string.unsupported_language,
102- apiError.language.takeIf { ! it.isAutoLanguage }?.name
103- ? : context.getString(R .string.auto)
104- ), false )
104+ onTranslationError(
105+ context.getString(
106+ R .string.unsupported_language,
107+ apiError.language.takeIf { ! it.isAutoLanguage }?.name
108+ ? : context.getString(R .string.auto)
109+ ), false
110+ )
105111 }
106112
107113 null -> Unit
@@ -241,17 +247,32 @@ fun TranslationComponent(
241247 }
242248
243249 if (scrollState.value > 100 ) {
244- FloatingActionButton (
245- modifier = Modifier
246- .align(Alignment .BottomEnd )
247- .padding(16 .dp),
248- onClick = {
249- coroutineScope.launch {
250- scrollState.animateScrollTo(0 )
250+ val fabModifier = Modifier
251+ .align(Alignment .BottomEnd )
252+ .padding(16 .dp)
253+
254+ if (largeTextFields) {
255+ FloatingActionButton (
256+ modifier = fabModifier,
257+ onClick = {
258+ coroutineScope.launch {
259+ scrollState.animateScrollTo(0 )
260+ }
251261 }
262+ ) {
263+ Icon (Icons .Default .ArrowUpward , null )
264+ }
265+ } else {
266+ SmallFloatingActionButton (
267+ modifier = fabModifier,
268+ onClick = {
269+ coroutineScope.launch {
270+ scrollState.animateScrollTo(0 )
271+ }
272+ }
273+ ) {
274+ Icon (Icons .Default .ArrowUpward , null )
252275 }
253- ) {
254- Icon (Icons .Default .ArrowUpward , null )
255276 }
256277 }
257278 }
0 commit comments