【问题标题】:Is there a way to create a permanent sidebar in Flutter Web?有没有办法在 Flutter Web 中创建一个永久的侧边栏?
【发布时间】:2019-10-08 05:13:07
【问题描述】:

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

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

我最初的想法是在 Navigator 路线更改中保留一个带有此侧边栏的 Scaffold。我尝试使用嵌套的导航器,但这些并没有帮助我达到我想要的效果。

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

【问题讨论】:

  • 任何解决方案了吗?
  • 看起来还不像@SagarChavada。我最近没有太多探索它,如果我能弄清楚一些事情,我会在有空的时候看看,我现在拥有比我第一次提出问题时更多的经验:)
  • 不用担心,我实现了。
  • 请问如何?

标签: flutter flutter-layout flutter-web


【解决方案1】:

 @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,

                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-18
    • 2016-02-24
    • 2023-01-01
    • 1970-01-01
    • 2018-01-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多