2023-11-28 10:44:58 +08:00
|
|
|
import 'package:dreampad/app/shared/shared.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
2023-11-30 01:11:31 +08:00
|
|
|
class ExploreWidget extends StatefulWidget {
|
2023-11-28 10:44:58 +08:00
|
|
|
const ExploreWidget({
|
|
|
|
super.key,
|
|
|
|
required this.explored,
|
|
|
|
required this.exploreCount,
|
2023-11-30 01:11:31 +08:00
|
|
|
this.onPressed,
|
|
|
|
this.remainTime,
|
2023-11-28 10:44:58 +08:00
|
|
|
});
|
|
|
|
final bool explored;
|
|
|
|
final int exploreCount;
|
2023-11-30 01:11:31 +08:00
|
|
|
final String? remainTime;
|
|
|
|
final VoidCallback? onPressed;
|
|
|
|
@override
|
|
|
|
State<ExploreWidget> createState() => _ExploreWidgetState();
|
|
|
|
}
|
2023-11-28 10:44:58 +08:00
|
|
|
|
2023-11-30 01:11:31 +08:00
|
|
|
class _ExploreWidgetState extends State<ExploreWidget> {
|
|
|
|
late bool suspend = false;
|
2023-11-28 10:44:58 +08:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
height: 67.h,
|
|
|
|
width: 201.w,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
2023-11-30 01:11:31 +08:00
|
|
|
image: widget.explored
|
|
|
|
? Images.homeExplorePre
|
|
|
|
: Images.homeExploreDefault,
|
2023-11-28 10:44:58 +08:00
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
const RSizedBox(width: 10.0),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
2023-11-30 01:11:31 +08:00
|
|
|
if (widget.explored) {
|
|
|
|
setState(() {
|
|
|
|
suspend = !suspend;
|
|
|
|
});
|
|
|
|
widget.onPressed?.call();
|
|
|
|
}
|
2023-11-28 10:44:58 +08:00
|
|
|
},
|
2023-11-30 01:11:31 +08:00
|
|
|
child: widget.explored
|
|
|
|
? suspend
|
|
|
|
? Images.homeExploreCountdown
|
|
|
|
: Images.homeExploreBegin
|
|
|
|
: Images.homeBeginGray,
|
2023-11-28 10:44:58 +08:00
|
|
|
),
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'自由探索',
|
2023-11-30 01:11:31 +08:00
|
|
|
style: widget.explored
|
2023-11-28 10:44:58 +08:00
|
|
|
? TextStyles.boldWhiteShadow22_101
|
|
|
|
: TextStyles.boldWhiteShadow22_100,
|
|
|
|
),
|
|
|
|
const RSizedBox(height: 4.0),
|
2023-11-30 01:11:31 +08:00
|
|
|
widget.explored
|
2023-11-28 10:44:58 +08:00
|
|
|
? Text(
|
2023-11-30 01:11:31 +08:00
|
|
|
'剩余时间:${widget.remainTime}',
|
2023-11-28 10:44:58 +08:00
|
|
|
style: TextStyles.mediumWhiteShadow14_101,
|
|
|
|
)
|
|
|
|
: Row(
|
|
|
|
children: [
|
2023-11-30 01:11:31 +08:00
|
|
|
widget.exploreCount == 0
|
2023-11-28 10:44:58 +08:00
|
|
|
? Images.homeProgressBar
|
|
|
|
: Images.homeProgressBarIn,
|
|
|
|
const RSizedBox(width: 1.0),
|
2023-11-30 01:11:31 +08:00
|
|
|
widget.exploreCount >= 2
|
2023-11-28 10:44:58 +08:00
|
|
|
? Images.homeProgressBarIn
|
|
|
|
: Images.homeProgressBar,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|