how to set showModalBottomSheet to full height

后端 未结 5 1894
星月不相逢
星月不相逢 2020-12-14 02:01

i use showRoundedModalBottomSheet, how to adjust this modal height till below the appbar?

5条回答
  •  隐瞒了意图╮
    2020-12-14 02:23

    1. You open class BottomSheet in library of flutter and change maxHeight

    from

    BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
    return BoxConstraints(
      minWidth: constraints.maxWidth,
      maxWidth: constraints.maxWidth,
      minHeight: 0.0,
      maxHeight: constraints.maxHeight * 9.0 / 16.0
    );}
    

    to

    BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
    return BoxConstraints(
      minWidth: constraints.maxWidth,
      maxWidth: constraints.maxWidth,
      minHeight: 0.0,
      maxHeight: constraints.maxHeight
    );}
    
    1. You can create a new class with other name and copy source code from class BottomSheet and change maxHeight

提交回复
热议问题