Slider
Slider({ @required double value, @required ValueChanged onChanged, ValueChanged onChangeStart, ValueChanged onChangeEnd, double min: 0.0, double max: 1.0, int divisions, String label, Color activeColor, Color inactiveColor, SemanticFormatterCallback semanticFormatterCallback })
açıklama
Kaydırılabilir slider oluşturan widget.
parametreler
Slider(
value: _duelCommandment.toDouble(),
min: 1.0,
max: 10.0,
divisions: 10,
label: '$_duelCommandment',
onChanged: (double newValue) {
setState(() {
_duelCommandment = newValue.round();
});
},
)
örnek uygulama

import 'package:flutter/material.dart';
void main()
{
runApp(new MaterialApp(
home: new MyApp(),
debugShowCheckedModeBanner: false,
color: Colors.red,
));
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
String message = "Slider Scale";
double _value =0.0;
void onChanged(double value)
{
setState(() {
_value = value;
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Flutter Application"),//Appbar text Title
),
body: new Container(
padding: new EdgeInsets.all(32.0),
child: new Column(
children: < Widget> [
new Text('Slider value is ${_value}'),
new Slider(
inactiveColor: Colors.red,
max: 100.0,
min: 0.0,
value: _value,
onChanged: (double value)
{
onChanged(value);
}
)
],
),
),
);
}
}