@@ -5,16 +5,20 @@ import androidx.compose.foundation.Image
55import androidx.compose.foundation.layout.RowScope
66import androidx.compose.foundation.layout.Spacer
77import androidx.compose.foundation.shape.RoundedCornerShape
8+ import androidx.compose.material3.ButtonColors
9+ import androidx.compose.material3.ButtonDefaults
810import androidx.compose.material3.OutlinedButton
911import androidx.compose.material3.Text
1012import androidx.compose.runtime.Composable
1113import androidx.compose.ui.Modifier
1214import androidx.compose.ui.graphics.Color
15+ import androidx.compose.ui.graphics.ColorFilter
1316import androidx.compose.ui.graphics.Shape
1417import androidx.compose.ui.graphics.vector.ImageVector
1518import androidx.compose.ui.hapticfeedback.HapticFeedback
1619import androidx.compose.ui.hapticfeedback.HapticFeedbackType
1720import androidx.compose.ui.platform.LocalHapticFeedback
21+ import androidx.compose.ui.platform.LocalContentColor
1822import androidx.compose.ui.text.TextStyle
1923import androidx.compose.ui.unit.dp
2024import com.davidmiguel.numberkeyboard.listener.NumberKeyboardClickedListener
@@ -44,6 +48,19 @@ fun NumberKeyboardButton(
4448 }
4549}
4650
51+ /* *
52+ * Default auxiliary button for [NumberKeyboard]. Can display either text or an icon.
53+ *
54+ * @param modifier button modifier
55+ * @param textStyle style applied to [value] text
56+ * @param shape button shape
57+ * @param haptics haptic feedback implementation
58+ * @param value optional text displayed inside the button
59+ * @param imageVector optional icon displayed when [value] is null or blank
60+ * @param clicked callback invoked when the button is clicked
61+ * @param colors customizable [ButtonColors] for the button
62+ * @param iconTint tint applied to [imageVector]
63+ */
4764@Composable
4865fun NumberKeyboardAuxButton (
4966 modifier : Modifier ,
@@ -52,13 +69,16 @@ fun NumberKeyboardAuxButton(
5269 haptics : HapticFeedback = LocalHapticFeedback .current,
5370 value : String? = null,
5471 imageVector : ImageVector ? = null,
55- clicked : () -> Unit
72+ clicked : () -> Unit ,
73+ colors : ButtonColors = ButtonDefaults .outlinedButtonColors(),
74+ iconTint : Color = LocalContentColor .current
5675) {
5776 if (value.isNullOrBlank() && imageVector == null ) return
5877 OutlinedButton (
5978 modifier = modifier,
6079 shape = shape,
6180 border = BorderStroke (1 .dp, Color .LightGray ),
81+ colors = colors,
6282 onClick = {
6383 haptics.performHapticFeedback(HapticFeedbackType .LongPress )
6484 clicked.invoke()
@@ -72,7 +92,8 @@ fun NumberKeyboardAuxButton(
7292 } else if (imageVector != null ) {
7393 Image (
7494 imageVector = imageVector,
75- contentDescription = imageVector.name
95+ contentDescription = imageVector.name,
96+ colorFilter = ColorFilter .tint(iconTint)
7697 )
7798 }
7899 }
@@ -81,4 +102,4 @@ fun NumberKeyboardAuxButton(
81102@Composable
82103fun RowScope.NumberKeyboardBlank () {
83104 Spacer (modifier = Modifier .weight(1F ))
84- }
105+ }
0 commit comments