当前位置: 首页 > 工具软件 > Double Slider > 使用案例 >

slider

卢勇
2023-12-01
import 'package:flutter/material.dart';

void main()=>runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}

class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
double reading=0.0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Slider(
value: reading,
min: 0.0,
max: 100.0,
inactiveColor: Colors.grey,
activeColor: Colors.orange,
label: 'value:$reading',
divisions: 10,
onChanged: (data){setState(() {
reading = data;
});})
],
),
);
}
}

转载于:https://www.cnblogs.com/braveheart007/p/10976118.html

 类似资料:

相关阅读

相关文章

相关问答