65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
/// Created by @Haoyi on 2020/12/29
|
|
///
|
|
///
|
|
|
|
part of 'tips.dart';
|
|
|
|
class TipsWidget extends StatelessWidget {
|
|
final double? width;
|
|
final double? height;
|
|
final double nipOffset;
|
|
final Radius? radius;
|
|
final double? spacing;
|
|
final TipsNip nip;
|
|
final double nipRadius;
|
|
final double nipWidth;
|
|
final double nipHeight;
|
|
final Gradient? gradient;
|
|
final Color? backgroundColor;
|
|
final Widget? child;
|
|
|
|
const TipsWidget(
|
|
{Key? key,
|
|
this.width,
|
|
this.height,
|
|
required this.nipOffset,
|
|
required this.nip,
|
|
this.radius,
|
|
this.gradient,
|
|
this.backgroundColor,
|
|
this.nipRadius = 4,
|
|
this.nipWidth = 16,
|
|
this.nipHeight = 16,
|
|
this.spacing = 16,
|
|
this.child})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
constraints: BoxConstraints(
|
|
minWidth: width ?? 0.0,
|
|
maxWidth: width ?? double.infinity,
|
|
minHeight: height ?? 0.0),
|
|
// width: width,
|
|
// height: height,
|
|
child: CustomPaint(
|
|
painter: TipsPainter(
|
|
backgroundColor: backgroundColor,
|
|
gradient: gradient,
|
|
clipper: TipsClipper(
|
|
nip: nip,
|
|
nipOffset: nipOffset,
|
|
nipRadius: nipRadius,
|
|
nipWidth: nipWidth,
|
|
radius: radius,
|
|
nipHeight: nipHeight),
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.only(top: nipHeight), // nip height
|
|
child: child,
|
|
)),
|
|
);
|
|
}
|
|
}
|