filterBreakPoints method

List<String> filterBreakPoints(
  1. List<String> attributes,
  2. Size size
)

Implementation

List<String> filterBreakPoints(List<String> attributes, Size size) {
  String? breakPoint = getBreakPoint(size);
  var result = <String>[];
  for (var i = 0; i < attributes.length; i++) {
    var attribute = attributes[i];
    var regExp = new RegExp(r"^..:");
    var allStringMatches = _allStringMatches(attribute, regExp);

    if (allStringMatches.length > 0) {
      var key = allStringMatches.first;
      // print(key);
      var dataToAdd = attribute.replaceFirst(key, "");
      if (breakPoint == null) {
      } else if (breakPoint == "sm") {
        result.add(dataToAdd);
      } else if (breakPoint == "md") {
        if (["sm:", "md:"].contains(key)) {
          result.add(dataToAdd);
        }
      } else if (breakPoint == "lg") {
        if (["sm:", "md:", "lg:"].contains(key)) {
          result.add(dataToAdd);
        }
      }
    } else {
      result.add(attribute);
    }
  }
  return result;
}