forked from lxm_flutter/FlutterUnit
🎨 stateful组件重构完毕
This commit is contained in:
44
lib/views/widgets/StatefulWidget/Slider/node1_base.dart
Normal file
44
lib/views/widgets/StatefulWidget/Slider/node1_base.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
/// create by 张风捷特烈 on 2020-03-31
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明:
|
||||
// {
|
||||
// "widgetId": 42,
|
||||
// "name": 'Slider基本使用',
|
||||
// "priority": 1,
|
||||
// "subtitle":
|
||||
// "【value】 : 数值 【double】\n"
|
||||
// "【min】 : 最小值 【double】\n"
|
||||
// "【max】 : 最大值 【double】\n"
|
||||
// "【activeColor】 : 激活颜色 【Color】\n"
|
||||
// "【inactiveColor】 : 非激活颜色 【Color】\n"
|
||||
// "【onChanged】 : 改变时回调 【Function(double)】",
|
||||
// }
|
||||
class CustomSlider extends StatefulWidget {
|
||||
@override
|
||||
_CustomSliderState createState() => _CustomSliderState();
|
||||
}
|
||||
|
||||
class _CustomSliderState extends State<CustomSlider> {
|
||||
double _value = 0.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Text('当前值:${_value.toStringAsFixed(1)}'),
|
||||
Slider(
|
||||
value: _value,
|
||||
min: 0.0,
|
||||
max: 360.0,
|
||||
activeColor: Colors.orangeAccent,
|
||||
inactiveColor: Colors.green.withAlpha(99),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_value = value;
|
||||
});
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user