Skip to content

Commit

Permalink
Merge pull request #8 from DogusTeknoloji/feature/button_text_size
Browse files Browse the repository at this point in the history
Adding button text size parameter
  • Loading branch information
BerkkanB authored Mar 3, 2022
2 parents d5f58fd + 4d18f7c commit cc4782a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/dt/calendarwork/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.sp
import com.dt.calendarwork.ui.theme.CalendarWorkTheme
import com.dt.composedatepicker.ComposeCalendar
import com.dt.composedatepicker.MonthViewType
Expand Down Expand Up @@ -71,6 +72,7 @@ fun MainScreen() {
initialDate = initialCalendar.time,
locale = Locale("en"),
title = "Select Date",
buttonTextSize = 15.sp,
monthViewType = MonthViewType.ONLY_NUMBER_ONE_COLUMN,
listener = object : SelectDateListener {
override fun onDateSelected(date: Date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp

@Composable
Expand All @@ -18,7 +19,8 @@ fun CalendarBottom(
onCancelClick: () -> Unit,
themeColor: Color,
negativeButtonTitle: String,
positiveButtonTitle: String
positiveButtonTitle: String,
buttonTextSize: TextUnit
) {
Row(
modifier = Modifier
Expand All @@ -29,11 +31,13 @@ fun CalendarBottom(
) {
Text(text = negativeButtonTitle,
color = themeColor,
fontSize = buttonTextSize,
modifier = Modifier
.padding(end = 20.dp)
.clickable { onCancelClick() })
Text(text = positiveButtonTitle,
color = themeColor,
fontSize = buttonTextSize,
modifier = Modifier.clickable { onPositiveClick() })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.TextUnit
import java.text.DateFormatSymbols
import java.time.Year
import java.util.*

@Composable
Expand All @@ -29,6 +29,7 @@ fun ComposeCalendar(
themeColor: Color = Color(0xFF614FF0),
negativeButtonTitle: String = "CANCEL",
positiveButtonTitle: String = "OK",
buttonTextSize: TextUnit = TextUnit.Unspecified,
monthViewType: MonthViewType? = MonthViewType.ONLY_MONTH
) {
if (showOnlyMonth && showOnlyYear) {
Expand Down Expand Up @@ -175,6 +176,7 @@ fun ComposeCalendar(
onPositiveClick = { listener.onDateSelected(selectedDate) },
onCancelClick = { listener.onCanceled() },
themeColor = themeColor,
buttonTextSize = buttonTextSize,
negativeButtonTitle = negativeButtonTitle,
positiveButtonTitle = positiveButtonTitle
)
Expand Down

0 comments on commit cc4782a

Please sign in to comment.