Flutter 拖出文本

标签 flutter user-interface dart text flutter-web

我正在构建一个 flutter web 应用程序,我想在其中使用 Futura 粗体字体一些文本。文本位于列、容器和 Fittedbox 中,如下所示:

Container(
          width: MediaQuery.of(context).size.width * 0.9,
          child: FittedBox(
            fit: BoxFit.fitWidth,
            child: Text(
              'Join to closed beta',
              textAlign: TextAlign.center,
              style: TextStyle(
                fontFamily: 'FuturaBold',
                color: Colors.white,
                // fontSize: 50
              ),
            ),
          ),
        ),

字体的 pubspec.yaml 是这样的:

 fonts:
- family: FuturaBold
  fonts:
    - asset: lib/assets/fonts/Futura Bold font.ttf

但是,文本是垂直绘制的,因此看起来不像这样:enter image description here它看起来像这样:enter image description here 。我该如何解决这个问题?谢谢。

最佳答案

由于您使用的是合适的框并且没有设置高度而只设置了宽度,所以我非常确定您的文本能够按照他想要的方式垂直扩展。

Soo我认为问题出在字体本身。 您使用的字体不是原来的“Futura Bold”。

您可以从大写字母“J”和字母“t”中看到它。

原始的“Futura Bold”应该是这样的:

Futura bold screenshot

我的截图来自:

https://www.fonts.com/font/urw/futura?QueryFontType=Web&src=GoogleWebFonts

关于Flutter 拖出文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66537464/

相关文章:

flutter - 如何从列表中删除字符串的最后一个字母? Dart

firebase - 如何搜索查询列表并将其组合为单个查询?

Flutter 应用被 Google Play 商店拒绝 : Unsafe implementation of HostnameVerifier

Java GUI 线程

flutter - 在 Stack 中的两个小部件之间传递所有手势

java - 按下按钮后在另一个面板内打开另一个面板

java - 如何使用从另一个线程收到的信息更新主 UI? (当线程仍在运行时)

javascript - 用 Dart 将单词单数化

android - 断言失败 : line 65 pos 15: 'visible != null' : is not true

flutter - 删除 Dart 中的小数点