指定笔划宽度时未连接阿拉伯文文本
Arabic text not connected when specifying stroke width
当我指定笔划宽度时,阿拉伯文文本未连接。这是我看到的:
圆圈内的连接不应存在,而是每个字符都应连接,就像草书一样。这是代码:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Text.rich(TextSpan(
text: 'كيف الحال',
style: TextStyle(
fontSize: 80,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2
..color = Colors.blue))));
}
}
如果我使用 PaintingStyle.fill
而不是上面的 PaintingStyle.stroke
,我没有发现任何问题,因为文本已填写。
我怎样才能摆脱这些联系?有没有办法合并路径?
如果您堆叠另一个只为文本着色的文本小部件,那么两个字母之间的连接将被隐藏:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Stack(
children: [
Text('كيف الحال',
style: TextStyle(
fontSize: 80,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2
..color = Colors.blue)),
Text('كيف الحال',
style: TextStyle(
fontSize: 80,
color: Colors.white,
))
],
));
}
}
你必须堆叠,因为 Flutter 只允许指定 color/foreground/background.
之一
如果颜色具有透明度,则显示连接。所以我的问题没有完全解决,但我不需要透明度。
当我指定笔划宽度时,阿拉伯文文本未连接。这是我看到的:
圆圈内的连接不应存在,而是每个字符都应连接,就像草书一样。这是代码:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Text.rich(TextSpan(
text: 'كيف الحال',
style: TextStyle(
fontSize: 80,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2
..color = Colors.blue))));
}
}
如果我使用 PaintingStyle.fill
而不是上面的 PaintingStyle.stroke
,我没有发现任何问题,因为文本已填写。
我怎样才能摆脱这些联系?有没有办法合并路径?
如果您堆叠另一个只为文本着色的文本小部件,那么两个字母之间的连接将被隐藏:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Stack(
children: [
Text('كيف الحال',
style: TextStyle(
fontSize: 80,
foreground: Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2
..color = Colors.blue)),
Text('كيف الحال',
style: TextStyle(
fontSize: 80,
color: Colors.white,
))
],
));
}
}
你必须堆叠,因为 Flutter 只允许指定 color/foreground/background.
之一如果颜色具有透明度,则显示连接。所以我的问题没有完全解决,但我不需要透明度。