aboutsummaryrefslogtreecommitdiffstats
path: root/lib/presentation/screens/media/widgets/gradient_progress_indicator.dart
blob: 24aa244799964a1ebde9d48e9daa6cd33364be3f (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
import 'package:flutter_ics_homescreen/core/utils/helpers.dart';
import 'package:flutter_ics_homescreen/export.dart';

class GradientProgressIndicator extends StatelessWidget {
  ///it can be anything between 0 to 100
  final int percent;
  final Gradient gradient;
  final Color backgroundColor;
  final double height;
  final String type;

  const GradientProgressIndicator(
      {required this.percent,
      required this.gradient,
      required this.backgroundColor,
      Key? key,
      this.height = 16,
      required this.type})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Flexible(
          flex: percent,
          fit: FlexFit.tight,
          child: Container(
            height: height,
            margin: const EdgeInsets.all(1),
            decoration: BoxDecoration(
              border: Border.all(
                  color: AGLDemoColors.neonBlueColor.withOpacity(0.5),
                  width: 1),
              gradient: gradient,
              borderRadius:
                  BorderRadius.all(Radius.circular(type == "fm" ? 16 : 2)),
            ),
            alignment: Alignment.centerRight,
          ),
        ),
        type == "media"
            ? Container(
                height: height,
                width: 2,
                color: Colors.white,
              )
            : Container(
                height: 64,
                width: 64,
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    boxShadow: [
                      Helpers.boxDropShadowRegular,
                    ],
                    color: AGLDemoColors.periwinkleColor),
                child: Container(
                  height: 32,
                  width: 32,
                  decoration: BoxDecoration(
                      shape: BoxShape.circle,
                      boxShadow: [
                        Helpers.boxDropShadowRegular,
                      ],
                      border: Border.all(
                          color: AGLDemoColors.neonBlueColor, width: 2),
                      color: AGLDemoColors.periwinkleColor),
                ),
              ),
        Flexible(
          fit: FlexFit.tight,
          flex: 100 - percent,
          child: Container(
            decoration: BoxDecoration(
              color: backgroundColor,
              border: Border.all(
                  color: AGLDemoColors.neonBlueColor.withOpacity(0.5),
                  width: 1),
              borderRadius: const BorderRadius.all(Radius.circular(2)),
            ),
            child: SizedBox(height: height),
          ),
        ),
      ],
    );
  }
}