null_safety
张萌 4 years ago
parent da522a096b
commit 24590592a1

@ -28,6 +28,9 @@ class ASTag extends StatefulWidget {
/// ///
final double radius; final double radius;
///
final EdgeInsetsGeometry padding;
ASTag( ASTag(
{Key key, {Key key,
this.width, this.width,
@ -38,7 +41,8 @@ class ASTag extends StatefulWidget {
this.textStyle, this.textStyle,
this.outline = false, this.outline = false,
this.outlineColor, this.outlineColor,
this.radius}) this.radius,
this.padding})
: super(key: key); : super(key: key);
ASTag.yellowSolid(this.text, ASTag.yellowSolid(this.text,
@ -47,7 +51,8 @@ class ASTag extends StatefulWidget {
this.height, this.height,
this.textStyle, this.textStyle,
this.outlineColor, this.outlineColor,
this.radius}) this.radius,
this.padding})
: bgColor = Color(0xFFF69A2D), : bgColor = Color(0xFFF69A2D),
textColor = Color(0xFFFFFFFF), textColor = Color(0xFFFFFFFF),
outline = false, outline = false,
@ -60,6 +65,7 @@ class ASTag extends StatefulWidget {
this.height, this.height,
this.textStyle, this.textStyle,
this.radius, this.radius,
this.padding,
}) : bgColor = Color(0xFFFFFFFF), }) : bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFFE50112), textColor = Color(0xFFE50112),
outline = true, outline = true,
@ -67,7 +73,12 @@ class ASTag extends StatefulWidget {
super(key: key); super(key: key);
ASTag.yellowHollow(this.text, ASTag.yellowHollow(this.text,
{Key key, this.width, this.height, this.textStyle, this.radius}) {Key key,
this.width,
this.height,
this.textStyle,
this.radius,
this.padding})
: bgColor = Color(0xFFFFFFFF), : bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFFFFBD32), textColor = Color(0xFFFFBD32),
outline = true, outline = true,
@ -75,13 +86,18 @@ class ASTag extends StatefulWidget {
super(key: key); super(key: key);
ASTag.yellowHollowS(this.text, ASTag.yellowHollowS(this.text,
{Key key, this.width, this.height, this.textStyle, this.radius}) {Key key,
this.width,
this.height,
this.textStyle,
this.radius,
this.padding})
: bgColor = Color(0xFFFFFFFF), : bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFFF69A2D), textColor = Color(0xFFF69A2D),
outline = true, outline = true,
outlineColor = Color(0xFFF69A2D), outlineColor = Color(0xFFF69A2D),
super(key: key); super(key: key);
ASTag.transport(this.text, {Key key, this.textStyle}) ASTag.transport(this.text, {Key key, this.textStyle, this.padding})
: bgColor = Color(0xFFFFFFFF), : bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFF00B0FF), textColor = Color(0xFF00B0FF),
outline = true, outline = true,
@ -98,6 +114,7 @@ class _ASTagState extends State<ASTag> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: widget.padding ?? EdgeInsets.symmetric(horizontal: 6.w),
alignment: Alignment.center, alignment: Alignment.center,
width: widget.width, width: widget.width,
height: widget.height ?? 18.w, height: widget.height ?? 18.w,

Loading…
Cancel
Save