首页 > 解决方案 > 如何在flutter_platform_widgets中使用抽屉:^0.72.0

问题描述

我正在尝试将抽屉与 PlatformScaffold 一起使用,但 MaterialAppBarData 似乎没有抽屉的命名参数。为较新版本使用颤振平台小部件添加抽屉的工作流程是什么。例如在 ^0.72.0 中。我似乎在文档或论坛中找不到任何关于此的信息。

标签: flutter

解决方案


找到一个使用 PlatformAppBar 的教程,发现我应该使用脚手架中的材料参数,而不是 PlatformAppBar 中的参数。关闭这个。下面是工作流程。

PlatformApp(
  home: PlatformScaffold(
    appBar: PlatformAppBar(
      title: Text("Title"),
    ),
    body: AppContent(),
    material: (context, platform) => MaterialScaffoldData(drawer: Drawer()),
  ),
);

推荐阅读