代码之家  ›  专栏  ›  技术社区  ›  Figen Güngör

为什么PopupMenuButton下拉列表与statusBar重叠?

  •  1
  • Figen Güngör  · 技术社区  · 7 年前

    当我为PopupMenuButton设置initialValue时,下拉列表与statusbar重叠。我怎样才能避免这种情况?另外,如何使PopupMenuButton的下拉位置位于appbar下方?

    enter image description here

    0 回复  |  直到 7 年前
        1
  •  0
  •   Dharmaraj    6 年前

    你可以试试这个:

      Widget getMessageText(double parentHeight, double parentWidth) {
        return Padding(
          padding:  EdgeInsets.only(right:parentWidth*0.06),
          child: Column(
            children: <Widget>[
              GestureDetector(
                onTap: (){
                  Navigator.pop(context);
    
                },
                child: Padding(
                  padding:  EdgeInsets.only(top: parentHeight*0.02,left: parentWidth*.03),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      new Text(
                        "All Posts",
                        style: CommonWidget.getHelveticaBoldTextStyle(
                            textFont, Colors.black.withOpacity(0.7)),
                        textScaleFactor: 1.1,
                      //  textAlign: TextAlign.center,
                      ),
                    ],
                  ),
                ),
              ),
              GestureDetector(
                onTap: (){
                  Navigator.pop(context);
    
    
                },
                child: Padding(
                  padding:  EdgeInsets.only(top: parentHeight*0.03,left: parentWidth*.03),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Text(
                        "Posts",
                        style: CommonWidget.getHelveticaBoldTextStyle(
                            textFont, Colors.black.withOpacity(0.7)),
                        textScaleFactor: 1.1,
                        //  textAlign: TextAlign.center,
                      ),
                    ],
                  ),
                ),
              ),
              GestureDetector(
                onTap: (){
    
                  Navigator.pop(context);
    
                },
                child: Padding(
                  padding:  EdgeInsets.only(top: parentHeight*0.03,left: parentWidth*.03),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Text(
                        "Complaints",
                        style: CommonWidget.getHelveticaBoldTextStyle(
                            textFont, Colors.black.withOpacity(0.7)),
                        textScaleFactor: 1.1,
                        //  textAlign: TextAlign.center,
                      ),
                    ],
                  ),
                ),
              )
            ],
          ),
        );
    
    
    
      }