簡體   English   中英

如何修復八邊形FloatingActionButton錯誤?

[英]How can I fix a octagon FloatingActionButton error?

我正在構建的應用程序中有一個非常奇怪的錯誤。 我的一個圖標出現了視覺錯誤,它基本上不會加載FloatingActionButton的背景。 它似乎與Stack中放置圖標的位置有關。

我已經嘗試在堆棧中切換兩個圖標,並將問題轉移到另一個圖標,所以看起來它與堆棧中的第四個位置有關。 但是,如果我添加一個空容器(只是為了嘗試),實際上並沒有解決問題。 我可以在虛擬設備和我的實際手機上復制問題。 它只顯示我更新構建狀態的時間。

我在這里的實際應用中上傳了該問題的屏幕截圖: https//ibb.co/M1fz4z8

這是按住按鈕的堆棧:

Stack(
            children: <Widget>[
              Container(
                height: (screenHeight / 4),
                width: screenWidth,
              ),
              Positioned(
                bottom: 0.0,
                left: -(screenWidth / 2),
                child: ClipRect(
                  child: Container(
                    height: ovalHeight,
                    width: ovalWidth,
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.only(
                          topLeft:
                              Radius.elliptical((ovalWidth), (ovalWidth / 3)),
                          topRight:
                              Radius.elliptical((ovalWidth), (ovalWidth / 3))),
                    ),
                  ),
                ),
              ),
              Align(
                alignment: Alignment(0.5, 0.0),
                child: SizedBox(
                  height: (screenWidth / 6),
                  width: (screenWidth / 6),
                  child: FloatingActionButton(
                    heroTag: 2,
                    backgroundColor: mainColor,
                    onPressed: () {
                      Navigator.push(
                          context,
                          MaterialPageRoute(
                              builder: (context) => HistoryScreen()));
                    },
                    child: Icon(Icons.assessment),
                  ),
                ),
              ),
              Align(
                alignment: Alignment(-0.5, 0),
                child: SizedBox(
                  height: (screenWidth / 6),
                  width: (screenWidth / 6),
                  child: FloatingActionButton(
                    heroTag: 3,
                    backgroundColor: mainColor,
                    onPressed: () {
                      Navigator.push(
                          context,
                          MaterialPageRoute(
                              builder: (context) => InfoScreen()));
                    },
                    child: Icon(Icons.info),
                  ),
                ),
              ),

            ],
          ),

我期待按鈕顯示它應該,現在而不是圓形背景它顯示一個奇怪的半透明八角形(盡管仍然顯示兒童圖標)。 沒有顯示錯誤消息。

我相信我已經確定了問題的來源。 它實際上來自我使用一個名為圓形圖表的插件,當使用圖表的圓角選項出現問題時。 我還沒有確定插件源代碼中導致問題的原因。 如果我搞清楚會發布。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM