Slider Widget in Flutter


Here is the simple program for printing the singlechildscrollview column widget in Flutter.


Source Code

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: MyApp(),
  ));
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  double rate = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Slider"),
        ),
        body: Center(
          child: Slider(
            value: rate,
            onChanged: (newRate) {
              setState(() {
                rate = newRate;
              });
            },
            min: 0,
            max: 100,
            divisions: 4,
            label: "$rate",
          ),
        ));
  }
}
To download raw file Click Here