aboutsummaryrefslogtreecommitdiffstats
path: root/lib/presentation/screens/dashboard/widgets/range.dart
blob: aea92afe79d567d07033346166e70962d9c1fbc0 (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
import 'package:flutter_ics_homescreen/presentation/custom_icons/custom_icons.dart';

import '../../../../export.dart';

class RangeWidget extends ConsumerWidget {
  const RangeWidget({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final range = ref.watch(vehicleProvider.select((vehicle) => vehicle.range));
    final unit =
        ref.watch(unitStateProvider.select((unit) => unit.distanceUnit));
    return Container(
      height:130,
      width: 306,
      // padding: const EdgeInsets.all(10),
      decoration: const ShapeDecoration(
        gradient: RadialGradient(
          colors: [
            Color.fromARGB(255, 19, 24, 75),
            Color.fromARGB(127, 0, 0, 0)
          ],
          stops: [0, 0.7],
          radius: 1,
        ),
        //color: Colors.grey,
        shape: StadiumBorder(
            side: BorderSide(
          color: Color.fromARGB(156, 0, 0, 0),
          width: 2,
        )),
      ),
      alignment: Alignment.topLeft,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Icon(
            CustomIcons.range,
            color: Color(0xFF2962FF),
            size: 48,
          ),
          const SizedBox(width: 8),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Text(
                'Range',
                textAlign: TextAlign.start,
                style: TextStyle(
                  color: Color(0xFFC1D8FF),
                  fontSize: 26,
                ),
              ),
              RichText(
                text: TextSpan(
                  
                    text: '$range',
                    style: GoogleFonts.brunoAce(
                      
                      textStyle:
                           const TextStyle(
                        color: Colors.white,
                        fontSize: 44,
                      ),
                    ),
                    children: <TextSpan>[
                      TextSpan(
                        text:
                            unit == DistanceUnit.kilometers ? ' Km' : ' Mi',
                        style: GoogleFonts.brunoAce(
                          textStyle: const TextStyle(
                              color: Color(0xFFC1D8FF),
                              fontSize: 38),
                        ),
                      ),
                    ]),
              ),
            ],
          ),
        ],
      ),
    );
  }
}