修改 as divider

master
张萌 3 years ago
parent 95ad140480
commit 4837412652

@ -23,8 +23,9 @@ class _ExampleDividerState extends State<ExampleDivider> {
color: Colors.red, color: Colors.red,
child: 'ASDivider'.text.make(), child: 'ASDivider'.text.make(),
), ),
ASDivider(color: Colors.black,), ASDivider(
color: Colors.black,
),
Row( Row(
children: [ children: [
Container( Container(
@ -45,12 +46,25 @@ class _ExampleDividerState extends State<ExampleDivider> {
color: Colors.red, color: Colors.red,
child: 'ASDottedDivider'.text.make(), child: 'ASDottedDivider'.text.make(),
), ),
ASDottedDivider.horizontal(color: Colors.black,), ASDottedDivider.horizontal(
color: Colors.black,
),
Container( Container(
width: double.infinity, height: 100.w,
height: 50.w, child: Row(
color: Colors.red, children: [
child: 'ASDottedDivider'.text.make(), Container(
color: Colors.red,
).expand(),
ASDottedDivider.vertical(
color: Colors.black,
),
Container(
color: Colors.red,
).expand(),
],
),
), ),
], ],
), ),

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASDottedDivider extends StatelessWidget { class ASDottedDivider extends StatelessWidget {
@ -37,7 +38,8 @@ class ASDottedDivider extends StatelessWidget {
: boxConstraints.constrainHeight(); : boxConstraints.constrainHeight();
final _dashWidth = dashWidth ?? 10.w; final _dashWidth = dashWidth ?? 10.w;
final _dashPattern = (1 + dash![1] / dash![0]); final _dashPattern = (1 + dash![1] / dash![0]);
final int count = (boxWidth / (_dashWidth * _dashPattern)).floor(); final int count =
(( boxWidth) / (_dashWidth * _dashPattern)).floor();
return Flex( return Flex(
direction: axis, direction: axis,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

Loading…
Cancel
Save