Opacity和Color
透明度和字体颜色
child: Text( 'Hello, How are you? I am fine. Thank you', style: TextStyle(color: Colors.red),//红色字体 ),
child: Text( 'Hello, How are you? I am fine. Thank you', style: TextStyle(color: Colors.red.withOpacity(0.5)),//透明度50%的红色字体 ),
import 'package:flutter/material.dart'; void main() { runApp( MaterialApp( title: 'Flutter Tutorial', home: Counter(), )); } class Counter extends StatefulWidget { @override _CounterState createState() => new _CounterState(); } class _CounterState extends State<Counter> { @override Widget build(BuildContext context) { return Center( child: CustomButton("Hello"), ); } } class CustomButton extends StatelessWidget { final String label; CustomButton(this.label); @override Widget build(BuildContext context) { return RaisedButton(onPressed: () {}, child: Text(label,style:TextStyle(color: Colors.red.withOpacity(0.5))),);//透明度50%的红色字体)); } }