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