summaryrefslogtreecommitdiffstats
path: root/lib/HomePage.dart
blob: accf7c1e285978da1a90fe92ba07b30e7e27f4a5 (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
137
138
// SPDX-License-Identifier: Apache-2.0
import 'package:dashboard_app/Tire_pressure.dart';
import 'package:dashboard_app/size.dart';
import 'package:dashboard_app/widgets/child_lock.dart';
import 'package:dashboard_app/widgets/fuel_and_speed.dart';
import 'package:dashboard_app/widgets/weather.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'vehicle-signals/vss_providers.dart';

class FuelRateText extends ConsumerWidget {
  final TextStyle style;

  FuelRateText({Key? key, required this.style}) : super(key: key);

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final vehicleFuelRate = ref.watch(vehicleSignalFuelRateProvider);

    return Text(
      vehicleFuelRate.rate.toString() + ' km/Litre',
      style: style,
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    SizeConfig().init(context);

    return Scaffold(
        backgroundColor: Colors.black,
        body: Stack(
          children: [
            Padding(
              padding: EdgeInsets.fromLTRB(
                  SizeConfig.safeBlockHorizontal * 3,
                  SizeConfig.safeBlockVertical * 3,
                  SizeConfig.safeBlockHorizontal * 3,
                  SizeConfig.safeBlockVertical),
              child: Column(
                children: [
                  SizedBox(height: SizeConfig.safeBlockVertical),
                  Flexible(
                    flex: 1,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [],
                    ),
                  ),
                  SizedBox(height: SizeConfig.safeBlockVertical),
                  Flexible(
                    flex: 2,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Flexible(flex: 1, child: Weather()),
                        Flexible(flex: 2, child: SpeedAndFuel()),
                      ],
                    ),
                  ),
                  Flexible(
                    flex: 11,
                    child: Container(
                      //color: Colors.red,
                      child: Row(children: [
                        Spacer(),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Container(height: SizeConfig.safeBlockVertical * 6),
                            FrontLeftTirePressure(),
                            Spacer(),
                            ChildLockStatus(),
                            Spacer(),
                            RearLeftTirePressure(),
                            Container(
                                height: SizeConfig.safeBlockVertical * 10),
                          ],
                        ),
                        Image.asset(
                          'images/car_img.png',
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Container(height: SizeConfig.safeBlockVertical * 6),
                            FrontRightTirePressure(),
                            Spacer(),
                            ChildLockStatus(),
                            Spacer(),
                            RearRightTirePressure(),
                            Container(
                                height: SizeConfig.safeBlockVertical * 10),
                          ],
                        ),
                        Spacer(),
                      ]),
                    ),
                  ),
                  Flexible(
                    flex: 1,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        Flexible(
                          flex: 1,
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                'Fuel Consumption',
                                style: SizeConfig.smallnormalfont2,
                              ),
                              FuelRateText(style: SizeConfig.smallnormalfont),
                            ],
                          ),
                        ),
                        Flexible(flex: 1, child: Rpm()),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ));
  }
}