是否可以在Flutter Web中创建永久的侧边栏?

问题描述 投票:1回答:1

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

[您是否知道是否有办法,可以通过某种方式使AppBar垂直于侧面向下,或者通过制作一个永久抽屉,例如MDC Web中可用的抽屉?

我最初的想法是使用一个带有此侧边栏的脚手架,在整个Navigator路线更改中持续存在。我曾尝试过使用嵌套的导航器,但是这些并没有帮助我达到理想的效果。

非常感谢您的帮助-雅各布

flutter flutter-layout flutter-web
1个回答
0
投票

enter image description here

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

//侧面布局文件

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,

                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.