From 66e37b2c4e58f0cd1fa94c4758dafc31b4e9cf68 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 27 Nov 2020 14:57:48 +0800 Subject: [PATCH 1/6] =?UTF-8?q?tag=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tag/as_tag.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tag/as_tag.dart b/lib/tag/as_tag.dart index cfa4e85..5454690 100644 --- a/lib/tag/as_tag.dart +++ b/lib/tag/as_tag.dart @@ -99,7 +99,7 @@ class _ASTagState extends State { Widget build(BuildContext context) { return Container( alignment: Alignment.center, - width: widget.width ?? 36.w, + width: widget.width, height: widget.height ?? 18.w, decoration: BoxDecoration( color: widget.bgColor ?? Color(0xFFF69A2D), From 24590592a1607f678c64ae1e36796406fb9dff1d Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 27 Nov 2020 15:12:23 +0800 Subject: [PATCH 2/6] =?UTF-8?q?tag=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tag/as_tag.dart | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/tag/as_tag.dart b/lib/tag/as_tag.dart index 5454690..f284127 100644 --- a/lib/tag/as_tag.dart +++ b/lib/tag/as_tag.dart @@ -28,6 +28,9 @@ class ASTag extends StatefulWidget { ///圆角 final double radius; + + ///内边距 + final EdgeInsetsGeometry padding; ASTag( {Key key, this.width, @@ -38,7 +41,8 @@ class ASTag extends StatefulWidget { this.textStyle, this.outline = false, this.outlineColor, - this.radius}) + this.radius, + this.padding}) : super(key: key); ASTag.yellowSolid(this.text, @@ -47,7 +51,8 @@ class ASTag extends StatefulWidget { this.height, this.textStyle, this.outlineColor, - this.radius}) + this.radius, + this.padding}) : bgColor = Color(0xFFF69A2D), textColor = Color(0xFFFFFFFF), outline = false, @@ -60,6 +65,7 @@ class ASTag extends StatefulWidget { this.height, this.textStyle, this.radius, + this.padding, }) : bgColor = Color(0xFFFFFFFF), textColor = Color(0xFFE50112), outline = true, @@ -67,7 +73,12 @@ class ASTag extends StatefulWidget { super(key: key); 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), textColor = Color(0xFFFFBD32), outline = true, @@ -75,13 +86,18 @@ class ASTag extends StatefulWidget { super(key: key); 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), textColor = Color(0xFFF69A2D), outline = true, outlineColor = Color(0xFFF69A2D), super(key: key); - ASTag.transport(this.text, {Key key, this.textStyle}) + ASTag.transport(this.text, {Key key, this.textStyle, this.padding}) : bgColor = Color(0xFFFFFFFF), textColor = Color(0xFF00B0FF), outline = true, @@ -98,6 +114,7 @@ class _ASTagState extends State { @override Widget build(BuildContext context) { return Container( + padding: widget.padding ?? EdgeInsets.symmetric(horizontal: 6.w), alignment: Alignment.center, width: widget.width, height: widget.height ?? 18.w, From 095aa0cee771e5c2f62340300d688aacf9681a19 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 27 Nov 2020 16:06:41 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/data/color_object.dart | 4 ++++ lib/styles/as_colors.dart | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/example/lib/data/color_object.dart b/example/lib/data/color_object.dart index b997281..28cbddf 100644 --- a/example/lib/data/color_object.dart +++ b/example/lib/data/color_object.dart @@ -43,4 +43,8 @@ List colorObjects = [ name: '背景色', codeName: 'kBackgroundColor', ), + ColorObject( + color: Color(0xFFF69A2D), name: '暗主题色', codeName: 'kDarkPrimaryColor'), + ColorObject( + color: Color(0xFFFFB600), name: '亮主题色', codeName: 'kLightPrimaryColor'), ]; diff --git a/lib/styles/as_colors.dart b/lib/styles/as_colors.dart index da49014..2105afe 100644 --- a/lib/styles/as_colors.dart +++ b/lib/styles/as_colors.dart @@ -20,3 +20,10 @@ const Color kBackgroundColor = Color(0xFFF6F6F6); ///危险色 const Color kDangerColor = Color(0xFFE50112); + +///暗主题色 +const Color kDarkPrimaryColor = Color(0xFFF69A2D); + +///亮主题色 +const Color kLightPrimaryColor = Color(0xFFFFB600); + From 1b0b5e4bd76aefe99a12970a9fe2a1ea2514c0cc Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 27 Nov 2020 16:47:20 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E9=A2=9C=E8=89=B2=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/data/color_object.dart | 25 +++++++++++++++++++++++-- lib/buttons/as_bottom_button.dart | 7 ++++--- lib/buttons/as_button.dart | 20 ++++++++++---------- lib/buttons/as_gradientbutton.dart | 5 +++-- lib/buttons/as_longbutton.dart | 15 ++++++++------- lib/list_tile/as_list_tile.dart | 5 +++-- lib/styles/as_colors.dart | 8 ++++++++ lib/tag/as_tag.dart | 29 +++++++++++++++-------------- 8 files changed, 74 insertions(+), 40 deletions(-) diff --git a/example/lib/data/color_object.dart b/example/lib/data/color_object.dart index 28cbddf..5a82f42 100644 --- a/example/lib/data/color_object.dart +++ b/example/lib/data/color_object.dart @@ -18,6 +18,11 @@ List colorObjects = [ name: '主要暗色', codeName: 'kDarkColor', ), + ColorObject( + color: Color(0x73000000), + name: '次暗色', + codeName: 'kSubDarkColor', + ), ColorObject( color: kDarkColor, name: '文本默认颜色', @@ -28,6 +33,11 @@ List colorObjects = [ name: '次文本颜色', codeName: 'kTextSubColor', ), + ColorObject( + color: Color(0xD9FFFFFF), + name: '亮文本颜色', + codeName: 'kLightTextColor', + ), ColorObject( color: Color(0xFFF6B72D), name: '主题色', @@ -44,7 +54,18 @@ List colorObjects = [ codeName: 'kBackgroundColor', ), ColorObject( - color: Color(0xFFF69A2D), name: '暗主题色', codeName: 'kDarkPrimaryColor'), + color: Color(0xFFF69A2D), + name: '暗主题色', + codeName: 'kDarkPrimaryColor', + ), + ColorObject( + color: Color(0xFFFFB600), + name: '亮主题色', + codeName: 'kLightPrimaryColor', + ), ColorObject( - color: Color(0xFFFFB600), name: '亮主题色', codeName: 'kLightPrimaryColor'), + color: Color(0xFFE50112), + name: '次主题色', + codeName: 'kSecondaryColor', + ), ]; diff --git a/lib/buttons/as_bottom_button.dart b/lib/buttons/as_bottom_button.dart index d42984a..f86f2ed 100644 --- a/lib/buttons/as_bottom_button.dart +++ b/lib/buttons/as_bottom_button.dart @@ -1,3 +1,4 @@ +import 'package:ansu_ui/styles/as_colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -82,7 +83,7 @@ class ASBottomButton extends StatefulWidget { this.begin, this.end}) : colors = [Color(0xFFFFA700), Color(0xFFFFBD00)], - textColor = Color(0xFFFFFFFF), + textColor = kLightTextColor, width = double.infinity, super(key: key); ASBottomButton.shortWhite({ @@ -97,7 +98,7 @@ class ASBottomButton extends StatefulWidget { this.begin, this.end, }) : colors = [Color(0xFFFBFBFB), Color(0xFFFFFFFF)], - textColor = Color(0xFFFFB800), + textColor = kPrimaryColor, width = double.infinity, super(key: key); @@ -119,7 +120,7 @@ class _ASBottomButtonState extends State { ), child: MaterialButton( onPressed: widget.onPressed, - textColor: widget.textColor ?? Color(0xFFFFFFFF), + textColor: widget.textColor ?? kLightTextColor, disabledColor: widget.disableColor, disabledTextColor: widget.disableTextColor, padding: widget.padding ?? diff --git a/lib/buttons/as_button.dart b/lib/buttons/as_button.dart index 1aeba66..e894ceb 100644 --- a/lib/buttons/as_button.dart +++ b/lib/buttons/as_button.dart @@ -90,8 +90,8 @@ class ASButton extends StatefulWidget { this.disableTextColor, this.splashColor}) : outline = true, - outlineColor = Color(0x73000000), - textColor = Color(0xD9000000), + outlineColor = kDarkColor, + textColor = kTextColor, super(key: key); ASButton.warn( @@ -106,8 +106,8 @@ class ASButton extends StatefulWidget { this.disableColor, this.disableTextColor, this.splashColor}) - : bgcolor = Color(0xFFFFB600), - textColor = Color(0xD9FFFFFF), + : bgcolor = kLightPrimaryColor, + textColor = kLightTextColor, outline = false, super(key: key); ASButton.operation( @@ -122,8 +122,8 @@ class ASButton extends StatefulWidget { this.disableColor, this.disableTextColor, this.splashColor}) - : bgcolor = Color(0xFFF2F2F2), - textColor = Color(0xD9000000), + : bgcolor = kForegroundColor, + textColor =kTextColor, outline = false, super(key: key); ASButton.order({ @@ -133,13 +133,13 @@ class ASButton extends StatefulWidget { this.outlineColor, this.width, this.splashColor, - }) : bgcolor = Color(0xFFFFBD32), - textColor = Color(0xFF0000000), + }) : bgcolor = kLightPrimaryColor, + textColor = kTextColor, textStyle = TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold), radius = 5.w, outline = false, disableColor = Color(0xFFFFDF9B), - disableTextColor = Color(0x73000000), + disableTextColor = kTextSubColor, padding = EdgeInsets.symmetric(vertical: 8.w), super(key: key); @@ -153,7 +153,7 @@ class _ASButtonState extends State { return MaterialButton( disabledColor: widget.disableColor, disabledTextColor: widget.disableTextColor, - textColor: widget.textColor ?? Color(0xFFFFB600), + textColor: widget.textColor ?? kLightPrimaryColor, minWidth: widget.width ?? 75.w, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: widget.onPressed, diff --git a/lib/buttons/as_gradientbutton.dart b/lib/buttons/as_gradientbutton.dart index fc8656b..b318029 100644 --- a/lib/buttons/as_gradientbutton.dart +++ b/lib/buttons/as_gradientbutton.dart @@ -1,3 +1,4 @@ +import 'package:ansu_ui/styles/as_colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -61,7 +62,7 @@ class ASGradientButton extends StatefulWidget { this.onPressed, this.disableColor, this.disableTextColor, - }) : textColor = Color(0xD9FFFFFF), + }) : textColor = kLightTextColor, radius = 19.w, colors = [Color(0xFFF89B14), Color(0xFFF86B14)], width = 100.w, @@ -102,7 +103,7 @@ class _ASGradientButtonState extends State { gradient: LinearGradient( begin: widget.begin ?? Alignment.topCenter, end: widget.end ?? Alignment.bottomCenter, - colors: widget.colors ?? [Color(0xFFFFA700), Color(0xFFFFBD00)], + colors: widget.colors ?? [kDarkPrimaryColor, kLightPrimaryColor], ), borderRadius: BorderRadius.circular(widget.radius ?? 20.w), ), diff --git a/lib/buttons/as_longbutton.dart b/lib/buttons/as_longbutton.dart index 28ca19c..9917e74 100644 --- a/lib/buttons/as_longbutton.dart +++ b/lib/buttons/as_longbutton.dart @@ -1,3 +1,4 @@ +import 'package:ansu_ui/styles/as_colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -66,8 +67,8 @@ class ASLongButton extends StatefulWidget { this.onPressed, this.width, this.disableTextColor, - }) : bgColor = Color(0xFFF6B72D), - textColor = Color(0xFFFFFFFF), + }) : bgColor = kDarkPrimaryColor, + textColor = kTextColor, outline = false, disableColor = Color(0xFFC1BDB5), super(key: key); @@ -81,10 +82,10 @@ class ASLongButton extends StatefulWidget { this.width, this.disableColor, this.disableTextColor}) - : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFF6B72D), + : bgColor = kForegroundColor, + textColor = kDarkPrimaryColor, outline = true, - outlineColor = Color(0xFFF6B72D), + outlineColor = kDarkPrimaryColor, super(key: key); @override _ASLongButtonState createState() => _ASLongButtonState(); @@ -96,7 +97,7 @@ class _ASLongButtonState extends State { return MaterialButton( minWidth: widget.width ?? 280.w, disabledColor: widget.disableColor, - textColor: widget.textColor ?? Color(0xFFFFFFFF), + textColor: widget.textColor ?? kLightTextColor, disabledTextColor: widget.disableTextColor, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: widget.onPressed, @@ -110,7 +111,7 @@ class _ASLongButtonState extends State { ? BorderSide(color: widget.outlineColor, width: 1.w) : BorderSide.none, borderRadius: BorderRadius.circular(widget.radius ?? 22.5.w)), - color: widget.bgColor ?? Color(0xFFFFFFFF), + color: widget.bgColor ?? kForegroundColor, elevation: 0, // // focusElevation: 0, // // hoverElevation: 0, diff --git a/lib/list_tile/as_list_tile.dart b/lib/list_tile/as_list_tile.dart index 097de63..2a7eebb 100644 --- a/lib/list_tile/as_list_tile.dart +++ b/lib/list_tile/as_list_tile.dart @@ -1,3 +1,4 @@ +import 'package:ansu_ui/styles/as_colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -41,7 +42,7 @@ class _ASListTileState extends State { maxLines: 1, overflow: TextOverflow.visible, softWrap: false, - style: TextStyle(color: Color(0xD9000000), fontSize: 14.sp), + style: TextStyle(color: kTextColor, fontSize: 14.sp), ), ), Expanded( @@ -49,7 +50,7 @@ class _ASListTileState extends State { ? Text( widget.text, maxLines: 2, - style: TextStyle(color: Color(0xA6000000), fontSize: 14.sp), + style: TextStyle(color: kTextSubColor, fontSize: 14.sp), ) : widget.text, ), diff --git a/lib/styles/as_colors.dart b/lib/styles/as_colors.dart index 2105afe..0ecdf4a 100644 --- a/lib/styles/as_colors.dart +++ b/lib/styles/as_colors.dart @@ -3,6 +3,9 @@ import 'package:flutter/material.dart'; ///主要暗色 const Color kDarkColor = Color(0xFF333333); +///次暗色 +const Color kSubDarkColor = Color(0x73000000); + ///文本默认颜色 const Color kTextColor = kDarkColor; @@ -27,3 +30,8 @@ const Color kDarkPrimaryColor = Color(0xFFF69A2D); ///亮主题色 const Color kLightPrimaryColor = Color(0xFFFFB600); +///文本亮颜色 +const Color kLightTextColor = Color(0xD9FFFFFF); + +///次主题色 +const Color kSecondaryColor = Color(0xFFE50112); diff --git a/lib/tag/as_tag.dart b/lib/tag/as_tag.dart index f284127..cf8dab9 100644 --- a/lib/tag/as_tag.dart +++ b/lib/tag/as_tag.dart @@ -1,3 +1,4 @@ +import 'package:ansu_ui/styles/as_colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -53,8 +54,8 @@ class ASTag extends StatefulWidget { this.outlineColor, this.radius, this.padding}) - : bgColor = Color(0xFFF69A2D), - textColor = Color(0xFFFFFFFF), + : bgColor = kDarkPrimaryColor, + textColor = kLightTextColor, outline = false, super(key: key); @@ -66,10 +67,10 @@ class ASTag extends StatefulWidget { this.textStyle, this.radius, this.padding, - }) : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFE50112), + }) : bgColor = kForegroundColor, + textColor = kSecondaryColor, outline = true, - outlineColor = Color(0xFFE50112), + outlineColor = kSecondaryColor, super(key: key); ASTag.yellowHollow(this.text, @@ -79,10 +80,10 @@ class ASTag extends StatefulWidget { this.textStyle, this.radius, this.padding}) - : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFFFBD32), + : bgColor = kForegroundColor, + textColor = kPrimaryColor, outline = true, - outlineColor = Color(0xFFFFBD32), + outlineColor = kPrimaryColor, super(key: key); ASTag.yellowHollowS(this.text, @@ -92,13 +93,13 @@ class ASTag extends StatefulWidget { this.textStyle, this.radius, this.padding}) - : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFF69A2D), + : bgColor = kForegroundColor, + textColor = kDarkPrimaryColor, outline = true, - outlineColor = Color(0xFFF69A2D), + outlineColor = kDarkPrimaryColor, super(key: key); ASTag.transport(this.text, {Key key, this.textStyle, this.padding}) - : bgColor = Color(0xFFFFFFFF), + : bgColor = kForegroundColor, textColor = Color(0xFF00B0FF), outline = true, outlineColor = Color(0xFF00B0FF), @@ -119,11 +120,11 @@ class _ASTagState extends State { width: widget.width, height: widget.height ?? 18.w, decoration: BoxDecoration( - color: widget.bgColor ?? Color(0xFFF69A2D), + color: widget.bgColor ?? kDarkPrimaryColor, border: widget.outline ? Border.all( width: 1.w, - color: widget.outlineColor ?? Color(0xFFE50112), + color: widget.outlineColor ?? kSecondaryColor, ) : Border.fromBorderSide(BorderSide.none), borderRadius: BorderRadius.circular(widget.radius ?? 9.w)), From 6c8a2d15056e25469660ab93518a70f4e6327e9f Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 27 Nov 2020 16:57:22 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E9=A2=9C=E8=89=B2=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E5=8C=96=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/buttons/as_button.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/buttons/as_button.dart b/lib/buttons/as_button.dart index e894ceb..42ba6b6 100644 --- a/lib/buttons/as_button.dart +++ b/lib/buttons/as_button.dart @@ -122,7 +122,7 @@ class ASButton extends StatefulWidget { this.disableColor, this.disableTextColor, this.splashColor}) - : bgcolor = kForegroundColor, + : bgcolor = Color(0xFFF2F2F2), textColor =kTextColor, outline = false, super(key: key); From 44ebadd3195863c11f1a2cbf3cdbe35aa3694770 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 27 Nov 2020 17:44:45 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/example_tag.dart | 6 +++--- lib/tag/as_tag.dart | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/example/lib/example_tag.dart b/example/lib/example_tag.dart index 92d33af..007acca 100644 --- a/example/lib/example_tag.dart +++ b/example/lib/example_tag.dart @@ -19,15 +19,15 @@ class _ExampaleTagState extends State { children: [ ListTile( title: Text('yellowSolid'), - trailing: ASTag.yellowSolid('带电'), + trailing: ASTag.yellowSolid('带电',), ), ListTile( title: Text('redHollow'), - trailing: ASTag.redHollow('带磁'), + trailing: ASTag.redHollow('带磁',width: 36.w,), ), ListTile( title: Text('yellowHollow'), - trailing: ASTag.yellowHollow('选填'), + trailing: ASTag.yellowHollow('选填',width: 36.w,), ), ListTile( title: Text('redHollow'), diff --git a/lib/tag/as_tag.dart b/lib/tag/as_tag.dart index cf8dab9..30e85b3 100644 --- a/lib/tag/as_tag.dart +++ b/lib/tag/as_tag.dart @@ -115,10 +115,9 @@ class _ASTagState extends State { @override Widget build(BuildContext context) { return Container( - padding: widget.padding ?? EdgeInsets.symmetric(horizontal: 6.w), - alignment: Alignment.center, + padding: widget.padding ?? EdgeInsets.symmetric(horizontal: 6.w,vertical: 2.w), width: widget.width, - height: widget.height ?? 18.w, + height: widget.height, decoration: BoxDecoration( color: widget.bgColor ?? kDarkPrimaryColor, border: widget.outline