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