small_label.dart 907 B

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