buildRouteInfoWidget method

List<Widget> buildRouteInfoWidget()

Implementation

List<Widget> buildRouteInfoWidget() {
  List<Widget> widgets = <Widget>[];
  if (_route == null) {
    return widgets;
  }
  do {
    if (_route?.current != null) {
      widgets.add(
        Container(
          padding: EdgeInsets.all(12),
          width: MediaQuery.of(context).size.width,
          decoration: BoxDecoration(
            color: Color(0xfff5f6f7),
            borderRadius: const BorderRadius.all(Radius.circular(4.0)),
          ),
          alignment: Alignment.topLeft,
          child: RichText(
            text: TextSpan(
              children: [
                TextSpan(
                  text: '路由名称: ',
                  style: TextStyle(
                    fontSize: 10,
                    color: Color(0xff333333),
                    height: 1.5,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                TextSpan(
                  text: '${_route!.current?.settings.name}',
                  style: TextStyle(
                    fontSize: 10,
                    height: 1.5,
                    color: Color(0xff666666),
                  ),
                ),
                TextSpan(
                  text: '\n路由参数: ',
                  style: TextStyle(
                    height: 1.5,
                    fontSize: 10,
                    color: Color(0xff333333),
                    fontWeight: FontWeight.bold,
                  ),
                ),
                TextSpan(
                  text: '${_route!.current?.settings.arguments}',
                  style: TextStyle(
                    fontSize: 10,
                    height: 1.5,
                    color: Color(0xff666666),
                  ),
                ),
                TextSpan(
                  text: '\n所在Navigator: ',
                  style: TextStyle(
                    fontSize: 10,
                    height: 1.5,
                    color: Color(0xff333333),
                    fontWeight: FontWeight.bold,
                  ),
                ),
                TextSpan(
                  text: _route!.parentNavigator.toString(),
                  style: TextStyle(
                    fontSize: 10,
                    height: 1.5,
                    color: Color(0xff666666),
                  ),
                ),
                TextSpan(
                  text: '\n所有信息: ',
                  style: TextStyle(
                    fontSize: 10,
                    height: 1.5,
                    color: Color(0xff333333),
                    fontWeight: FontWeight.bold,
                  ),
                ),
                TextSpan(
                  text: _route!.current.toString(),
                  style: TextStyle(
                    fontSize: 10,
                    height: 1.5,
                    color: Color(0xff666666),
                  ),
                ),
              ],
            ),
          ),
        ),
      );
    }
    _route = _route?.parent;
    if (_route != null && _route?.parent != null) {
      widgets.add(
        Container(
          margin: EdgeInsets.only(top: 10, bottom: 10),
          alignment: Alignment.center,
          child: Image.asset(
            'assets/images/dk_route_arrow.png',
            height: 13,
            width: 12,
          ),
        ),
      );
    }
    // 过滤掉dokit自带的navigator
  } while (_route != null);
  return widgets;
}