Tab bar to scroll different location

This commit is contained in:
Konstantin Kollar
2022-09-02 22:38:46 +02:00
parent 1b4b82369b
commit 399a99346b
5 changed files with 174 additions and 129 deletions
+61 -61
View File
@@ -26,16 +26,7 @@ class _CompactWeatherDataState extends State<CompactWeatherData> {
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
_weatherData(),
Expanded(
child: Padding(
padding: const EdgeInsets.all(35),
child: FittedBox(
fit: BoxFit.fill,
child: Icon(weatherIcon(
widget.dwm.prevalentWeatherIcon()))))),
]),
_weatherData(),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -63,56 +54,65 @@ class _CompactWeatherDataState extends State<CompactWeatherData> {
}
Widget _weatherData() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
"${widget.dwm.dailyMaxTemp()} °C ",
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(fontStyle: FontStyle.normal),
),
const Icon(
Icons.circle,
size: 10,
color: Colors.grey,
),
Text(
" ${widget.dwm.dailyMinTemp()} °C",
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(fontStyle: FontStyle.normal, color: Colors.grey),
)
],
),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.barometer),
const SizedBox(width: 10),
Text("${widget.dwm.dailyAveragePressure().toString()} hPa")
]),
const SizedBox(height: 5),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.raindrop),
const SizedBox(width: 10),
Text("${widget.dwm.dailyPrecipitation().toString()} mm")
]),
const SizedBox(height: 5),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.cloud),
const SizedBox(width: 10),
Text("${widget.dwm.dailyAverageCloudCover().toString()} %")
]),
const SizedBox(height: 5),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.windy),
const SizedBox(width: 10),
Text("${widget.dwm.dailyAverageWindSpeed().toString()} km/h")
]),
],
);
return Row(children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
"${widget.dwm.dailyMaxTemp()} °C ",
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(fontStyle: FontStyle.normal),
),
const Icon(
Icons.circle,
size: 10,
color: Colors.grey,
),
Text(
" ${widget.dwm.dailyMinTemp()} °C",
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(fontStyle: FontStyle.normal, color: Colors.grey),
)
],
),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.barometer),
const SizedBox(width: 10),
Text("${widget.dwm.dailyAveragePressure().toString()} hPa")
]),
const SizedBox(height: 5),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.raindrop),
const SizedBox(width: 10),
Text("${widget.dwm.dailyPrecipitation().toString()} mm")
]),
const SizedBox(height: 5),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.cloud),
const SizedBox(width: 10),
Text("${widget.dwm.dailyAverageCloudCover().toString()} %")
]),
const SizedBox(height: 5),
Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
const Icon(WeatherIcons.windy),
const SizedBox(width: 10),
Text("${widget.dwm.dailyAverageWindSpeed().toString()} km/h")
]),
],
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 35),
child: FittedBox(
fit: BoxFit.contain,
child:
Icon(weatherIcon(widget.dwm.prevalentWeatherIcon()))))),
]);
}
}