@@ -4,7 +4,6 @@ import androidx.compose.animation.AnimatedVisibility
44import androidx.compose.foundation.layout.Arrangement
55import androidx.compose.foundation.layout.Column
66import androidx.compose.foundation.layout.Row
7- import androidx.compose.foundation.layout.Spacer
87import androidx.compose.foundation.layout.fillMaxWidth
98import androidx.compose.foundation.layout.padding
109import androidx.compose.foundation.rememberScrollState
@@ -30,12 +29,14 @@ import androidx.compose.runtime.LaunchedEffect
3029import androidx.compose.runtime.getValue
3130import androidx.compose.runtime.key
3231import androidx.compose.runtime.mutableStateOf
32+ import androidx.compose.runtime.remember
3333import androidx.compose.runtime.saveable.rememberSaveable
3434import androidx.compose.runtime.setValue
3535import androidx.compose.ui.Alignment
3636import androidx.compose.ui.Modifier
3737import androidx.compose.ui.graphics.Color
3838import androidx.compose.ui.graphics.vector.ImageVector
39+ import androidx.compose.ui.platform.LocalContext
3940import androidx.compose.ui.res.stringResource
4041import androidx.compose.ui.text.font.FontWeight
4142import androidx.compose.ui.text.style.TextAlign
@@ -46,6 +47,7 @@ import com.yangdai.opennote.data.local.entity.FolderEntity
4647import com.yangdai.opennote.presentation.navigation.Screen
4748import com.yangdai.opennote.presentation.navigation.Screen.Folders
4849import com.yangdai.opennote.presentation.navigation.Screen.Settings
50+ import com.yangdai.opennote.presentation.util.getAppName
4951
5052@Composable
5153fun DrawerContent (
@@ -60,6 +62,9 @@ fun DrawerContent(
6062 .fillMaxWidth()
6163 .verticalScroll(rememberScrollState())
6264) {
65+ val context = LocalContext .current
66+ val appName = remember { context.getAppName() }
67+
6368
6469 Row (
6570 modifier = Modifier
@@ -68,6 +73,14 @@ fun DrawerContent(
6873 horizontalArrangement = Arrangement .SpaceBetween ,
6974 verticalAlignment = Alignment .CenterVertically
7075 ) {
76+ Text (
77+ text = appName,
78+ style = MaterialTheme .typography.titleLarge,
79+ color = MaterialTheme .colorScheme.onSurface,
80+ fontWeight = FontWeight .SemiBold ,
81+ modifier = Modifier .weight(1f )
82+ )
83+
7184 if (showLock)
7285 IconButton (onClick = onLockClick) {
7386 Icon (
@@ -77,8 +90,6 @@ fun DrawerContent(
7790 )
7891 }
7992
80- Spacer (modifier = Modifier .weight(1f ))
81-
8293 IconButton (onClick = { navigateTo(Settings ) }) {
8394 Icon (
8495 imageVector = Icons .Outlined .Settings ,
@@ -183,4 +194,4 @@ private fun DrawerItem(
183194 shape = MaterialTheme .shapes.medium,
184195 selected = isSelected,
185196 onClick = onClick
186- )
197+ )
0 commit comments