Declare a variable,
TextAlign _align;
Then use three buttons in a row,
Row(
children: <Widget>[
FlatButton(
onPressed: () {
setState(() {
_align = TextAlign.left;
});
},
child: Text('Align left'),
),
FlatButton(
onPressed: () {
setState(() {
_align = TextAlign.center;
});
},
child: Text('Align center'),
),
FlatButton(
onPressed: () {
setState(() {
_align = TextAlign.right;
});
},
child: Text('Align right'),
),
],
);
Then in your Text
widget,
Text('Align right', textAlign: _align)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…