import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; import 'package:smoke_cess_app/providers/input_provider.dart'; class MySlider extends StatelessWidget { const MySlider({super.key}); @override Widget build(BuildContext context) { InputProvider inputModel = context.watch(); return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const SizedBox(height: 16), Text('${inputModel.sliderValue.toInt()}', style: const TextStyle(fontSize: 22)), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( icon: const Icon(Icons.remove_outlined), onPressed: () { inputModel.sliderValue -= 1; }, ), Expanded( child: Slider( value: inputModel.sliderValue, min: 0, max: 100, divisions: 100, label: '${inputModel.sliderValue.toInt()}', onChanged: (double value) { inputModel.sliderValue = value; }, ), ), IconButton( icon: const Icon(Icons.add_outlined), onPressed: () { inputModel.sliderValue += 1; }, ), ], ), ], ), ); } }