代码之家  ›  专栏  ›  技术社区  ›  skjagini

颤振:显示叠加,即使路线因用户操作而改变。

  •  0
  • skjagini  · 技术社区  · 7 年前

    我有两个视图,订单视图和订单详细信息视图。

    我想在订单视图上显示一个覆盖图(底部的小部分),当用户选择一个订单时,我们显示详细信息视图,但我想继续显示覆盖图,我想按路线更改,以便后退按钮等工作。

    这是可行的吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   EdHuamani Amit Toren    7 年前

    使用 showModalBottomSheet 更多的例子: modal_bottom_sheet_demo persistent_bottom_sheet_demo

    考试:

      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: const Text('Modal bottom sheet'),
          ),
          body: Center(
            child: RaisedButton(
              child: const Text('SHOW BOTTOM SHEET'),
              onPressed: () {
                showModalBottomSheet<void>(
                  context: context,
                  builder: (BuildContext context) {
                    return Container(
                      child: Padding(
                        padding: const EdgeInsets.all(32.0),
                        child: Text(
                          'This is the modal bottom sheet. Tap anywhere to dismiss.',
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Theme.of(context).accentColor, fontSize: 24.0),
                        ),
                      ),
                    );
                  },
                );
              },
            ),
          ),
        );
      }