Skip to content

Commit 82d0297

Browse files
committed
Replace Retain API
1 parent fffe614 commit 82d0297

18 files changed

Lines changed: 176 additions & 669 deletions

File tree

app/src/main/kotlin/io/bashpsk/emptylibs/CanvasSlateScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fun CanvasSlateScreen() {
2828

2929
val canvasSlateState = rememberCanvasSlateState(
3030
background = MaterialTheme.colorScheme.background,
31-
initial = MaterialTheme.colorScheme.onSurface
31+
brush = MaterialTheme.colorScheme.onSurface
3232
)
3333

3434
Scaffold(

app/src/main/kotlin/io/bashpsk/emptylibs/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class MainActivity : ComponentActivity() {
3636
// BasicTextEditorScreen()
3737
// BottomOptionBarScreen()
3838
// CanvasSlateScreen()
39-
// ColorPickerScreen()
4039
// ColorPickerDialogScreen()
40+
// ColorPickerScreen()
4141
// DatastoreUIScreen()
4242
// DialClockScreen()
4343
// DialTextPickerScreen()

app/src/main/kotlin/io/bashpsk/emptylibs/WheelTextPickerScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ fun WheelTextPickerScreen() {
4242
Scaffold { paddingValues ->
4343

4444
Column(
45-
modifier = Modifier.fillMaxSize().padding(paddingValues),
45+
modifier = Modifier
46+
.fillMaxSize()
47+
.padding(paddingValues),
4648
horizontalAlignment = Alignment.CenterHorizontally,
4749
verticalArrangement = Arrangement.Center
4850
) {

canvas-slate/src/main/kotlin/io/bashpsk/emptylibs/canvasslate/slate/CanvasSlate.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fun CanvasSlate(
4848

4949
RetainedEffect(Unit) {
5050

51-
onRetire { state.clearState() }
51+
onRetire { }
5252
}
5353

5454
KolorPickerDialog(
@@ -57,7 +57,10 @@ fun CanvasSlate(
5757
.safeContentPadding(),
5858
state = backgroundColorPickerState,
5959
enableAlphaPanel = true,
60-
onSelectedColor = state::updateBackgroundColor
60+
onSelectedColor = { newColor ->
61+
62+
state.backgroundColor = newColor
63+
}
6164
)
6265

6366
KolorPickerDialog(
@@ -66,7 +69,10 @@ fun CanvasSlate(
6669
.safeContentPadding(),
6770
state = foregroundColorPickerState,
6871
enableAlphaPanel = true,
69-
onSelectedColor = state::updateBrushColor
72+
onSelectedColor = { newColor ->
73+
74+
state.brushColor = newColor
75+
}
7076
)
7177

7278
PenStrokeDialog(dialogVisibleState = penStrokeDialogVisibleState, state = state)

0 commit comments

Comments
 (0)