@@ -20,6 +20,7 @@ import androidx.compose.foundation.rememberScrollState
20
20
import androidx.compose.foundation.shape.CircleShape
21
21
import androidx.compose.foundation.verticalScroll
22
22
import androidx.compose.material3.ExperimentalMaterial3Api
23
+ import androidx.compose.material3.HorizontalDivider
23
24
import androidx.compose.material3.Scaffold
24
25
import androidx.compose.material3.Text
25
26
import androidx.compose.runtime.Composable
@@ -34,6 +35,7 @@ import androidx.compose.ui.Alignment
34
35
import androidx.compose.ui.Modifier
35
36
import androidx.compose.ui.draw.clip
36
37
import androidx.compose.ui.focus.FocusState
38
+ import androidx.compose.ui.graphics.Color
37
39
import androidx.compose.ui.platform.LocalContext
38
40
import androidx.compose.ui.platform.LocalFocusManager
39
41
import androidx.compose.ui.platform.LocalView
@@ -63,6 +65,7 @@ import com.bff.wespot.navigation.Navigator
63
65
import com.bff.wespot.ui.component.LetterCountIndicator
64
66
import com.bff.wespot.ui.component.LoadingAnimation
65
67
import com.bff.wespot.ui.component.TopToast
68
+ import com.bff.wespot.ui.component.WSBottomSheet
66
69
import com.bff.wespot.ui.model.ToastState
67
70
import com.bff.wespot.ui.util.clickableSingle
68
71
import com.bff.wespot.ui.util.handleSideEffect
@@ -99,10 +102,6 @@ fun ProfileEditScreen(
99
102
val action = viewModel::onAction
100
103
val state by viewModel.collectAsState()
101
104
102
- var showBottomSheet by remember {
103
- mutableStateOf(false )
104
- }
105
-
106
105
val pickImage =
107
106
rememberLauncherForActivityResult(contract = ActivityResultContracts .PickVisualMedia ()) {
108
107
it?.let {
@@ -144,13 +143,7 @@ fun ProfileEditScreen(
144
143
modifier = Modifier
145
144
.padding(top = 16 .dp)
146
145
.clickableSingle {
147
- pickImage.launch(
148
- PickVisualMediaRequest (
149
- ActivityResultContracts .PickVisualMedia .SingleMimeType (
150
- " image/*" ,
151
- ),
152
- ),
153
- )
146
+ action(EntireEditAction .ChangeBottomSheetState (true ))
154
147
},
155
148
) {
156
149
AsyncImage (
@@ -291,6 +284,49 @@ fun ProfileEditScreen(
291
284
}
292
285
}
293
286
287
+ if (state.changeBottomSheet) {
288
+ WSBottomSheet (
289
+ closeSheet = {
290
+ action(EntireEditAction .ChangeBottomSheetState (false ))
291
+ }
292
+ ) {
293
+ Column (
294
+ verticalArrangement = Arrangement .spacedBy(16 .dp),
295
+ modifier = Modifier
296
+ .fillMaxWidth()
297
+ .padding(horizontal = 20 .dp, vertical = 28 .dp)
298
+ ) {
299
+ Text (
300
+ text = stringResource(R .string.change_image),
301
+ modifier = Modifier
302
+ .fillMaxWidth()
303
+ .clickableSingle {
304
+ pickImage.launch(
305
+ PickVisualMediaRequest (
306
+ ActivityResultContracts .PickVisualMedia .SingleMimeType (
307
+ " image/*" ,
308
+ ),
309
+ ),
310
+ )
311
+ action(EntireEditAction .ChangeBottomSheetState (false ))
312
+ }
313
+ )
314
+ HorizontalDivider (
315
+ color = Color (0xFF4F5157 ),
316
+ )
317
+ Text (
318
+ text = stringResource(R .string.remove_image),
319
+ modifier = Modifier
320
+ .fillMaxWidth()
321
+ .clickableSingle {
322
+ action(EntireEditAction .OnProfileImagePicked (null ))
323
+ action(EntireEditAction .ChangeBottomSheetState (false ))
324
+ }
325
+ )
326
+ }
327
+ }
328
+ }
329
+
294
330
LaunchedEffect (Unit ) {
295
331
action(EntireEditAction .OnProfileEditScreenEntered (navArgs.isCompleteProfileEdit))
296
332
}
0 commit comments