groupeGradient property

LinearGradient groupeGradient

Implementation

LinearGradient get groupeGradient {
  List<Color> _colors = [
    PoliticalParties(politicalPartiesEnum.SE).partiColor.withOpacity(0.65),
    PoliticalParties(politicalPartiesEnum.SE).partiColor.withOpacity(0.15),
    PoliticalParties(politicalPartiesEnum.SE).partiColor.withOpacity(0.15),
    PoliticalParties(politicalPartiesEnum.SE).partiColor.withOpacity(0.65)
  ];
  List<double> _stops = [0, 0.4, 0.6, 1];
  for (var i = 0; i < legisGroupsSubstitute.length; i++) {
    if (groupShort.replaceAll(".", ",") == legisGroupsSubstitute[i][0]) {
      if (legisGroupsSubstitute[i][2].length == 1) {
        _colors = [
          legisGroupsSubstitute[i][2][0].partiColor.withOpacity(0.65),
          legisGroupsSubstitute[i][2][0].partiColor.withOpacity(0.1),
          legisGroupsSubstitute[i][2][0].partiColor.withOpacity(0.1),
          legisGroupsSubstitute[i][2][0].partiColor.withOpacity(0.65)
        ];
        _stops = [0, 0.3, 0.7, 1];
      } else if (legisGroupsSubstitute[i][2].length == 2) {
        _colors = [];
        _stops = [];
        _colors
            .add(legisGroupsSubstitute[i][2][0].partiColor.withOpacity(0.65));
        _stops.add(0.1);
        _colors
            .add(legisGroupsSubstitute[i][2][0].partiColor.withOpacity(0.1));
        _stops.add(0.3);
        _colors
            .add(legisGroupsSubstitute[i][2][1].partiColor.withOpacity(0.1));
        _stops.add(0.7);
        _colors
            .add(legisGroupsSubstitute[i][2][1].partiColor.withOpacity(0.65));
        _stops.add(0.9);
      } else {
        _colors = [];
        _stops = [];
        for (int j = 0; j < legisGroupsSubstitute[i][2].length; j++) {
          _colors.add(
              legisGroupsSubstitute[i][2][j].partiColor.withOpacity(0.75));
          _stops.add(
              0.1 + (j / (legisGroupsSubstitute[i][2].length - 1)) * 0.8);
        }
      }
    }
  }
  return LinearGradient(
    colors: _colors,
    stops: _stops,
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  );
}