这是构建函数的代码:
return Scaffold(
resizeToAvoidBottomInset: false,
body: Scrollbar(
isAlwaysShown: true,
controller: controller,
child: ListView(
controller: controller,
children: <Widget>[
Container(
color: model.cardThemeColor,
height: 600,
)
],
),
),
);
来自 MyApp 的代码:
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
return Future.value(false);
},
child: Navigator(
key: navigatorKey,
observers: [
FirebaseAnalyticsObserver(analytics: analytics),
],
pages: [
MaterialPage(child: getFirstScreen()),
],
onPopPage: (route, result) {
if (!route.didPop(result)) return false;
show404 = false;
notifyListeners();
return true;
},
),
);
}
和:
Widget getFirstScreen() {
return prov.Provider<CalendarAppointmentScreenBloc>(
create: (c) => CalendarAppointmentScreenBloc(),
child: prov.Consumer<CalendarAppointmentScreenBloc>(
builder: (__, bloc, _) => CalendarAppointmentScreen(
bloc: bloc,
analytics: analytics,
),
),
);
}
如果我删除“isAlwaysShown”,我没有错误。构建功能完成后出现错误。我没有明确调用控制器的功能。