add kilometer
This commit is contained in:
parent
b156cd084b
commit
18d5c83181
@ -7,7 +7,6 @@ import 'package:intl/intl.dart';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import '../classes/events.dart';
|
|
||||||
import '../classes/MyDrawer.dart';
|
import '../classes/MyDrawer.dart';
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
|
||||||
@ -21,8 +20,6 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
Events? events;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
@ -5,7 +5,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import '../classes/events.dart';
|
|
||||||
import '../classes/MyDrawer.dart';
|
import '../classes/MyDrawer.dart';
|
||||||
|
|
||||||
import '../classes/alert.dart';
|
import '../classes/alert.dart';
|
||||||
@ -16,8 +15,6 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
Events? events;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
@ -37,10 +34,20 @@ class EditSettings extends StatefulWidget {
|
|||||||
class _EditProfileState extends State<EditSettings>
|
class _EditProfileState extends State<EditSettings>
|
||||||
with ShowAlertDialog, ShowEventDialog {
|
with ShowAlertDialog, ShowEventDialog {
|
||||||
TextEditingController inputUserName = TextEditingController();
|
TextEditingController inputUserName = TextEditingController();
|
||||||
|
int? kilometer;
|
||||||
|
|
||||||
|
Future<void> getParameter() async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
if (kilometer != null) {
|
||||||
|
var kilometer = prefs.getInt("kilometer") ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
getParameter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -59,14 +66,44 @@ class _EditProfileState extends State<EditSettings>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0,
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
right: 15.0,
|
||||||
child: TextFormField(
|
top: 15.0,
|
||||||
controller: inputUserName,
|
bottom: 0.0,
|
||||||
|
),
|
||||||
|
child: DropdownButtonFormField<int>(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Pseudo',
|
labelText: 'Define kilometer',
|
||||||
hintText: 'Modifier le pseudo'),
|
),
|
||||||
|
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(
|
SizedBox(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user