busList function

dynamic busList (
  1. int idx,
  2. Function _containsFilter,
  3. Function _jumpMap
)

Implementation

Widget busList(int idx, Function _containsFilter, Function _jumpMap) {
  return ScrollablePositionedList.builder(
    itemCount: busTimeLists[idx].length,
    initialScrollIndex: _getTimeIndex(busTimeLists[idx]),
    itemBuilder: (context, index) {
      var curStopList = busStopLists[idx];
      var curTimeList = busTimeLists[idx];
      if (!_containsFilter(curStopList, curTimeList, index) ||
          curTimeList[index] == "- - - -") {
        return null;
      }
      return Card(
        child: ListTile(
          leading: Icon(Icons.directions_bus),
          title: Text(curStopList[index % curStopList.length][0]),
          subtitle: Text(curTimeList[index]),
          trailing: Icon(Icons.arrow_forward),
          onTap: () {
            _jumpMap(double.parse(curStopList[index % curStopList.length][1]),
                double.parse(curStopList[index % curStopList.length][2]));
          },
        ),
      );
    },
  );
}