import 'package:flutter/material.dart'; const _radius = Radius.circular(50.0); class SmallLabel extends StatelessWidget { Radius radius; String text; // 参数不能有下划线? 还不能有大驼峰.. 还得放在外面成 全局变量? SmallLabel(this.text, {this.radius = _radius}); @override Widget build(BuildContext context) { // TODO: implement build return Container( padding: EdgeInsets.only(left: 8.0, top: 2.0, right: 8.0, bottom: 2.0), margin: EdgeInsets.only(right: 8.0), decoration: new BoxDecoration( //背景 color: Colors.transparent, //设置四周圆角 角度 borderRadius: BorderRadius.all(radius), //设置四周边框 border: new Border.all(width: 1, color: Theme.of(context).accentColor), ), child: Text(text, style: TextStyle(color: Theme.of(context).accentColor)), ); } }