28 lines
668 B
Dart
28 lines
668 B
Dart
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())
|
|
],
|
|
);
|
|
}
|
|
}
|