Design hotfixes
This commit is contained in:
parent
b95c3187e0
commit
8b285aad0e
|
@ -1,5 +1,6 @@
|
||||||
package co.electriccoin.zcash.ui.design.component
|
package co.electriccoin.zcash.ui.design.component
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
@ -7,10 +8,13 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
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.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyItemScope
|
import androidx.compose.foundation.lazy.LazyItemScope
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
|
@ -33,6 +37,8 @@ import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import co.electriccoin.zcash.spackle.Twig
|
import co.electriccoin.zcash.spackle.Twig
|
||||||
|
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
|
||||||
|
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
||||||
import co.electriccoin.zcash.ui.design.theme.colors.ZashiColors
|
import co.electriccoin.zcash.ui.design.theme.colors.ZashiColors
|
||||||
import co.electriccoin.zcash.ui.design.theme.typography.ZashiTypography
|
import co.electriccoin.zcash.ui.design.theme.typography.ZashiTypography
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -71,20 +77,31 @@ fun ZashiYearMonthWheelDatePicker(
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
Column(
|
Row (
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.align(Alignment.Center),
|
.align(Alignment.Center),
|
||||||
) {
|
) {
|
||||||
ZashiHorizontalDivider(color = ZashiColors.Surfaces.bgQuaternary, thickness = .5.dp)
|
Box(
|
||||||
VerticalSpacer(31.dp)
|
modifier = Modifier
|
||||||
ZashiHorizontalDivider(color = ZashiColors.Surfaces.bgQuaternary, thickness = .5.dp)
|
.weight(1f)
|
||||||
|
.height(34.dp)
|
||||||
|
.padding(top = 1.dp)
|
||||||
|
.background(ZashiColors.Surfaces.bgSecondary, RoundedCornerShape(6.dp))
|
||||||
|
)
|
||||||
|
Spacer(36.dp)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(34.dp)
|
||||||
|
.padding(top = 1.dp)
|
||||||
|
.background(ZashiColors.Surfaces.bgSecondary, RoundedCornerShape(6.dp))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center
|
horizontalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Spacer(Modifier.weight(.5f))
|
|
||||||
WheelLazyList(
|
WheelLazyList(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
selection = state.selectedMonthIndex,
|
selection = state.selectedMonthIndex,
|
||||||
|
@ -107,8 +124,9 @@ fun ZashiYearMonthWheelDatePicker(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Spacer(36.dp)
|
||||||
WheelLazyList(
|
WheelLazyList(
|
||||||
modifier = Modifier.weight(.75f),
|
modifier = Modifier.weight(1f),
|
||||||
selection = state.selectedYearIndex,
|
selection = state.selectedYearIndex,
|
||||||
itemCount = state.years.size,
|
itemCount = state.years.size,
|
||||||
itemVerticalOffset = verticallyVisibleItems,
|
itemVerticalOffset = verticallyVisibleItems,
|
||||||
|
@ -139,7 +157,6 @@ fun ZashiYearMonthWheelDatePicker(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Spacer(Modifier.weight(.5f))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,3 +397,14 @@ private data class InternalState(
|
||||||
val selectedYearIndex = years.map { it.value }.indexOf(selectedDate.year)
|
val selectedYearIndex = years.map { it.value }.indexOf(selectedDate.year)
|
||||||
val selectedMonthIndex = maxOf(months.indexOf(selectedDate.month), 0)
|
val selectedMonthIndex = maxOf(months.indexOf(selectedDate.month), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreviewScreens
|
||||||
|
@Composable
|
||||||
|
private fun Preview() = ZcashTheme {
|
||||||
|
BlankSurface {
|
||||||
|
ZashiYearMonthWheelDatePicker(
|
||||||
|
selection = YearMonth.now(),
|
||||||
|
onSelectionChange = {}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -18,12 +18,10 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.WhileSubscribed
|
import kotlinx.coroutines.flow.WhileSubscribed
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.datetime.Clock
|
|
||||||
import kotlinx.datetime.toKotlinInstant
|
import kotlinx.datetime.toKotlinInstant
|
||||||
import java.time.YearMonth
|
import java.time.YearMonth
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
|
@ -34,7 +32,7 @@ class RestoreBDDateViewModel(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
private val selection = MutableStateFlow<YearMonth>(YearMonth.now())
|
private val selection = MutableStateFlow<YearMonth>(YearMonth.of(2018, 10))
|
||||||
|
|
||||||
val state: StateFlow<RestoreBDDateState?> = selection
|
val state: StateFlow<RestoreBDDateState?> = selection
|
||||||
.map {
|
.map {
|
||||||
|
|
Loading…
Reference in New Issue