Skip to content

Commit 9f6b3d4

Browse files
author
Your Name
committed
Update dashboard navigation and UI layout
1 parent abf90b7 commit 9f6b3d4

2 files changed

Lines changed: 337 additions & 224 deletions

File tree

‎app/src/main/java/com/sumitupdat/universalfileeditorviewer/ui/screens/DashboardScreen.kt‎

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import androidx.compose.runtime.*
1818
import androidx.compose.ui.Alignment
1919
import androidx.compose.ui.Modifier
2020
import androidx.compose.ui.draw.clip
21-
import androidx.compose.ui.draw.shadow
2221
import androidx.compose.ui.graphics.Brush
2322
import androidx.compose.ui.graphics.Color
2423
import androidx.compose.ui.graphics.vector.ImageVector
@@ -47,20 +46,32 @@ fun DashboardScreen(
4746
DashboardItem("Code Files", Icons.Default.Code, GradientCode, FileCategory.CODE),
4847
DashboardItem("Databases", Icons.Default.Storage, GradientDatabase, FileCategory.DATABASES),
4948
DashboardItem("Fonts", Icons.Default.FontDownload, GradientFont, FileCategory.FONTS),
49+
DashboardItem("Spreadsheets", Icons.Default.TableChart, GradientImage, FileCategory.SPREADSHEETS),
50+
DashboardItem("Presentations", Icons.Default.PresentToAll, GradientVideo, FileCategory.PRESENTATIONS),
5051
DashboardItem("Configuration", Icons.Default.Settings, GradientCode, FileCategory.CONFIGURATION),
5152
DashboardItem("Logs", Icons.Default.History, GradientCode, FileCategory.LOGS),
5253
DashboardItem("Android", Icons.Default.Android, GradientAndroid, FileCategory.ANDROID),
53-
DashboardItem("Cloud Storage", Icons.Default.Cloud, GradientCloud, FileCategory.OTHER),
5454
DashboardItem("Web Files", Icons.Default.Language, GradientWeb, FileCategory.WEB),
55-
DashboardItem("Spreadsheets", Icons.Default.TableChart, GradientImage, FileCategory.SPREADSHEETS),
56-
DashboardItem("Presentations", Icons.Default.PresentToAll, GradientVideo, FileCategory.PRESENTATIONS),
57-
DashboardItem("GIS & Maps", Icons.Default.Map, GradientAudio, FileCategory.GIS)
55+
DashboardItem("GIS & Maps", Icons.Default.Map, GradientAudio, FileCategory.GIS),
56+
DashboardItem("Backups", Icons.Default.Backup, GradientDoc, FileCategory.BACKUP),
57+
DashboardItem("Cloud Storage", Icons.Default.Cloud, GradientCloud, FileCategory.OTHER),
58+
DashboardItem("Emails", Icons.Default.Email, GradientArchive, FileCategory.EMAILS),
59+
DashboardItem("Windows", Icons.Default.Window, GradientCloud, FileCategory.WINDOWS),
60+
DashboardItem("Linux", Icons.Default.Terminal, GradientDatabase, FileCategory.LINUX),
61+
DashboardItem("Other", Icons.Default.MoreHoriz, GradientCloud, FileCategory.OTHER)
5862
)
5963
}
6064

61-
Box(modifier = Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) {
65+
BoxWithConstraints(modifier = Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) {
66+
val screenWidth = maxWidth
67+
val columns = when {
68+
screenWidth < 600.dp -> 2
69+
screenWidth < 900.dp -> 3
70+
else -> 4
71+
}
72+
6273
LazyVerticalGrid(
63-
columns = GridCells.Adaptive(minSize = 160.dp),
74+
columns = GridCells.Fixed(columns),
6475
contentPadding = PaddingValues(16.dp),
6576
verticalArrangement = Arrangement.spacedBy(16.dp),
6677
horizontalArrangement = Arrangement.spacedBy(16.dp),
@@ -88,30 +99,38 @@ fun CategoryCard(index: Int, item: DashboardItem, viewModel: FileViewModel, onCl
8899

89100
var visible by remember { mutableStateOf(false) }
90101
LaunchedEffect(Unit) {
91-
// Staggered animation
92-
kotlinx.coroutines.delay(index * 50L)
102+
kotlinx.coroutines.delay(index * 30L)
93103
visible = true
94104
}
95105

96106
AnimatedVisibility(
97107
visible = visible,
98-
enter = fadeIn(tween(400)) + scaleIn(tween(400), initialScale = 0.8f)
108+
enter = fadeIn(tween(300)) + scaleIn(tween(300), initialScale = 0.9f)
99109
) {
100-
Card(
110+
ElevatedCard(
101111
modifier = Modifier
102112
.fillMaxWidth()
103-
.height(150.dp)
104-
.shadow(8.dp, RoundedCornerShape(24.dp))
113+
.height(130.dp)
105114
.clip(RoundedCornerShape(24.dp))
106115
.clickable { onClick(item.category) },
107116
shape = RoundedCornerShape(24.dp),
108-
colors = CardDefaults.cardColors(containerColor = Color.Transparent)
117+
colors = CardDefaults.elevatedCardColors(
118+
containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.3f)
119+
),
120+
elevation = CardDefaults.elevatedCardElevation(defaultElevation = 2.dp)
109121
) {
110122
Box(
111123
modifier = Modifier
112124
.fillMaxSize()
113-
.background(Brush.linearGradient(item.gradient))
114-
.padding(20.dp)
125+
.background(
126+
Brush.verticalGradient(
127+
colors = listOf(
128+
item.gradient.first().copy(alpha = 0.8f),
129+
item.gradient.last().copy(alpha = 0.6f)
130+
)
131+
)
132+
)
133+
.padding(16.dp)
115134
) {
116135
Column(
117136
modifier = Modifier.fillMaxSize(),
@@ -122,24 +141,24 @@ fun CategoryCard(index: Int, item: DashboardItem, viewModel: FileViewModel, onCl
122141
imageVector = item.icon,
123142
contentDescription = null,
124143
tint = Color.White,
125-
modifier = Modifier.size(44.dp)
144+
modifier = Modifier.size(36.dp)
126145
)
127146

128147
Column {
129148
Text(
130149
text = item.title,
131150
style = MaterialTheme.typography.titleMedium.copy(
132-
fontWeight = FontWeight.ExtraBold,
151+
fontWeight = FontWeight.Bold,
133152
color = Color.White,
134-
fontSize = 18.sp,
135-
letterSpacing = 0.5.sp
136-
)
153+
fontSize = 16.sp
154+
),
155+
maxLines = 1
137156
)
138157
Text(
139158
text = if (count == 1) "1 file" else "$count files",
140159
style = MaterialTheme.typography.bodySmall.copy(
141-
color = Color.White.copy(alpha = 0.85f),
142-
fontWeight = FontWeight.Medium
160+
color = Color.White.copy(alpha = 0.9f),
161+
fontWeight = FontWeight.Normal
143162
)
144163
)
145164
}

0 commit comments

Comments
 (0)