Files
wetterApp/lib/screens/locations.dart
T
2022-09-03 21:36:18 +02:00

37 lines
914 B
Dart

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!),
));
}
}