dashboard padding fix
This commit is contained in:
parent
b9be038d68
commit
4fb6556d1b
@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
@ -421,37 +422,27 @@ fun DashboardScreen2(
|
||||
}
|
||||
)
|
||||
}) { paddingValues ->
|
||||
Column(
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.padding(paddingValues)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
//top section
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(),
|
||||
) {
|
||||
AdvertisingArea()
|
||||
item {
|
||||
AdvertisingArea(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(200.dp)
|
||||
)
|
||||
}
|
||||
//center section
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
item {
|
||||
Spacer(Modifier.height(12.dp))
|
||||
SummaryCard(
|
||||
onClickLastSync = onClickLastSync,
|
||||
lastSyncTime = dashboardUiState.lastSyncTime
|
||||
)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
}
|
||||
//pager section
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1.3f)
|
||||
.fillMaxWidth(),
|
||||
) {
|
||||
item {
|
||||
MenuPager(
|
||||
items = buildMenuItems(
|
||||
onNavigateAmount = onNavigateAmount,
|
||||
@ -459,28 +450,25 @@ fun DashboardScreen2(
|
||||
onNavigateSettlement = onNavigateSettlement,
|
||||
onNavigateAction = onNavigateAction
|
||||
),
|
||||
modifier = Modifier.fillMaxSize()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
// .height(250.dp)
|
||||
)
|
||||
}
|
||||
//transactions section
|
||||
// RecentTransactions(
|
||||
// transactions = dashboardUiState.recentTransactions,
|
||||
// modifier = Modifier
|
||||
// .weight(1.2f)
|
||||
// .fillMaxWidth()
|
||||
// )
|
||||
item { Spacer(Modifier.height(8.dp)) }
|
||||
recentTransactionsItems(transactions = dashboardUiState.recentTransactions)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AdvertisingArea() {
|
||||
private fun AdvertisingArea(modifier: Modifier = Modifier) {
|
||||
|
||||
val imageArray = listOf(
|
||||
"https://i.ytimg.com/vi/eRUVxGRp1Ms/maxresdefault.jpg",
|
||||
"https://i.ytimg.com/vi/AwvmgTPd7qw/maxresdefault.jpg",
|
||||
"https://mma.prnewswire.com/media/2080956/SUNMI_3rd_generation_products_T3_PRO_series_V3_MIX.jpg?p=facebook"
|
||||
R.drawable.sunmi1,
|
||||
R.drawable.sunmi2,
|
||||
R.drawable.sunmi3
|
||||
)
|
||||
val pageState = rememberPagerState(pageCount = { imageArray.size })
|
||||
|
||||
@ -496,7 +484,7 @@ private fun AdvertisingArea() {
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = modifier,
|
||||
shape = RoundedCornerShape(0.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
) {
|
||||
@ -814,7 +802,9 @@ private fun MenuPager(
|
||||
Column(modifier = modifier) {
|
||||
HorizontalPager(
|
||||
state = pagerState,
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
// .height(236.dp)
|
||||
) { pageIndex ->
|
||||
MenuPage(items = pages[pageIndex])
|
||||
}
|
||||
@ -848,7 +838,6 @@ private fun MenuPage(items: List<DashboardMenuItem>) {
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.padding(horizontal = 16.dp)
|
||||
) {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
items.chunked(3).forEach { rowItems ->
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
rowItems.forEach { item ->
|
||||
@ -921,12 +910,8 @@ private fun MenuCard(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RecentTransactions(
|
||||
transactions: List<TrnxRecord>,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Column(modifier = modifier) {
|
||||
private fun LazyListScope.recentTransactionsItems(transactions: List<TrnxRecord>) {
|
||||
item {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@ -943,24 +928,22 @@ private fun RecentTransactions(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
color = Color.Gray.copy(alpha = 0.2f)
|
||||
)
|
||||
LazyColumn(modifier = Modifier.fillMaxSize()) {
|
||||
if (transactions.isEmpty()) {
|
||||
item {
|
||||
Text(
|
||||
text = "No recent transactions",
|
||||
color = Color.Gray,
|
||||
fontSize = 13.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 24.dp)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
items(items = transactions, key = { it.pid }) { record ->
|
||||
TrnxRow(record = record)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transactions.isEmpty()) {
|
||||
item {
|
||||
Text(
|
||||
text = "No recent transactions",
|
||||
color = Color.Gray,
|
||||
fontSize = 13.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 24.dp)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
items(items = transactions, key = { it.pid }) { record ->
|
||||
TrnxRow(record = record)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
app/src/main/res/drawable/sunmi1.jpg
Normal file
BIN
app/src/main/res/drawable/sunmi1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
BIN
app/src/main/res/drawable/sunmi2.jpg
Normal file
BIN
app/src/main/res/drawable/sunmi2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
BIN
app/src/main/res/drawable/sunmi3.jpg
Normal file
BIN
app/src/main/res/drawable/sunmi3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue
Block a user