问题标签 [fitted-box]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
589 浏览

text - FittedBox 和文本空白问题

我正在尝试使所有文本(长度不同)在一个固定宽度的框中适合,并且我希望它们在应用 FittedBox 时看起来与最长单词的大小相同。所以我正在做的就是用空白填充单词的其余部分,以使长度与最长的单词相匹配。但这并不完全有效,如下图所示:

在此处输入图像描述

这是代码:

你知道这里有什么问题吗?

0 投票
1 回答
654 浏览

listview - Infinite ListView of Images freeze app or throw exceptions during layout [small app included]

I'm trying to make a horizontally scrolling ListView with repeatable images to make it seem like it's one long image scrolling forever (like in 2d platform game).

A symmetric Image repeated in a list view, resulting in a seemingly endless loop

However, when I add images to the ListView.build(...) method I can't get them to scale properly. I want the Images to .fitHeight and after trying all widgets I can think of I get one of two outcomes.

  1. The app boots but freezes
  2. The app runs but throws exceptions

Here is the code in its entirety:

If you want to try it out with the example image (actually looks pretty good) you can download the "entire" repo here: https://github.com/joelbrostrom/infinite_listview_image_freeze_example

As you can see in the code comments Image.asset() freeze the app and wrapping it a FittedBox makes it runnable but with exceptions.

In my main project the second approach builds with exceptions in debug congif, but freezes in release. Maybe that's a clue?

Here is the exception I get when wrapping the image in the FittedBox:

Any insight would be appreciated!

0 投票
2 回答
1200 浏览

flutter - 颤振中最多有两条线的装配箱

看这张图

如果文本变得更长,我需要此行最多为两行并像 FittedBox(使用 BoxFit.fitWidth)一样缩小大小

当我使用 FittedBox 时,它看起来像这样。但是,如果需要,我需要将其增加到 2 行。任何解决方案都值得赞赏

0 投票
1 回答
35 浏览

flutter - FLutter:列内的 FittedBox 文本小部件

我有一个Column小部件,其中包含Text小部件作为其子级。Column 小部件中的第二Text个小部件应根据屏幕大小动态调整 fontSize,使其仅占用 1 行。它尝试将Text小部件包装在FittedBox.

但它不适用于列。我收到错误:

编辑:

0 投票
2 回答
18 浏览

flutter - 如何在 Flutter 中使我的应用程序标题和标签标签尽可能大

我正在制作一个颤振应用程序,供视力有限的人使用,并且我想让所有文本的大小与视口宽度一样大,达到指定的最大字体大小。实际的宽度和高度是动态的,所以我想使用媒体查询之类的东西来设置合理的大小。

我没有尝试过移动文本大小,我找不到任何对我有帮助的 SO 答案。

这是我现在尝试使用的代码,但它不起作用。