From efcc7d6ce26caf8f341d927c0f693a568e74d848 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 30 Nov 2020 16:14:18 +0800 Subject: [PATCH] update as divider --- lib/divider/as_divider.dart | 41 +++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/lib/divider/as_divider.dart b/lib/divider/as_divider.dart index a612b4d..c906d21 100644 --- a/lib/divider/as_divider.dart +++ b/lib/divider/as_divider.dart @@ -5,19 +5,26 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class ASDivider extends StatelessWidget { final Color color; final double height; + final double thickness; final double indent; final double endIndent; - ASDivider({Key key, this.indent, this.endIndent}) - : color = const Color(0xFFE9E9E9), - height = 1.w, - super(key: key); + ASDivider({ + Key key, + this.indent, + this.endIndent, + this.color = const Color(0xFFE9E9E9), + this.height, + this.thickness, + }) : super(key: key); + double get _innerHeight => height ?? 1.w; + double get _innerThickness => thickness ?? 1.w; @override Widget build(BuildContext context) { return Divider( color: color, - height: height, - thickness: height, + height: _innerHeight, + thickness: _innerThickness, indent: indent, endIndent: endIndent, ); @@ -27,20 +34,28 @@ class ASDivider extends StatelessWidget { ///安速 垂直分割线 class ASVDivider extends StatelessWidget { final Color color; - final double height; + final double width; + final double thickness; final double indent; final double endIndent; - ASVDivider({Key key, this.indent, this.endIndent}) - : color = const Color(0xFFE9E9E9), - height = 1.w, - super(key: key); + ASVDivider({ + Key key, + this.indent, + this.endIndent, + this.color = const Color(0xFFE9E9E9), + this.width, + this.thickness, + }) : super(key: key); + + double get _innerWidth => width ?? 1.w; + double get _innerThickness => thickness ?? 1.w; @override Widget build(BuildContext context) { return VerticalDivider( color: color, - width: height, - thickness: height, + width: _innerWidth, + thickness: _innerThickness, indent: indent, endIndent: endIndent, );