有没有办法在 Flutter Web 中创建永久侧边栏?

Jak*_*vát 6 flutter flutter-layout flutter-web

我已经开始使用 Flutter Web 构建网站,但遇到了无法创建持久侧边栏的问题。

您知道是否有办法做到这一点,要么通过某种方式使 AppBar 垂直向下,要么通过制作一个永久抽屉,就像MDC Web中提供的那样?

我最初的想法是拥有一个脚手架,该侧边栏在导航器路线更改时持续存在。我尝试使用嵌套导航器,但这些并没有帮助我达到我想要的效果。

非常感谢你的帮助
--Jakub

Sag*_*ada 4

在此输入图像描述

 @override
      Widget build(BuildContext context) {
        return Row(
            children: <Widget>[
              SideLayout(),
              Expanded(
                  flex: 4,
                  child: //your child
              )])
      }
Run Code Online (Sandbox Code Playgroud)

// 侧面布局文件

class SideLayout extends StatelessWidget {
  const SideLayout({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Expanded(
        child: Container(
          padding: EdgeInsets.symmetric(horizontal: 20),
          color: Color(0xff404040),
          child: Column(
            children: <Widget>[
              SizedBox(height: 70),
              Image.asset('assets/images/logo.png'),
              Text(
                'Build beautiful Apps',
                textAlign: TextAlign.center,
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 30,
                  fontWeight: FontWeight.w400,

                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)