Show temperature of today after starting app
This commit is contained in:
@@ -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,
|
||||
)
|
||||
]),
|
||||
],
|
||||
)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user