Flutter – 导航栏上方的细线,对于某些高度值?

huangapple go评论74阅读模式
英文:

Flutter - tiny thin line above navigation bar for some height values?

问题

我有一个应用程序,在尝试创建一个自定义对话框界面,其中我使屏幕变暗(除了应用栏)。我实现的方式是将导航栏和主体内容都转化为堆栈,顶部放置一个半透明的黑色层。

我的问题是有一条极细的线(大约1-2像素的高度)在变暗的层之间没有重叠。

我尝试了所有方法 - 将导航栏的高度设置为0等,但仍然找不到解决办法,除非将堆栈中的小部件高度增加2像素(然后会出现“RenderFlex在底部溢出2.0像素”的错误消息)。

然而,这个“解决办法”对我来说真的令人费解,因为它似乎暗示着这个问题只存在于某些高度而不是其他高度,因此可能会在其他设备上发生。有其他人遇到过类似的情况吗?

唯一可能相关的其他细节是,这个脚手架是在 GoRouter ShellRoute 下显示的。

英文:

I have an app where I'm trying to do a custom dialog UI where I darken the screen (except for the app bar). The way I'm implementing this is I'm turning both my navigation bar and body content into stacks, with a translucent black layer at the top of the stack.

My issue is that there is a tiny thin line (about the height of 1-2 pixels) where the darkened layers don't overlap.

I've tried everything - setting navigation bar elevation to 0, etc but I still can't find a fix for this, other than increasing the height of the widgets in my stack by 2 pixels (which then results in "A RenderFlex overflowed by 2.0 pixels on the bottom." error messages).

Still, this "fix" is really baffling to me, because it seems to imply that this problem only exists for some heights and not others, so it could potentially occur on other devices. Has anyone else run into something like this before?

The only other detail that could possibly be relevant is that this scaffold is displayed under a GoRouter ShellRoute.

答案1

得分: 1

你知道官方API是否可以只做这个?
https://api.flutter.dev/flutter/material/showDialog.html

假设你会遇到更少的障碍...

英文:

Are you aware of the official api to do just this?
https://api.flutter.dev/flutter/material/showDialog.html

Assuming you'll run into less hurdles...

huangapple
  • 本文由 发表于 2023年6月6日 14:52:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76412103.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定