Flutter 是否有办法绕过 Android 对表情符号的大小限制?

Spi*_*ail 9 android emoji flutter

Android 似乎仍然以一种奇怪的方式缩放表情符号。

我发现这是其他 Android 开发平台(直到 Android 11)中的一个问题,并且现在在 Android 12 中似乎仍然存在。 Android 讨论

也许 Flutter 有办法解决这个问题?比如缩放功能,或者在缩放之前转换为图像之类的?InteractiveViewer 不起作用(如果有的话,用 InteractiveViewer 包装列小部件是演示实际问题的好方法)。

我使用 Fitted box 将 Flutter 中的表情符号放大到父容器中的任何大小。它在大多数平台上都可以正常工作,但是在 Android 中,超过 90 像素会对最终渲染产生奇怪的影响。

这就是 dart-pad 中的样子:

DartPad 示例

现在在 Android 中(无论是真机还是模拟器):您可以清楚地看到缩放问题。大黄色曲线是应该为 90x90 的表情符号:

[编辑] 在模拟器上,没有大的黄色曲线,但表情符号仍然丢失。

安卓截图

这是您自己尝试的代码。

import 'package:flutter/material.dart';

const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: darkBlue,
      ),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    const String emoji = "";
    return InteractiveViewer(
      child: Column(children: [
        Container(
            color: Colors.green,
            width: 70,
            height: 70,
            child: const FittedBox(fit: BoxFit.contain, child: Text(emoji))),
        Container(
            color: Colors.green,
            width: 80,
            height: 80,
            child: const FittedBox(fit: BoxFit.contain, child: Text(emoji))),
        Container(
            color: Colors.red,
            width: 90,
            height: 90,
            child: const FittedBox(fit: BoxFit.contain, child: Text(emoji))),
        Container(
            color: Colors.red,
            width: 100,
            height: 100,
            child: const FittedBox(fit: BoxFit.contain, child: Text(emoji))),
        Container(
            color: Colors.red,
            width: 180,
            height: 180,
            child: const FittedBox(fit: BoxFit.contain, child: Text(emoji))),
      ]),
    );
  }
}

Run Code Online (Sandbox Code Playgroud)

[编辑]@Marcel Dz 在他们的评论中提到了一些内容“使用 flutter 版本 2.10.5 尝试你的代码”......调查仍在继续。

在此输入图像描述