From e35a57378752ad32f688f3e8f0bd4234ca6cb630 Mon Sep 17 00:00:00 2001 From: Smart Tool Factory Date: Thu, 27 Jul 2023 13:44:23 +0300 Subject: [PATCH] update setting widgets --- .../preferences/SelctionWidgets.kt | 18 +++++++++--------- .../cropper/widget/AspectRatioSlectionCard.kt | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/smarttoolfactory/composecropper/preferences/SelctionWidgets.kt b/app/src/main/java/com/smarttoolfactory/composecropper/preferences/SelctionWidgets.kt index 2ab5dab..f215aab 100644 --- a/app/src/main/java/com/smarttoolfactory/composecropper/preferences/SelctionWidgets.kt +++ b/app/src/main/java/com/smarttoolfactory/composecropper/preferences/SelctionWidgets.kt @@ -59,9 +59,8 @@ internal fun SliderWithValueSelection( valueRange: ClosedFloatingPointRange, colors: MaterialSliderColors = MaterialSliderDefaults.materialColors( activeTrackColor = SliderBrushColor(MaterialTheme.colorScheme.primary), - inactiveTrackColor = SliderBrushColor(Color.Transparent), - thumbColor = SliderBrushColor(MaterialTheme.colorScheme.inversePrimary) - ) + inactiveTrackColor = SliderBrushColor(Color.Transparent) + ), ) { Column { @@ -83,7 +82,7 @@ internal fun SliderWithValueSelection( valueRange = valueRange, colors = colors, trackHeight = 10.dp, - thumbRadius = 12.dp + thumbRadius = 10.dp ) } } @@ -109,7 +108,7 @@ internal fun SliderSelection( colors = colors, borderStroke = BorderStroke(2.dp, MaterialTheme.colorScheme.primary), trackHeight = 10.dp, - thumbRadius = 12.dp, + thumbRadius = 10.dp, onValueChangeFinished = onValueChangeFinished ) } @@ -160,17 +159,18 @@ internal fun FullRowSwitch( } } -@OptIn(ExperimentalMaterial3Api::class) @Composable internal fun CropTextField(value: String, onValueChange: (String) -> Unit) { TextField( value = value, onValueChange = onValueChange, - colors = TextFieldDefaults.textFieldColors( - containerColor = Color.Transparent, + colors = TextFieldDefaults.colors( + focusedContainerColor = Color.Transparent, + unfocusedContainerColor = Color.Transparent, + disabledContainerColor = Color.Transparent, focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, - disabledIndicatorColor = Color.Transparent + disabledIndicatorColor = Color.Transparent, ) ) } diff --git a/cropper/src/main/java/com/smarttoolfactory/cropper/widget/AspectRatioSlectionCard.kt b/cropper/src/main/java/com/smarttoolfactory/cropper/widget/AspectRatioSlectionCard.kt index 324b3bc..d79525b 100644 --- a/cropper/src/main/java/com/smarttoolfactory/cropper/widget/AspectRatioSlectionCard.kt +++ b/cropper/src/main/java/com/smarttoolfactory/cropper/widget/AspectRatioSlectionCard.kt @@ -1,7 +1,11 @@ package com.smarttoolfactory.cropper.widget import androidx.compose.foundation.background -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -14,6 +18,7 @@ import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.translate import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.smarttoolfactory.cropper.model.CropAspectRatio @@ -72,7 +77,13 @@ fun AspectRatioSelectionCard( ) } if (cropAspectRatio.title.isNotEmpty()) { - Text(text = cropAspectRatio.title, color = color, fontSize = 14.sp) + Text( + text = cropAspectRatio.title, + color = color, + fontSize = 14.sp, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) } } }