【发布时间】:2021-06-20 02:14:50
【问题描述】:
【问题讨论】:
【问题讨论】:
您可以根据需要使用内置的颤振Slider 小部件来实现此目的。找到下面的代码sn-ps。
final double sliderValue = 90.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
width: 350,
height: 350,
child: SliderTheme(
data: SliderThemeData(
overlayColor: Colors.transparent,
thumbShape: SliderComponentShape.noThumb,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text('HTML'),
Text(sliderValue.toInt().toString() + '%')
],
),
Slider(
value: 90,
min: 0.0,
max: 100.0,
divisions: 100,
mouseCursor: MouseCursor.uncontrolled,
onChanged: (double value) {}),
],
),
),
),
);
}
【讨论】:
final double value = 0.9;
Container(
color: Colors.black,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'html',
style: TextStyle(color: Colors.white),
),
Text(
'$value%',
style: TextStyle(color: Colors.grey),
)
],
),
LinearProgressIndicator(
value: 0.9,
color: Colors.yellow,
)
],
),
),
【讨论】: