在Flutter中使用“文本”小部件时,问号出现在文本之前而不是文本之后

时间:2020-01-08 16:45:43

标签: flutter text widget

我是Flutter的新手。我想使用“文本”小部件在Flutter应用程序中显示一个简单的文本,令我惊讶的是,问号出现在问题之前而不是之后。是什么原因造成的?这是代码段:

  class _ScreenTwoState extends State<ScreenTwo> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
      title: Text("Screen Two"),
      centerTitle: true,
      backgroundColor: Colors.green,
    ),
   body: Container(
    child: ListView(
      children: <Widget>[
        ListTile(
          title: Text( _post != null ? "${_post.title}" : "Ooops.... error!!!",
              //this is where the issue is
              textAlign: TextAlign.center,
              textDirection: TextDirection.rtl,//
              style: TextStyle(
                  fontSize: 28.9,
                  color: Colors.black,
                  fontWeight: FontWeight.w400
                  //height: 50.0
                  ),
              ),
          ),


        ListTile(
            title: RaisedButton(
              child: Text("Send back to prev. screen"),
              color: Colors.green,
              highlightColor: Colors.redAccent,
              textColor: Colors.white,
              onPressed: (){
                Navigator.pop(context, {
                  'info': _backTextFieldController.text
                });
              },
            )
        ),
      ],
    )
  ),
);

} }

为了更加清楚,这就是我所期望的

 HOW TO FIND A BUS?

但这就是我所看到的

 ?HOW TO FIND A BUS

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我后来找到了解决方案,问题出在textDirection: TextDirection.rtl上。 由于我以 英语而非阿拉伯语 显示文本,因此该文本应为textDirection: TextDirection.ltr,