Locations screen and add locations form

This commit is contained in:
Konstantin Kollar
2022-09-03 21:36:18 +02:00
parent 399a99346b
commit b0c4afe1f3
4 changed files with 189 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:wetter/components/locations/add_location_form.dart';
class Locations extends StatefulWidget {
const Locations({super.key});
@override
State<Locations> createState() => _LocationsState();
}
class _LocationsState extends State<Locations> {
late final SharedPreferences? prefs;
@override
void initState() {
SharedPreferences.getInstance().then((value) => prefs = value);
super.initState();
}
Future<void> initializePreferences() async {
prefs = await SharedPreferences.getInstance();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Locations'),
),
body: Padding(
padding: const EdgeInsets.all(20),
child: AddLocationsForm(prefs!),
));
}
}
+1
View File
@@ -41,6 +41,7 @@ class _MainWeatherViewState extends State<MainWeatherView>
@override
Widget build(BuildContext context) {
super.build(context);
return RefreshIndicator(
onRefresh: () {
return Future(() {