added reusable slider, used it in mood page
parent
40018431dd
commit
92333d7b2d
|
@ -1,10 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:smoke_cess_app/widgets/slider.dart';
|
||||
|
||||
class MoodPage extends StatelessWidget {
|
||||
const MoodPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(child: Text('Hier Fragen wir die Stimmung ab'));
|
||||
return Column(children: const [MySlider(), Text('Freitext')]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class MySlider extends StatefulWidget {
|
||||
const MySlider({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => SliderState();
|
||||
}
|
||||
|
||||
class SliderState extends State<MySlider> {
|
||||
double _currentSliderValue = 50;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Slider(
|
||||
value: _currentSliderValue,
|
||||
max: 100,
|
||||
label: _currentSliderValue.round().toString(),
|
||||
onChanged: (double value) =>
|
||||
{setState((() => _currentSliderValue = value))}),
|
||||
Text(_currentSliderValue.round().toString())
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue