diff --git a/covas_mobile/lib/pages/EditProfile.dart b/covas_mobile/lib/pages/EditProfile.dart index 02a2ded..805c5b7 100644 --- a/covas_mobile/lib/pages/EditProfile.dart +++ b/covas_mobile/lib/pages/EditProfile.dart @@ -7,7 +7,6 @@ import 'package:intl/intl.dart'; import 'dart:convert'; import 'dart:io'; -import '../classes/events.dart'; import '../classes/MyDrawer.dart'; import '../main.dart'; @@ -21,8 +20,6 @@ void main() { } class MyApp extends StatelessWidget { - Events? events; - @override Widget build(BuildContext context) { return MaterialApp( diff --git a/covas_mobile/lib/pages/EditSettings.dart b/covas_mobile/lib/pages/EditSettings.dart index 36be328..0f91293 100644 --- a/covas_mobile/lib/pages/EditSettings.dart +++ b/covas_mobile/lib/pages/EditSettings.dart @@ -5,7 +5,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'dart:convert'; import 'dart:io'; -import '../classes/events.dart'; import '../classes/MyDrawer.dart'; import '../classes/alert.dart'; @@ -16,8 +15,6 @@ void main() { } class MyApp extends StatelessWidget { - Events? events; - @override Widget build(BuildContext context) { return MaterialApp( @@ -37,10 +34,20 @@ class EditSettings extends StatefulWidget { class _EditProfileState extends State with ShowAlertDialog, ShowEventDialog { TextEditingController inputUserName = TextEditingController(); + int? kilometer; + + Future getParameter() async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + + if (kilometer != null) { + var kilometer = prefs.getInt("kilometer") ?? null; + } + } @override void initState() { super.initState(); + getParameter(); } @override @@ -59,14 +66,44 @@ class _EditProfileState extends State children: [ Padding( padding: const EdgeInsets.only( - left: 15.0, right: 15.0, top: 15, bottom: 0), - //padding: EdgeInsets.symmetric(horizontal: 15), - child: TextFormField( - controller: inputUserName, + left: 15.0, + right: 15.0, + top: 15.0, + bottom: 0.0, + ), + child: DropdownButtonFormField( decoration: InputDecoration( - border: OutlineInputBorder(), - labelText: 'Pseudo', - hintText: 'Modifier le pseudo'), + border: OutlineInputBorder(), + labelText: 'Define kilometer', + ), + value: + kilometer, // Set the initial selected value here, or leave as `null` if unselected. + items: [ + DropdownMenuItem( + value: 5, + child: Text('5km'), + ), + DropdownMenuItem( + value: 25, + child: Text('25km'), + ), + DropdownMenuItem( + value: 50, + child: Text('50km'), + ), + DropdownMenuItem( + value: 75, + child: Text('75km'), + ), + DropdownMenuItem( + value: 100, + child: Text('100km'), + ), + ], + onChanged: (int? newValue) { + // Handle selection + kilometer = newValue; + }, ), ), SizedBox(