add marquee effect to location
This commit is contained in:
parent
1f245aa337
commit
bb86c89a5a
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package com.henryhiles.qweather.presentation.components.weather
|
package com.henryhiles.qweather.presentation.components.weather
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.basicMarquee
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
@ -20,6 +22,7 @@ import com.henryhiles.qweather.R
|
||||||
import com.henryhiles.qweather.domain.weather.HourlyWeatherData
|
import com.henryhiles.qweather.domain.weather.HourlyWeatherData
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun WeatherCard(hour: HourlyWeatherData?, location: String, modifier: Modifier = Modifier) {
|
fun WeatherCard(hour: HourlyWeatherData?, location: String, modifier: Modifier = Modifier) {
|
||||||
hour?.let {
|
hour?.let {
|
||||||
|
@ -42,6 +45,10 @@ fun WeatherCard(hour: HourlyWeatherData?, location: String, modifier: Modifier =
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = location,
|
text = location,
|
||||||
|
modifier = Modifier
|
||||||
|
.width(152.dp)
|
||||||
|
.basicMarquee(delayMillis = 2000, initialDelayMillis = 1000),
|
||||||
|
maxLines = 1,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "Today $formattedTime",
|
text = "Today $formattedTime",
|
||||||
|
|
Reference in a new issue