Этого можно добиться с помощью StatefulWidget
Это должно помочь вам
class ChangeTextSizeWithSeekBar extends StatefulWidget {
@override
_ChangeTextSizeWithSeekBarState createState() => _ChangeTextSizeWithSeekBarState();
}
class _ChangeTextSizeWithSeekBarState extends State<ChangeTextSizeWithSeekBar> {
double _value = 10;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
"My size will change",
style: TextStyle(
fontSize: _value
),
),
Slider(
onChanged: (value){
setState(() {
_value = value;
});
},
max: 100,
min: 10,
value: _value,
)
],
),
),
),
);
}
}
Вывод: