Skip to content

Instantly share code, notes, and snippets.

@FantasyCheese
Created July 2, 2021 08:56
Show Gist options
  • Save FantasyCheese/40bdea3393ee4e6e19da5a4d8155504e to your computer and use it in GitHub Desktop.
Save FantasyCheese/40bdea3393ee4e6e19da5a4d8155504e to your computer and use it in GitHub Desktop.
Flutter slider minimum
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: App(),
),
);
}
class App extends StatefulWidget {
const App({Key key}) : super(key: key);
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
double value = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: Slider(
value: value,
min: 0,
max: 20,
divisions: 20,
onChanged: (value) {
if (value > 5) {
setState(() {
this.value = value;
});
}
},
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment