Show temperature of today after starting app

This commit is contained in:
Konstantin Kollar
2022-08-31 10:53:36 +02:00
parent e2e6cab479
commit bc3dcf575c
6 changed files with 107 additions and 6 deletions
+46
View File
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:weather_icons/weather_icons.dart';
import 'package:wetter/models/daily_weather_model.dart';
class CompactWeatherData extends StatefulWidget {
final DailyWeatherModel dwm;
const CompactWeatherData(this.dwm, {Key? key}) : super(key: key);
@override
State<CompactWeatherData> createState() => _CompactWeatherDataState();
}
class _CompactWeatherDataState extends State<CompactWeatherData> {
@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [
Text(
"${DateFormat('EEEE').format(DateTime.now().toLocal())}, ${DateTime.now().toLocal().day}.${DateTime.now().toLocal().month}.",
style: Theme.of(context).textTheme.headline4,
),
const SizedBox(height: 20),
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,
)
]),
],
)));
}
}