summaryrefslogtreecommitdiffstats
path: root/lib/presentation/screens/dashboard/widgets/child_lock.dart
blob: b8701d73e6817658253edcef1d6845db279a62e2 (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
import 'package:flutter_ics_homescreen/export.dart';

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

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final isChildLockActiveLeft = ref.watch(
      vehicleProvider.select((vehicle) => vehicle.isChildLockActiveLeft));

    return GestureDetector(
      onTap: () {
        debugPrint('Tapped child lock left');
        ref.read(vehicleProvider.notifier).setChildLock(side: 'left');
      },
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          const Text(
            'Child Lock',
            style: TextStyle(
              fontSize: 26, // Set the font size to 26
            ),
          ),
          Wrap(
            crossAxisAlignment: WrapCrossAlignment.center,
            children: [
              Icon(
                isChildLockActiveLeft ? Icons.lock : Icons.lock_open,
                color: isChildLockActiveLeft ? Colors.white : Colors.redAccent,
                size: 16,
              ),
              Text(
                isChildLockActiveLeft ? 'Activated' : 'Unlocked',
                style: TextStyle(
                  color: isChildLockActiveLeft ? Colors.white : Colors.redAccent,
                  fontSize: 26, // Set the font size to 26
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final isChildLockActiveRight = ref.watch(
      vehicleProvider.select((vehicle) => vehicle.isChildLockActiveRight));

    return GestureDetector(
      onTap: () {
        debugPrint('Tapped child lock right');
        ref.read(vehicleProvider.notifier).setChildLock(side: 'right');
      },
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const Text(
            'Child Lock',
            style: TextStyle(
              fontSize: 26, // Set the font size to 26
            ),
          ),
          Wrap(
            crossAxisAlignment: WrapCrossAlignment.center,
            children: [
              Text(
                isChildLockActiveRight ? 'Activated' : 'Unlocked',
                style: TextStyle(
                  color: isChildLockActiveRight ? Colors.white : Colors.redAccent,
                  fontSize: 26, // Set the font size to 26
                ),
              ),
              Icon(
                isChildLockActiveRight ? Icons.lock : Icons.lock_open,
                color: isChildLockActiveRight ? Colors.white : Colors.redAccent,
                size: 16,
              ),
            ],
          ),
        ],
      ),
    );
  }
}