From 76c862273f60cc5cd4941d8257d8ac0e9e6efce7 Mon Sep 17 00:00:00 2001 From: Eric85710 Date: Sat, 2 May 2026 17:27:24 +0800 Subject: [PATCH] auth to server-V37 --- .../detail_UI/setting_Profile_Page.kt | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/login_v3/home/setting/setting_detail_page/detail_UI/setting_Profile_Page.kt b/app/src/main/java/com/example/login_v3/home/setting/setting_detail_page/detail_UI/setting_Profile_Page.kt index 6e9fcbf..9459a95 100644 --- a/app/src/main/java/com/example/login_v3/home/setting/setting_detail_page/detail_UI/setting_Profile_Page.kt +++ b/app/src/main/java/com/example/login_v3/home/setting/setting_detail_page/detail_UI/setting_Profile_Page.kt @@ -17,11 +17,14 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.AlertDialog import androidx.compose.material3.Button import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Divider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.material3.TextField import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -39,6 +42,7 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.viewmodel.compose.viewModel import coil.compose.AsyncImage import com.example.login_v3.R import com.example.login_v3.data.api.api_class.UserProfile @@ -77,7 +81,8 @@ fun Setting_profile_page( @Composable fun Loaded_setting_profile_page( - profile: UserProfile + profile: UserProfile, + viewModel: PersonalProfileViewModel = hiltViewModel() ){ //bia info var showDialog by remember { mutableStateOf(false) } @@ -266,6 +271,34 @@ fun Loaded_setting_profile_page( ) } + // 彈出編輯視窗 + if (showDialog) { + AlertDialog( + onDismissRequest = { showDialog = false }, + title = { Text("Edit Bio") }, + text = { + TextField( + value = tempBio, + onValueChange = { tempBio = it }, + placeholder = { Text("Enter your bio") } + ) + }, + confirmButton = { + TextButton(onClick = { + viewModel.updateBio(tempBio) // 呼叫你寫好的 API 邏輯 + showDialog = false + }) { + Text("Save", color = Color.Cyan) + } + }, + dismissButton = { + TextButton(onClick = { showDialog = false }) { + Text("Cancel") + } + } + ) + } + } } }