|
|
@ -73,13 +73,16 @@ class IntroOverlayBuilder { |
|
|
bool alignment = true, |
|
|
bool alignment = true, |
|
|
Function? onNext, |
|
|
Function? onNext, |
|
|
Function? onFinish, |
|
|
Function? onFinish, |
|
|
|
|
|
Function? onTap, |
|
|
}) { |
|
|
}) { |
|
|
double height = |
|
|
double dy = params.offset?.dy ?? 0; |
|
|
(params.offset?.dy ?? 0) - ScreenUtil().statusBarHeight - 20.w; |
|
|
double width = params.size.width; |
|
|
|
|
|
double height = params.size.height; |
|
|
|
|
|
double totalHeight = dy + height + 3 - ScreenUtil().statusBarHeight; |
|
|
double left = params.offset?.dx ?? 0; |
|
|
double left = params.offset?.dx ?? 0; |
|
|
double right = 1.sw - left - params.size.width; |
|
|
double right = 1.sw - left - width; |
|
|
return SizedBox( |
|
|
return SizedBox( |
|
|
height: height, |
|
|
height: totalHeight, |
|
|
child: Column( |
|
|
child: Column( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
children: [ |
|
|
children: [ |
|
|
@ -96,15 +99,15 @@ class IntroOverlayBuilder { |
|
|
), |
|
|
), |
|
|
Padding( |
|
|
Padding( |
|
|
padding: EdgeInsets.only( |
|
|
padding: EdgeInsets.only( |
|
|
left: alignment ? left : 12.w, |
|
|
left: alignment ? left - 3 : 12.w - 3, |
|
|
right: alignment ? 12.w : right, |
|
|
right: alignment ? 12.w - 3 : right - 3, |
|
|
), |
|
|
), |
|
|
child: Column( |
|
|
child: Column( |
|
|
crossAxisAlignment: |
|
|
crossAxisAlignment: |
|
|
alignment ? CrossAxisAlignment.start : CrossAxisAlignment.end, |
|
|
alignment ? CrossAxisAlignment.start : CrossAxisAlignment.end, |
|
|
children: [ |
|
|
children: [ |
|
|
Padding( |
|
|
Padding( |
|
|
padding: EdgeInsets.only(bottom: 10.w), |
|
|
padding: const EdgeInsets.symmetric(horizontal: 3), |
|
|
child: Text( |
|
|
child: Text( |
|
|
text, |
|
|
text, |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
@ -117,23 +120,51 @@ class IntroOverlayBuilder { |
|
|
Row( |
|
|
Row( |
|
|
children: [ |
|
|
children: [ |
|
|
if (onNext != null) |
|
|
if (onNext != null) |
|
|
_button( |
|
|
Padding( |
|
|
|
|
|
padding: EdgeInsets.only(top: 10.w, left: 3, right: 3), |
|
|
|
|
|
child: _button( |
|
|
buttonText, |
|
|
buttonText, |
|
|
() { |
|
|
() { |
|
|
params.onNext!(); |
|
|
params.onNext!(); |
|
|
onNext(); |
|
|
onNext(); |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
|
|
|
), |
|
|
if (onFinish != null) |
|
|
if (onFinish != null) |
|
|
_button( |
|
|
Padding( |
|
|
|
|
|
padding: EdgeInsets.only(top: 10.w, left: 3, right: 3), |
|
|
|
|
|
child: _button( |
|
|
buttonText, |
|
|
buttonText, |
|
|
() { |
|
|
() { |
|
|
params.onFinish(); |
|
|
params.onFinish(); |
|
|
onFinish(); |
|
|
onFinish(); |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
|
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
|
|
|
SizedBox(height: 20.w), |
|
|
|
|
|
onTap != null |
|
|
|
|
|
? _AnimatedBorderButton( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
onTap(); |
|
|
|
|
|
}, |
|
|
|
|
|
isButton: false, |
|
|
|
|
|
child: Padding( |
|
|
|
|
|
padding: const EdgeInsetsGeometry.all(3), |
|
|
|
|
|
child: SizedBox( |
|
|
|
|
|
width: width, |
|
|
|
|
|
height: height, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
) |
|
|
|
|
|
: Padding( |
|
|
|
|
|
padding: const EdgeInsetsGeometry.all(3), |
|
|
|
|
|
child: SizedBox( |
|
|
|
|
|
width: width, |
|
|
|
|
|
height: height, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -162,8 +193,21 @@ class IntroOverlayBuilder { |
|
|
), |
|
|
), |
|
|
) |
|
|
) |
|
|
: _AnimatedBorderButton( |
|
|
: _AnimatedBorderButton( |
|
|
text: text, |
|
|
|
|
|
onTap: onTap, |
|
|
onTap: onTap, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 5.w), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
borderRadius: BorderRadius.circular(20.r), |
|
|
|
|
|
border: Border.all(color: Colors.transparent), |
|
|
|
|
|
), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
text, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -228,12 +272,14 @@ class _AnimatedLottieWidgetState extends State<_AnimatedLottieWidget> |
|
|
|
|
|
|
|
|
// 新增的带边框流动动画的按钮组件 |
|
|
// 新增的带边框流动动画的按钮组件 |
|
|
class _AnimatedBorderButton extends StatefulWidget { |
|
|
class _AnimatedBorderButton extends StatefulWidget { |
|
|
final String text; |
|
|
final Widget child; |
|
|
|
|
|
final bool isButton; |
|
|
final Function() onTap; |
|
|
final Function() onTap; |
|
|
|
|
|
|
|
|
const _AnimatedBorderButton({ |
|
|
const _AnimatedBorderButton({ |
|
|
required this.text, |
|
|
required this.child, |
|
|
required this.onTap, |
|
|
required this.onTap, |
|
|
|
|
|
this.isButton = true, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
@ -276,22 +322,9 @@ class _AnimatedBorderButtonState extends State<_AnimatedBorderButton> |
|
|
return CustomPaint( |
|
|
return CustomPaint( |
|
|
painter: _FlowingBorderPainter( |
|
|
painter: _FlowingBorderPainter( |
|
|
progress: _animation.value, |
|
|
progress: _animation.value, |
|
|
borderRadius: 20.r, |
|
|
borderRadius: widget.isButton ? 20.r : 0.r, |
|
|
), |
|
|
|
|
|
child: Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 5.w), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
borderRadius: BorderRadius.circular(20.r), |
|
|
|
|
|
border: Border.all(color: Colors.transparent), |
|
|
|
|
|
), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
widget.text, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
), |
|
|
|
|
|
child: widget.child, |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
|