summaryrefslogtreecommitdiffstats
path: root/lib/Tier_pressure.dart
blob: cb8ace507043a6d0b929fed3015b2876f5c94b3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: Apache-2.0
import 'package:dashboard_app/size.dart';
import 'package:flutter/material.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';



class TierPressure extends StatefulWidget {
  String tname;
  double tpress;
  CrossAxisAlignment crossAxisAlignment;
  MainAxisAlignment mainAxisAlignment;
  TierPressure(
      {Key? key,
      required this.tname,
      required this.tpress,
      required this.crossAxisAlignment,
      required this.mainAxisAlignment})
      : super(key: key);

  @override
  State<TierPressure> createState() => _TierPressureState();
}

class _TierPressureState extends State<TierPressure> {
  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: SizeConfig.safeBlockVertical * 12,
      width: SizeConfig.safeBlockHorizontal * 14,
      child: Column(
        mainAxisAlignment: widget.mainAxisAlignment,

        children: [
          Text(
            '${widget.tname}',
            style: SizeConfig.smallnormalfont2,
          ),
          Text(
            widget.tpress.toString() + ' PSI',
            style: SizeConfig.smallnormalfont,
          ),
          LinearPercentIndicator(
            width: SizeConfig.safeBlockHorizontal * 11,

            progressColor: widget.tpress / 50 > 0.6 ? Colors.green : Colors.red,
            lineHeight: SizeConfig.safeBlockVertical * 1.5,
            alignment: MainAxisAlignment.center,
            animateFromLastPercent: true,
            animation: true,
            percent: widget.tpress / 50,

            barRadius: Radius.circular(SizeConfig.fontsize / 4),
            backgroundColor: Colors.grey,
          ),
        ],
      ),
    );
  }
}