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

class ClimateControls extends StatefulWidget {
  const ClimateControls(
      {super.key,
      required this.child,
      required this.isSelected,
      required this.onPressed});
  final Widget child;
  final bool isSelected;
  final VoidCallback onPressed;

  @override
  State<ClimateControls> createState() => _ClimateControlsState();
}

class _ClimateControlsState extends State<ClimateControls> {
  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.sizeOf(context);

    return Container(
      margin: const EdgeInsets.all(8),
      width: size.width * 0.23,
      height: size.height * 0.07,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(2),
          boxShadow: [
            BoxShadow(
                offset: Offset(
                    widget.isSelected ? 0 : 1, widget.isSelected ? 4 : 2),
                blurRadius: widget.isSelected ? 4 : 3,
                spreadRadius: 0,
                color: Colors.black.withOpacity(widget.isSelected ? 0.25 : 0.7))
          ],
          gradient: LinearGradient(
              colors: widget.isSelected
                  ? [
                      AGLDemoColors.periwinkleColor,
                      AGLDemoColors.periwinkleColor.withOpacity(0.25)
                    ]
                  : [
                      AGLDemoColors.neonBlueColor,
                      AGLDemoColors.neonBlueColor.withOpacity(0.2)
                    ],
              begin: Alignment.centerLeft,
              end: Alignment.centerRight),
          border: Border.all(color: Colors.white12)),
      child: Container(
        padding: const EdgeInsets.all(2),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(2),
            boxShadow: [
              BoxShadow(
                  offset: Offset(
                      widget.isSelected ? 0 : 1, widget.isSelected ? 4 : 2),
                  blurRadius: widget.isSelected ? 4 : 3,
                  spreadRadius: 0,
                  color:
                      Colors.black.withOpacity(widget.isSelected ? 0.25 : 0.7))
            ],
            color: widget.isSelected
                ? AGLDemoColors.neonBlueColor
                : AGLDemoColors.buttonFillEnabledColor,
            border: Border.all(color: Colors.white12)),
        child: Material(
          color: Colors.transparent,
          child: InkWell(
            onTap: widget.onPressed,
            child: Center(
                child: Padding(
              padding: const EdgeInsets.symmetric(vertical: 8),
              child: widget.child,
            )),
          ),
        ),
      ),
    );
  }
}