update as divider

null_safety
小赖 4 years ago
parent fa574ae3dc
commit efcc7d6ce2

@ -5,19 +5,26 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASDivider extends StatelessWidget { class ASDivider extends StatelessWidget {
final Color color; final Color color;
final double height; final double height;
final double thickness;
final double indent; final double indent;
final double endIndent; final double endIndent;
ASDivider({Key key, this.indent, this.endIndent}) ASDivider({
: color = const Color(0xFFE9E9E9), Key key,
height = 1.w, this.indent,
super(key: key); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Divider( return Divider(
color: color, color: color,
height: height, height: _innerHeight,
thickness: height, thickness: _innerThickness,
indent: indent, indent: indent,
endIndent: endIndent, endIndent: endIndent,
); );
@ -27,20 +34,28 @@ class ASDivider extends StatelessWidget {
/// 线 /// 线
class ASVDivider extends StatelessWidget { class ASVDivider extends StatelessWidget {
final Color color; final Color color;
final double height; final double width;
final double thickness;
final double indent; final double indent;
final double endIndent; final double endIndent;
ASVDivider({Key key, this.indent, this.endIndent}) ASVDivider({
: color = const Color(0xFFE9E9E9), Key key,
height = 1.w, this.indent,
super(key: key); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return VerticalDivider( return VerticalDivider(
color: color, color: color,
width: height, width: _innerWidth,
thickness: height, thickness: _innerThickness,
indent: indent, indent: indent,
endIndent: endIndent, endIndent: endIndent,
); );

Loading…
Cancel
Save