mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-23 09:47:55 +00:00
Animated AqiSubValueWidget.
This commit is contained in:
@@ -3,27 +3,24 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
|||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
|
|
||||||
final class _AqiRange {
|
final class _AqiRange {
|
||||||
const _AqiRange({
|
const _AqiRange({required this.max, required this.color});
|
||||||
required this.max,
|
|
||||||
required this.color,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int max;
|
final int max;
|
||||||
final Color color;
|
final Color color;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AqiSubValueWidget extends StatelessWidget {
|
class AqiSubValueWidget extends StatelessWidget {
|
||||||
final String label;
|
|
||||||
final int value;
|
|
||||||
final String unit;
|
|
||||||
|
|
||||||
const AqiSubValueWidget({
|
const AqiSubValueWidget({
|
||||||
super.key,
|
|
||||||
required this.label,
|
required this.label,
|
||||||
required this.value,
|
required this.value,
|
||||||
required this.unit,
|
required this.unit,
|
||||||
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
final int value;
|
||||||
|
final String unit;
|
||||||
|
|
||||||
static const List<_AqiRange> _ranges = [
|
static const List<_AqiRange> _ranges = [
|
||||||
_AqiRange(max: 12, color: ColorsManager.goodGreen),
|
_AqiRange(max: 12, color: ColorsManager.goodGreen),
|
||||||
_AqiRange(max: 35, color: ColorsManager.poorOrange),
|
_AqiRange(max: 35, color: ColorsManager.poorOrange),
|
||||||
@@ -106,7 +103,9 @@ class AqiSubValueWidget extends StatelessWidget {
|
|||||||
alpha: isActive ? 1.0 : 0.25,
|
alpha: isActive ? 1.0 : 0.25,
|
||||||
);
|
);
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 150),
|
||||||
|
curve: Curves.linear,
|
||||||
height: 5,
|
height: 5,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: color,
|
color: color,
|
||||||
|
|||||||
Reference in New Issue
Block a user