gpt4 book ai didi

dart - 以阿拉伯语格式显示数字 Dart

转载 作者:IT老高 更新时间:2023-10-28 12:47:05 26 4
gpt4 key购买 nike

如何在 Flutter 应用中以阿拉伯格式显示数字?

而不是将数字显示为 1,2,3 我需要将它们显示为 ١,٢,٣

我曾尝试使用 NumberFormat 类,但它不起作用。

flutter 医生:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v0.8.2, on Microsoft Windows [Version 10.0.17134.345], locale ar-SA)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2018.2)
[!] VS Code, 64-bit edition (version 1.27.2)
[√] Connected devices (2 available)

! Doctor found issues in 1 category.

例子:

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import 'package:intl/intl.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
locale: Locale("ar"),
home: new Scaffold(
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(NumberFormat().format(1)),
new Text(NumberFormat().format(2)),
new Text(NumberFormat().format(3)),
],
),
),
),
);
}
}

最佳答案

Adding一个 font支持阿拉伯数字的可以解决这个问题。

关于dart - 以阿拉伯语格式显示数字 Dart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52857534/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com