Sliverlist не может отобразить страницу через go_router

При попытке отображения страницы через Material.router выбрасывает ошибку о том что CustomScrollView получил RenderSemanticsAnnotations, а ожидал RenderSliver не смотря на то что, в странице TestPage() находится список с одним элементом.

The following assertion was thrown building _FocusMarker:
A RenderViewport expected a child of type RenderSliver but received a child of type RenderSemanticsAnnotations.

RenderObjects expect specific types of children because they coordinate with their children during layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a RenderSliver does not understand the RenderBox layout protocol.
    The RenderViewport that expected a RenderSliver child was created by: Viewport ← IgnorePointer-[GlobalKey#37a38] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#51ead] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#08b2b] ← NotificationListener<ScrollMetricsNotification> ← Scrollable ← CustomScrollView ← ⋯
    The RenderSemanticsAnnotations that did not match the expected child type was created by: Semantics ← _FocusMarker ← Focus ← HeroControllerScope ← ScrollConfiguration ← MaterialApp ← Viewport ← IgnorePointer-[GlobalKey#37a38] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#51ead]

class App extends StatelessWidget {
  App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: CustomScrollView(
          slivers: [
            AppBarLayout(),
            MaterialApp.router(routerConfig: _router,)
          ],
        ),
        bottomNavigationBar: FooterNavbar());
}

final _router = GoRouter(
  initialLocation: "/test",
  navigatorKey: _rootNavigatorKey,
  routes: [
    GoRoute(
        path: "/test",
        builder: (BuildContext context, GoRouterState state) {
          return const TestPage();
        }),
  ],
);

class TestPage extends StatefulWidget {
  const TestPage({Key? key}) : super(key: key);

  @override
  State<TestPage> createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  @override
  Widget build(BuildContext context) {
    return SliverList(
    }, childCount: 0));
  }
}

С другой стороны если обращаться напрямую к нужной странце, то он отобразит ее корректно.

Widget build(BuildContext context) {
    return Scaffold(
        body: CustomScrollView(
          slivers: [
            AppBarLayout(),
            TestPage()
          ],
        ),
        bottomNavigationBar: FooterNavbar());
  }

Есть ли какие нибудь методы решения данной проблемы?


Ответы (0 шт):