|  |  | @ -1,5 +1,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'dart:async'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'dart:math'; |  |  |  | import 'dart:math'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:fl_chart/fl_chart.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:flutter/material.dart'; |  |  |  | import 'package:flutter/material.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:flutter_ring_indicator/ring_indicator.dart'; |  |  |  | import 'package:flutter_ring_indicator/ring_indicator.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -37,15 +39,25 @@ class _MyHomePageState extends State<MyHomePage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |   double value2 = 50; |  |  |  |   double value2 = 50; | 
			
		
	
		
		
			
				
					
					|  |  |  |   double value3 = 10; |  |  |  |   double value3 = 10; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   List<double> points = [0]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   void _incrementCounter() { |  |  |  |   void _incrementCounter() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     setState(() { |  |  |  |     setState(() { | 
			
		
	
		
		
			
				
					
					|  |  |  |       value1 = Random().nextDouble() * 100; |  |  |  |       value1 = Random().nextDouble() * 100; | 
			
		
	
		
		
			
				
					
					|  |  |  |       value2 = Random().nextDouble() * 100; |  |  |  |       value2 = Random().nextDouble() * 100; | 
			
		
	
		
		
			
				
					
					|  |  |  |       value3 = Random().nextDouble() * 100; |  |  |  |       value3 = Random().nextDouble() * 100; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       points.add(value2 - 20); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if (points.length > 20) points.removeAt(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |     }); |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   void initState() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     Timer.periodic(const Duration(seconds: 1), (timer) => _incrementCounter()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     super.initState(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   Widget build(BuildContext context) { |  |  |  |   Widget build(BuildContext context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     return Scaffold( |  |  |  |     return Scaffold( | 
			
		
	
		
		
			
				
					
					|  |  |  |       appBar: AppBar( |  |  |  |       appBar: AppBar( | 
			
		
	
	
		
		
			
				
					|  |  | @ -56,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |           mainAxisAlignment: MainAxisAlignment.center, |  |  |  |           mainAxisAlignment: MainAxisAlignment.center, | 
			
		
	
		
		
			
				
					
					|  |  |  |           children: <Widget>[ |  |  |  |           children: <Widget>[ | 
			
		
	
		
		
			
				
					
					|  |  |  |             SizedBox.square( |  |  |  |             SizedBox.square( | 
			
		
	
		
		
			
				
					
					|  |  |  |               dimension: 200, |  |  |  |               dimension: 240, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |               child: RingIndicator( |  |  |  |               child: RingIndicator( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ringColor: Colors.deepPurpleAccent, |  |  |  |                 ringColor: Colors.deepPurpleAccent, | 
			
		
	
		
		
			
				
					
					|  |  |  |                 startAngel: pi * -0.7, |  |  |  |                 startAngel: pi * -0.7, | 
			
		
	
	
		
		
			
				
					|  |  | @ -76,9 +88,12 @@ class _MyHomePageState extends State<MyHomePage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                       child: Column( |  |  |  |                       child: Column( | 
			
		
	
		
		
			
				
					
					|  |  |  |                         mainAxisSize: MainAxisSize.min, |  |  |  |                         mainAxisSize: MainAxisSize.min, | 
			
		
	
		
		
			
				
					
					|  |  |  |                         children: [ |  |  |  |                         children: [ | 
			
		
	
		
		
			
				
					
					|  |  |  |                           Text(values.level(0)?.toStringAsFixed(1) ?? '/', style: const TextStyle(fontSize: 18)), |  |  |  |                           Text('温度 ${values.level(1)?.toStringAsFixed(1) ?? '/'} ℃', | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           Text(values.level(1)?.toStringAsFixed(1) ?? '/', style: const TextStyle(fontSize: 24)), |  |  |  |                               style: const TextStyle(fontSize: 18)), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           Text(values.level(2)?.toStringAsFixed(1) ?? '/', style: const TextStyle(fontSize: 18)), |  |  |  |                           Text('频率 ${((values.level(0) ?? 0) / 20).toStringAsFixed(1)} GHz', | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               style: const TextStyle(fontSize: 24)), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           Text('利用率 ${values.level(2)?.toStringAsFixed(1) ?? '/'} %', | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               style: const TextStyle(fontSize: 18)), | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ], |  |  |  |                         ], | 
			
		
	
		
		
			
				
					
					|  |  |  |                       ), |  |  |  |                       ), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ), |  |  |  |                     ), | 
			
		
	
	
		
		
			
				
					|  |  | @ -102,7 +117,7 @@ class _MyHomePageState extends State<MyHomePage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |             ), |  |  |  |             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |             const SizedBox(height: 50), |  |  |  |             const SizedBox(height: 50), | 
			
		
	
		
		
			
				
					
					|  |  |  |             SizedBox.square( |  |  |  |             SizedBox.square( | 
			
		
	
		
		
			
				
					
					|  |  |  |               dimension: 200, |  |  |  |               dimension: 240, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |               child: RingIndicator( |  |  |  |               child: RingIndicator( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ringColor: Colors.teal, |  |  |  |                 ringColor: Colors.teal, | 
			
		
	
		
		
			
				
					
					|  |  |  |                 startAngel: halfPi, |  |  |  |                 startAngel: halfPi, | 
			
		
	
	
		
		
			
				
					|  |  | @ -138,6 +153,58 @@ class _MyHomePageState extends State<MyHomePage> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ), |  |  |  |                 ), | 
			
		
	
		
		
			
				
					
					|  |  |  |               ), |  |  |  |               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |             ), |  |  |  |             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             const SizedBox(height: 50), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             SizedBox.square( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               dimension: 240, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               child: RingIndicator( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ringColor: Colors.blueAccent, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 startAngel: -0.8 * pi, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 endAngel: 0.8 * pi, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 maxValue: 100, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 value: value2, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 labelBuilder: (values) => [ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   const Align( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     alignment: Alignment.bottomCenter, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     child: Text('占用率', style: TextStyle(fontSize: 28, height: 1.8)), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   Center( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     child: FractionallySizedBox( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       widthFactor: 0.8, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       heightFactor: 0.4, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       child: LineChart( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         LineChartData( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           maxX: 20, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           minX: 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           maxY: 50, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           minY: -50, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           lineBarsData: [ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             LineChartBarData( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               spots: <FlSpot>[ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ...List.generate(20 - points.length, (index) => FlSpot.nullSpot), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ...points.reversed | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     .toList() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     .asMap() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     .entries | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     .map((e) => FlSpot(20 - e.key.toDouble(), e.value)), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               ].reversed.toList(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               isCurved: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               dotData: FlDotData(show: false), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               barWidth: 3, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               belowBarData: BarAreaData( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 show: false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           ], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           titlesData: FlTitlesData(show: false), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           borderData: FlBorderData(show: false), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         swapAnimationDuration: Duration.zero, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |           ], |  |  |  |           ], | 
			
		
	
		
		
			
				
					
					|  |  |  |         ), |  |  |  |         ), | 
			
		
	
		
		
			
				
					
					|  |  |  |       ), |  |  |  |       ), | 
			
		
	
	
		
		
			
				
					|  |  | 
 |