增加新标签类,整理example

null_safety
张萌 4 years ago
parent c9edb30402
commit 86d09eaac2

@ -13,17 +13,17 @@ class _ExampleBottomButtonState extends State<ExampleBottomButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold( return ASScaffold(
title: 'BottomButton', title: 'ASBottomButton',
body: Center(), body: Center(),
bottomNavigationBar: Column( bottomNavigationBar: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ASBottomButton.infinity( ASBottomButton.infinity(
title: 'null', title: '无渐变infinity',
onPressed: () {}, onPressed: () {},
), ),
ASBottomButton.gradient( ASBottomButton.gradient(
title: '新增地址', title: '有渐变gradient',
onPressed: () {}, onPressed: () {},
), ),
Row( Row(
@ -31,13 +31,13 @@ class _ExampleBottomButtonState extends State<ExampleBottomButton> {
SizedBox( SizedBox(
width: 112.w, width: 112.w,
child: ASBottomButton.shortWhite( child: ASBottomButton.shortWhite(
title: 'null', title: 'shortwhite',
onPressed: () {}, onPressed: () {},
), ),
), ),
Expanded( Expanded(
child: ASBottomButton.gradient( child: ASBottomButton.gradient(
title: 'null', title: '有渐变gradient',
onPressed: () {}, onPressed: () {},
)) ))
], ],

@ -1,6 +1,7 @@
import 'package:ansu_ui/scaffold/as_scaffold.dart'; import 'package:ansu_ui/scaffold/as_scaffold.dart';
import 'package:ansu_ui/tag/as_tag.dart'; import 'package:ansu_ui/tag/as_tag.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExampleTag extends StatefulWidget { class ExampleTag extends StatefulWidget {
ExampleTag({Key key}) : super(key: key); ExampleTag({Key key}) : super(key: key);
@ -12,16 +13,59 @@ class ExampleTag extends StatefulWidget {
class _ExampaleTagState extends State<ExampleTag> { class _ExampaleTagState extends State<ExampleTag> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold(title: 'Tag', return ASScaffold(
body: Column( title: 'ASTag',
children: [ body: Column(
Row(
children: [ children: [
ASTag.dangerousItem('带电'), Row(
children: [
Text('yellowSolid'),
Spacer(),
ASTag.yellowSolid('带电'),
],
),
Row(
children: [
Text('redHollow'),
Spacer(),
ASTag.redHollow('带磁'),
],
),
Row(
children: [
Text('yellowHollow'),
Spacer(),
ASTag.yellowHollow('选填'),
],
),
Row(
children: [
Text('redHollow width:45.w'),
Spacer(),
ASTag.redHollow(
'未付款',
width: 45.w,
),
],
),
Row(
children: [
Text('yellowHollowS width:45.w'),
Spacer(),
ASTag.yellowHollowS(
'已付款',
width: 45.w,
),
],
),
Row(
children: [
Text('transport'),
Spacer(),
ASTag.transport('海运'),
],
),
], ],
), ));
],
)
);
} }
} }

@ -41,7 +41,7 @@ class ASTag extends StatefulWidget {
this.radius}) this.radius})
: super(key: key); : super(key: key);
ASTag.dangerousItem(this.text, ASTag.yellowSolid(this.text,
{Key key, {Key key,
this.width, this.width,
this.height, this.height,
@ -53,6 +53,43 @@ class ASTag extends StatefulWidget {
outline = false, outline = false,
super(key: key); super(key: key);
ASTag.redHollow(
this.text, {
Key key,
this.width,
this.height,
this.textStyle,
this.radius,
}) : bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFFE50112),
outline = true,
outlineColor = Color(0xFFE50112),
super(key: key);
ASTag.yellowHollow(this.text,
{Key key, this.width, this.height, this.textStyle, this.radius})
: bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFFFFBD32),
outline = true,
outlineColor = Color(0xFFFFBD32),
super(key: key);
ASTag.yellowHollowS(this.text,
{Key key, this.width, this.height, this.textStyle, this.radius})
: bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFFF69A2D),
outline = true,
outlineColor = Color(0xFFF69A2D),
super(key: key);
ASTag.transport(this.text, {Key key, this.textStyle})
: bgColor = Color(0xFFFFFFFF),
textColor = Color(0xFF00B0FF),
outline = true,
outlineColor = Color(0xFF00B0FF),
radius = 3.w,
width = 38.w,
height = 19.w,
super(key: key);
@override @override
_ASTagState createState() => _ASTagState(); _ASTagState createState() => _ASTagState();
} }
@ -68,6 +105,7 @@ class _ASTagState extends State<ASTag> {
color: widget.bgColor ?? Color(0xFFF69A2D), color: widget.bgColor ?? Color(0xFFF69A2D),
border: widget.outline border: widget.outline
? Border.all( ? Border.all(
width: 1.w,
color: widget.outlineColor ?? Color(0xFFE50112), color: widget.outlineColor ?? Color(0xFFE50112),
) )
: Border.fromBorderSide(BorderSide.none), : Border.fromBorderSide(BorderSide.none),

Loading…
Cancel
Save