如何计算flutter中slide_up_panel的最小高度相关小部件?

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

我正在使用slide_up_panel包。我想给出slide_panel的最小高度,它保留在主体上替换的小部件下方。

我怎样才能实现这个目标?我希望我的面板位于 SizedBox(height:24) 小部件下方。我也尝试获取小部件位置并使用它,但没有帮助。

Scaffold(
  appBar: MainAppBar(),
  body: SlidingUpPanel(
    panelBuilder: (ScrollController sc) =>
        LastTransactionDraggableView1(
      _selectedPageIndex.value,
      cardTransactions: state.cardTransactions,
      controller: sc,
    ),
    color: Colour.pinBackground,
    borderRadius: BorderRadius.only(
      topLeft: Radius.circular(Dimens.dragRadius),
      topRight: Radius.circular(Dimens.dragRadius),
    ),
    maxHeight: MediaQuery.of(context).size.height -
        (MediaQuery.of(context).padding.top + kToolbarHeight),
    minHeight: MediaQuery.of(context).size.height - position.dy,
    body: RefreshIndicator(
      color: Colour.primary,
      onRefresh: () async {},
      child: ValueListenableBuilder(
          builder:
              (BuildContext context, value, Widget? child) {
            return SingleChildScrollView(
              physics: const AlwaysScrollableScrollPhysics(),
              child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    MainTabBar(
                        onChange: (index) =>
                            changeTabBar(state, index)),
                    FadeIndexedStack(
                        index: _selectedPageIndex.value,
                        children: [
                          CardPageView(state,
                              hide: state.hideData),
                          AccountPageView(state,
                              hide: state.hideData),
                        ]),
                    SizedBox(height: 24),
                    SizedBox(key: _key)
                  ]),
            );
          },
          valueListenable: _selectedPageIndex),
    ),
  ))

    ```
[![enter image description here][1]][1]


  [1]: https://i.stack.imgur.com/Kjbnf.png
android ios flutter position slide
1个回答
0
投票

设置 minHeight 属性来实现它。

© www.soinside.com 2019 - 2024. All rights reserved.