aboutsummaryrefslogtreecommitdiffstats
path: root/lib/page_dashboard.dart
blob: 9b36f873b630644ca6069e393b7cbb9484c6742d (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import 'package:flutter/material.dart';
import 'package:flutter_homescreen/layout_size_helper.dart';

class DashboardPage extends StatelessWidget {
  const DashboardPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var sizeHelper = LayoutSizeHelper(context);
    return Container(
      decoration: BoxDecoration(
          gradient: LinearGradient(
              begin: Alignment.topRight,
              end: Alignment.bottomLeft,
              colors: [Colors.teal.shade900, Colors.grey.shade900])),
      constraints: BoxConstraints.expand(),
      alignment: Alignment.center,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          Text(
            '0 kpm',
            style: Theme.of(context).textTheme.headline2,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.end,
                  children: [
                    Text(
                      'Left front tire',
                      style: Theme.of(context).textTheme.headline4,
                    ),
                    SizedBox(
                      height: sizeHelper.largeIconSize,
                    ),
                    Text(
                      'Left rear tire',
                      style: Theme.of(context).textTheme.headline4,
                    ),
                  ],
                ),
              ),
              Image.asset(
                'images/HMI_Dashboard_Car_720.png',
                width: sizeHelper.largeIconSize,
                fit: BoxFit.contain,
              ),
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      'Right front tire',
                      style: Theme.of(context).textTheme.headline4,
                    ),
                    SizedBox(
                      height: sizeHelper.largeIconSize,
                    ),
                    Text(
                      'Right rear tire',
                      style: Theme.of(context).textTheme.headline4,
                    ),
                  ],
                ),
              ),
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              _RPMWidget(),
              _FuelWidget(),
            ],
          )
        ],
      ),
    );
  }
}

class _RPMWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var sizeHelper = LayoutSizeHelper(context);
    return Stack(
      alignment: Alignment.center,
      children: [
        Text(
          'RPM',
          style: Theme.of(context).textTheme.headline4,
        ),
        Container(
          height: sizeHelper.largeIconSize,
          width: sizeHelper.largeIconSize,
          child: RotatedBox(
            quarterTurns: 2,
            child: CircularProgressIndicator(
              value: 0.75,
              strokeWidth: sizeHelper.largeIconSize / 4.0,
              semanticsLabel: 'RPM indicator',
            ),
          ),
        )
      ],
    );
  }
}

class _FuelWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var sizeHelper = LayoutSizeHelper(context);
    return Row(
      children: [
        Text(
          'Fuel',
          style: Theme.of(context).textTheme.headline4,
        ),
        Container(
          height: sizeHelper.largeIconSize / 4.0,
          width: sizeHelper.largeIconSize,
          margin: EdgeInsets.all(sizeHelper.largePadding),
          child: LinearProgressIndicator(
            value: 0.75,
            semanticsLabel: 'RPM indicator',
          ),
        )
      ],
    );
  }
}