class _scanningState extends State<scanning> { bool pressed = true; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.blue, body: new Column( children: <Widget>[ new Text(strText, style: pressed ? TextStyle(color: Colors.black) : TextStyle(color:Colors.green), ), new RaisedButton( child: new Text( 'Change color'), onPressed: () { setState(() { pressed = !pressed; }); }, ) ], )); }也许您想更改兄弟文本。概念是相同的。快乐扑



