display more data in daily weather widget, display weather icons

This commit is contained in:
Konstantin Kollar
2022-09-02 17:10:12 +02:00
parent 20d197c505
commit 1b4b82369b
3 changed files with 115 additions and 18 deletions
+64 -16
View File
@@ -25,22 +25,16 @@ class _CompactWeatherDataState extends State<CompactWeatherData> {
"${DateFormat('EEEE').format(widget.dwm.dateOfDay())}, ${widget.dwm.dateOfDay().day}.${widget.dwm.dateOfDay().month}.",
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 20),
Icon(weatherIcon(widget.dwm.prevalentWeatherIcon())),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
const Icon(WeatherIcons.thermometer),
Text(
"${widget.dwm.dailyMaxTemp()} °C",
style: Theme.of(context).textTheme.bodyLarge,
)
]),
const SizedBox(height: 20),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
const Icon(WeatherIcons.thermometer_exterior),
Text(
"${widget.dwm.dailyMinTemp()} °C",
style: Theme.of(context).textTheme.bodyLarge,
)
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()))))),
]),
const SizedBox(height: 20),
Row(
@@ -67,4 +61,58 @@ 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")
]),
],
);
}
}