ios - iOS Flutter-如何调整字符串表情符号的大小?
问题描述
在 Android 设备上运行时,我的应用程序在下面将显示的示例中没有出现对齐问题。当我想在我的 iOS 设备上运行它时,我遇到了以下对齐问题。
有问题的对齐从这里开始。当我选择波斯语或阿拉伯语时,我的应用程序经历了完全对称的变化,并且一些表情符号正确对齐,而另一些则显得扭曲。
我的代码:
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: ortaMavi,
leading: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: Icon(
Icons.arrow_back_ios,
size: 20,
color: Colors.white,
)),
title: Center(child: Text(titleHolder)),
actions: <Widget>[
Center(
child: Container(
margin: EdgeInsets.all(15),
child: Text(
flagHolder,
style: TextStyle(fontSize: 25),
)),
)
],
),
body: SafeArea(
child: ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 5),
itemCount: countries.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
EasyLocalizationProvider.of(context)
.data
.changeLocale(langs[index]);
setState(() {
titleHolder = countries[index];
flagHolder = flags[index];
selectedLangIndex = index;
});
},
child: Container(
decoration: BoxDecoration(
color:
selectedLangIndex != null && selectedLangIndex == index
? ortaMavi.withOpacity(0.2)
: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.lightBlueAccent.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 3,
offset: Offset(0, 3), // changes position of shadow
),
],
),
height: 50,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'${countries[index]}',
style: TextStyle(
fontSize: 20,
color: selectedLangIndex != null &&
selectedLangIndex == index
? Colors.white
: Colors.black),
),
Text(
flags[index],
style: TextStyle(fontSize: 25),
)
],
),
),
),
);
}),
),
);
}
解决方案
您可以将标志字符串放入 SizedBox
SizedBox(
width: 200.0,
height: 200.0,
child:Text(
flags[index],
),
)
推荐阅读
- spring-integration - 具有大负载大小的 http 出站网关是否有任何限制
- node.js - 如何构建多人游戏的后端
- grasshopper - 在哪里向蚱蜢定义添加表面以创建显示的结果?
- python - 不断收到 ModuleNotFoundError: No module named 'pynini' in Pycharm 和 Spyder
- java - 表中键数的准确范围
- javascript - js中的两个for循环。无法在嵌套的 for 循环上工作
- javascript - Angular 2:滚动动画
- guidewire - 如何在 Guidewire 中安装 DCEVM?
- r - 移动 geom_label 的框,使它们不重叠
- elasticsearch - 在 Elasticsearch 中更改设置的最佳解决方案