From 86d09eaac2b25dfb2ee51b5b8c290d331cbff94b Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 25 Nov 2020 09:49:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=B1=BB=EF=BC=8C=E6=95=B4=E7=90=86example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/example_bottom_button.dart | 10 ++-- example/lib/example_tag.dart | 64 ++++++++++++++++++++++---- lib/tag/as_tag.dart | 40 +++++++++++++++- 3 files changed, 98 insertions(+), 16 deletions(-) diff --git a/example/lib/example_bottom_button.dart b/example/lib/example_bottom_button.dart index 25566ac..8e697d8 100644 --- a/example/lib/example_bottom_button.dart +++ b/example/lib/example_bottom_button.dart @@ -13,17 +13,17 @@ class _ExampleBottomButtonState extends State { @override Widget build(BuildContext context) { return ASScaffold( - title: 'BottomButton', + title: 'ASBottomButton', body: Center(), bottomNavigationBar: Column( mainAxisSize: MainAxisSize.min, children: [ ASBottomButton.infinity( - title: 'null', + title: '无渐变infinity', onPressed: () {}, ), ASBottomButton.gradient( - title: '新增地址', + title: '有渐变gradient', onPressed: () {}, ), Row( @@ -31,13 +31,13 @@ class _ExampleBottomButtonState extends State { SizedBox( width: 112.w, child: ASBottomButton.shortWhite( - title: 'null', + title: 'shortwhite', onPressed: () {}, ), ), Expanded( child: ASBottomButton.gradient( - title: 'null', + title: '有渐变gradient', onPressed: () {}, )) ], diff --git a/example/lib/example_tag.dart b/example/lib/example_tag.dart index 37a3fda..757fc0c 100644 --- a/example/lib/example_tag.dart +++ b/example/lib/example_tag.dart @@ -1,6 +1,7 @@ import 'package:ansu_ui/scaffold/as_scaffold.dart'; import 'package:ansu_ui/tag/as_tag.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class ExampleTag extends StatefulWidget { ExampleTag({Key key}) : super(key: key); @@ -12,16 +13,59 @@ class ExampleTag extends StatefulWidget { class _ExampaleTagState extends State { @override Widget build(BuildContext context) { - return ASScaffold(title: 'Tag', - body: Column( - children: [ - Row( + return ASScaffold( + title: 'ASTag', + body: Column( 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('海运'), + ], + ), ], - ), - ], - ) - ); + )); } -} \ No newline at end of file +} diff --git a/lib/tag/as_tag.dart b/lib/tag/as_tag.dart index 7e00c05..cfa4e85 100644 --- a/lib/tag/as_tag.dart +++ b/lib/tag/as_tag.dart @@ -41,7 +41,7 @@ class ASTag extends StatefulWidget { this.radius}) : super(key: key); - ASTag.dangerousItem(this.text, + ASTag.yellowSolid(this.text, {Key key, this.width, this.height, @@ -53,6 +53,43 @@ class ASTag extends StatefulWidget { outline = false, 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 _ASTagState createState() => _ASTagState(); } @@ -68,6 +105,7 @@ class _ASTagState extends State { color: widget.bgColor ?? Color(0xFFF69A2D), border: widget.outline ? Border.all( + width: 1.w, color: widget.outlineColor ?? Color(0xFFE50112), ) : Border.fromBorderSide(BorderSide.none),