Locations screen and add locations form
This commit is contained in:
@@ -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!),
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user