feat(app): add authenticated app shell with top bar and bottom navigation #6
+4
-3
@@ -10,12 +10,13 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ExitToApp
|
import androidx.compose.material.icons.automirrored.filled.ExitToApp
|
||||||
import androidx.compose.material.icons.filled.CloudDone
|
import androidx.compose.material.icons.filled.CloudDone
|
||||||
import androidx.compose.material3.ButtonDefaults
|
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
@@ -23,7 +24,6 @@ import androidx.compose.material3.HorizontalDivider
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.OutlinedButton
|
|
||||||
import androidx.compose.material3.SheetState
|
import androidx.compose.material3.SheetState
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
@@ -41,7 +41,7 @@ import com.flagship.abox.manager.designsystem.ABoxUserAvatar
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Account and Provider management bottom sheet triggered by clicking the top bar user avatar.
|
* Account and Provider management bottom sheet triggered by clicking the top bar user avatar.
|
||||||
* Allows viewing current session info, switching providers, and signing out.
|
* Allows viewing current session info and signing out.
|
||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -64,6 +64,7 @@ fun AccountProviderBottomSheet(
|
|||||||
Column(
|
Column(
|
||||||
|
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
.padding(horizontal = 24.dp)
|
.padding(horizontal = 24.dp)
|
||||||
.padding(bottom = 32.dp),
|
.padding(bottom = 32.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -53,7 +54,7 @@ fun MainAppShell(
|
|||||||
scenesSlot: @Composable () -> Unit = { DefaultScenesSlot() },
|
scenesSlot: @Composable () -> Unit = { DefaultScenesSlot() },
|
||||||
activitySlot: @Composable () -> Unit = { DefaultActivitySlot() },
|
activitySlot: @Composable () -> Unit = { DefaultActivitySlot() },
|
||||||
) {
|
) {
|
||||||
var activeTab by remember(initialTab) { mutableStateOf(initialTab) }
|
var activeTab by rememberSaveable { mutableStateOf(initialTab) }
|
||||||
|
pr-agent-bot
commented
状态重置
**状态重置**
`activeTab` 仅通过 `remember` 保存,Activity 配置变更或进程重建后会重置为 `initialTab`。例如用户在“情景”页旋转屏幕后会被带回“设备”页。请使用 `rememberSaveable`,或将当前 Tab 上提为可持久化状态。
<!-- pr-agent-dedup: 56cc895a0f00 -->
<!-- pr-agent-key-issue-location: 3ff2c58208f0 -->
|
|||||||
var showAccountSheet by remember { mutableStateOf(false) }
|
var showAccountSheet by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
|||||||
Reference in New Issue
Block a user
内容溢出
底部面板使用不可滚动的固定
Column,而注销和关闭操作位于内容末尾。在横屏、小屏、大字体或错误信息较长时,末尾内容可能超出可用高度并且无法滚动访问。请为内容增加垂直滚动能力或改用LazyColumn。