import 'package:flutter/material.dart'; class MySlider extends StatefulWidget { const MySlider({super.key}); @override State createState() => SliderState(); } class SliderState extends State { 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()) ], ); } }