-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathLineNumberSwitcher.kt
More file actions
44 lines (42 loc) · 1.72 KB
/
LineNumberSwitcher.kt
File metadata and controls
44 lines (42 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package dev.snipme.androidexample
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Icon
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.FormatAlignLeft
import androidx.compose.material.icons.filled.DarkMode
import androidx.compose.material.icons.outlined.FormatAlignLeft
import androidx.compose.material.icons.outlined.FormatListNumbered
import androidx.compose.material.icons.outlined.LightMode
import androidx.compose.material.icons.outlined.Reorder
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun LineNumberSwitcher(
lineNumbersEnabled: Boolean,
modifier: Modifier = Modifier,
onChange: (Boolean) -> Unit,
) {
Surface {
Row(
modifier = modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(Modifier.width(8.dp))
Icon(Icons.Outlined.FormatListNumbered, contentDescription = "Line numbers enabled")
Spacer(Modifier.width(16.dp))
Switch(checked = lineNumbersEnabled, onCheckedChange = onChange)
Spacer(Modifier.width(16.dp))
Icon(Icons.Outlined.Reorder, contentDescription = "Dark mode")
Spacer(Modifier.width(8.dp))
}
}
}