diff --git a/example/lib/data/color_object.dart b/example/lib/data/color_object.dart index b997281..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: '主题色', @@ -43,4 +53,19 @@ List colorObjects = [ name: '背景色', codeName: 'kBackgroundColor', ), + ColorObject( + color: Color(0xFFF69A2D), + name: '暗主题色', + codeName: 'kDarkPrimaryColor', + ), + ColorObject( + color: Color(0xFFFFB600), + name: '亮主题色', + codeName: 'kLightPrimaryColor', + ), + ColorObject( + color: Color(0xFFE50112), + name: '次主题色', + codeName: 'kSecondaryColor', + ), ]; 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/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..42ba6b6 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( @@ -123,7 +123,7 @@ class ASButton extends StatefulWidget { this.disableTextColor, this.splashColor}) : bgcolor = Color(0xFFF2F2F2), - textColor = Color(0xD9000000), + 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 da49014..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; @@ -20,3 +23,15 @@ const Color kBackgroundColor = Color(0xFFF6F6F6); ///危险色 const Color kDangerColor = Color(0xFFE50112); + +///暗主题色 +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 cfa4e85..30e85b3 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'; @@ -28,6 +29,9 @@ class ASTag extends StatefulWidget { ///圆角 final double radius; + + ///内边距 + final EdgeInsetsGeometry padding; ASTag( {Key key, this.width, @@ -38,7 +42,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,9 +52,10 @@ class ASTag extends StatefulWidget { this.height, this.textStyle, this.outlineColor, - this.radius}) - : bgColor = Color(0xFFF69A2D), - textColor = Color(0xFFFFFFFF), + this.radius, + this.padding}) + : bgColor = kDarkPrimaryColor, + textColor = kLightTextColor, outline = false, super(key: key); @@ -60,29 +66,40 @@ class ASTag extends StatefulWidget { this.height, this.textStyle, this.radius, - }) : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFE50112), + this.padding, + }) : bgColor = kForegroundColor, + textColor = kSecondaryColor, outline = true, - outlineColor = Color(0xFFE50112), + outlineColor = kSecondaryColor, super(key: key); ASTag.yellowHollow(this.text, - {Key key, this.width, this.height, this.textStyle, this.radius}) - : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFFFBD32), + {Key key, + this.width, + this.height, + this.textStyle, + this.radius, + this.padding}) + : bgColor = kForegroundColor, + textColor = kPrimaryColor, outline = true, - outlineColor = Color(0xFFFFBD32), + outlineColor = kPrimaryColor, super(key: key); ASTag.yellowHollowS(this.text, - {Key key, this.width, this.height, this.textStyle, this.radius}) - : bgColor = Color(0xFFFFFFFF), - textColor = Color(0xFFF69A2D), + {Key key, + this.width, + this.height, + this.textStyle, + this.radius, + this.padding}) + : bgColor = kForegroundColor, + textColor = kDarkPrimaryColor, outline = true, - outlineColor = Color(0xFFF69A2D), + outlineColor = kDarkPrimaryColor, super(key: key); - ASTag.transport(this.text, {Key key, this.textStyle}) - : bgColor = Color(0xFFFFFFFF), + ASTag.transport(this.text, {Key key, this.textStyle, this.padding}) + : bgColor = kForegroundColor, textColor = Color(0xFF00B0FF), outline = true, outlineColor = Color(0xFF00B0FF), @@ -98,15 +115,15 @@ class _ASTagState extends State { @override Widget build(BuildContext context) { return Container( - alignment: Alignment.center, - width: widget.width ?? 36.w, - height: widget.height ?? 18.w, + padding: widget.padding ?? EdgeInsets.symmetric(horizontal: 6.w,vertical: 2.w), + width: widget.width, + height: widget.height, 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)),