[英]Flutter text widget breaks up words in the middle to the next line how to stop
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
body: Center(
child: Container(
padding:EdgeInsets.only(left: 30, right:30),
child:RichText(
text: TextSpan(children: [
TextSpan(
text: "這是一趟十分令人",
style: TextStyle(color: Colors.green, fontSize: 30.0)),
TextSpan(
text: "愉\u200d悅",
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
fontSize: 30.0),
),
TextSpan(
text: "的旅程",
style: TextStyle(color: Colors.green, fontSize: 30.0)),
])),
)
),
),
);
}
}
用這個:<\/p>
Text(text.replaceAll("\u200b", "")),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.