2023-02-15 14:30:40 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2023-02-15 23:02:29 +01:00
|
|
|
double _currentSliderValue = 50;
|
|
|
|
|
2023-02-15 14:30:40 +01:00
|
|
|
class MySlider extends StatefulWidget {
|
|
|
|
const MySlider({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => SliderState();
|
2023-02-15 23:02:29 +01:00
|
|
|
|
|
|
|
double getSliderValue() {
|
|
|
|
return _currentSliderValue;
|
|
|
|
}
|
2023-02-15 14:30:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class SliderState extends State<MySlider> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-02-15 23:02:29 +01:00
|
|
|
return Column(
|
2023-02-15 14:30:40 +01:00
|
|
|
children: [
|
2023-02-15 23:02:29 +01:00
|
|
|
const Text('Bewerte deine Stimmung'),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Slider(
|
|
|
|
value: _currentSliderValue,
|
|
|
|
max: 100,
|
|
|
|
label: _currentSliderValue.round().toString(),
|
|
|
|
onChanged: (double value) =>
|
|
|
|
{setState((() => _currentSliderValue = value))}),
|
|
|
|
Text(_currentSliderValue.round().toString())
|
|
|
|
],
|
|
|
|
)
|
2023-02-15 14:30:40 +01:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|