Flutter 文本样式继承

使用inherit来设置是否继承样式

      DefaultTextStyle(
        style: TextStyle(color: Colors.red, fontSize: 22),
        child: Column(
          children: <Widget>[
            Text('1'),
            Text('2'),
            Text(
              '3',
              style: TextStyle(
                inherit: false,
                fontSize: 22,
                color: Colors.black26,
              ),
            ),
          ],
        ),
      ),

猜你喜欢

转载自www.cnblogs.com/ajanuw/p/10556616.html
今日推荐