简体   繁体   English

如何根据屏幕特征确定可以适合 PageView 小部件的每个页面(子页面)的文本量?

[英]How to determine the amount of text that could fit on each page(child) of PageView widget, according to screen characteristics?

I am working on mobile app that represents a gamebook.我正在开发代表游戏本的移动应用程序。 It contains episodes and each of them is built of one or more pages of text.它包含剧集,每一集都由一页或多页文本构成。 For every episode I use PageView with children Columns(with nested Text and RichText) for each page.对于每一集,我对每个页面使用带有子列(带有嵌套文本和富文本)的 PageView。 The screen orientation is locked on portraitUp and the textScaleFactor - on 1.0.屏幕方向锁定在 PortraitUp 和 textScaleFactor - 1.0 上。 The problems I found with this approach are related with the different screen characteristics of mobile devices:我用这种方法发现的问题与移动设备的不同屏幕特性有关:

  1. I need to determine the amount of text for every child of the PageView.我需要确定 PageView 的每个子项的文本量。 But how much text will not bottom overflow on the smaller screens?但是有多少文本不会在较小的屏幕上底部溢出? My approach till now is to test on relatively small devices with resolution close to 360 x 640 logical pixels and to leave some extra space below text.到目前为止,我的方法是在分辨率接近 360 x 640 逻辑像素的相对较小的设备上进行测试,并在文本下方留出一些额外的空间。 Additionally I could make every page of the PageView scrollable, thus preventing overflow at all, but this will produce bad UX by my opinion.此外,我可以使 PageView 的每一页都可滚动,从而完全防止溢出,但我认为这会产生糟糕的用户体验。
  2. I use font size suitable for devices with the mentioned resolution.我使用适合具有上述分辨率的设备的字体大小。 But on considerably bigger screens it will not look pretty.但在相当大的屏幕上,它看起来并不漂亮。

So, is there good approach to determine how much text to place on each page of the PageView and to scale the font size according to mobile device size and screen characteristics?那么,有没有好的方法来确定在 PageView 的每个页面上放置多少文本并根据移动设备大小和屏幕特征缩放字体大小? Also, I will appreciate if anyone suggest better way to compose such book-like mobile app with Flutter(using different set of widgets).另外,如果有人提出更好的方法来使用 Flutter(使用不同的小部件集)编写这种类似书籍的移动应用程序,我将不胜感激。

Thanks for your time.谢谢你的时间。

@Milenb If you can add text pagination then I think it will solve your issue. @Milenb 如果您可以添加文本分页,那么我认为它会解决您的问题。 You wan't need to scale down/up on the basis of screen height.您不需要根据屏幕高度缩小/放大。 If you look in to this thread then you will know how to do this.如果您查看此线程,那么您将知道如何执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM