Flutter Web - Scrollbar with ListView - _positions.isNotEmpty "ScrollController not attached to any scroll views

129 views Asked by At

This is my Tree: enter image description here

This is the code for the build function:

    return Scaffold(
  resizeToAvoidBottomInset: false,
  body: Scrollbar(
    isAlwaysShown: true,
    controller: controller,
    child: ListView(
      controller: controller,
      children: <Widget>[
        Container(
          color: model.cardThemeColor,
          height: 600,
        )
      ],
    ),
  ),
);

code from 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;
        },
      ),
    );
  }

and:

  Widget getFirstScreen() {
  return prov.Provider<CalendarAppointmentScreenBloc>(
    create: (c) => CalendarAppointmentScreenBloc(),
    child: prov.Consumer<CalendarAppointmentScreenBloc>(
      builder: (__, bloc, _) => CalendarAppointmentScreen(
        bloc: bloc,
        analytics: analytics,
      ),
    ),
  );

}

If I remove the 'isAlwaysShown', I don't have the error. The error appears after the build function completes. I don't explicitly call the controller's functions.

0

There are 0 answers