Skip to content

Commit

Permalink
feat(ui): minor improvements
Browse files Browse the repository at this point in the history
* SwitchRow: remove obsolete check icon
* UpdateSheet: use M3 default drag handle
  • Loading branch information
aliernfrog committed Apr 17, 2024
1 parent 75d1cbb commit a6e11f5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package com.aliernfrog.pftool.ui.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.SheetValue
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.aliernfrog.pftool.ui.viewmodel.InsetsViewModel
Expand Down Expand Up @@ -75,15 +71,4 @@ fun BaseModalBottomSheet(
) {
content(insetsViewModel.bottomPadding)
}
}

@Composable
fun SmallDragHandle() {
Box(
modifier = Modifier
.padding(vertical = 8.dp)
.size(32.dp, 4.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f))
)
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package com.aliernfrog.pftool.ui.component.form

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -43,18 +38,7 @@ fun SwitchRow(
Switch(
checked = checked,
onCheckedChange = onCheckedChange,
modifier = Modifier.padding(horizontal = 8.dp),
thumbContent = if (checked) {
{
Icon(
imageVector = Icons.Default.Check,
contentDescription = null,
modifier = Modifier.size(ButtonDefaults.IconSize)
)
}
} else {
null
}
modifier = Modifier.padding(horizontal = 8.dp)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import com.aliernfrog.pftool.R
import com.aliernfrog.pftool.data.ReleaseInfo
import com.aliernfrog.pftool.ui.component.BaseModalBottomSheet
import com.aliernfrog.pftool.ui.component.ButtonIcon
import com.aliernfrog.pftool.ui.component.SmallDragHandle
import com.aliernfrog.pftool.ui.component.form.DividerRow
import com.aliernfrog.pftool.util.extension.horizontalFadingEdge
import dev.jeziellago.compose.markdowntext.MarkdownText
Expand All @@ -48,8 +47,7 @@ fun UpdateSheet(
) {
val uriHandler = LocalUriHandler.current
BaseModalBottomSheet(
sheetState = sheetState,
dragHandle = { SmallDragHandle() }
sheetState = sheetState
) { bottomPadding ->
Actions(
versionName = latestVersionInfo.versionName,
Expand Down

0 comments on commit a6e11f5

Please sign in to comment.