dreampad/lib/app/modules/home/widgets/first_time_dialog.dart
2023-11-30 16:36:14 +08:00

58 lines
1.8 KiB
Dart

import 'package:dreampad/app/shared/shared.dart';
import 'package:dreampad/app/shared/widgets/touch_hint_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
/// 首次dialog的模板
class FirstTimeDialog extends StatelessWidget {
const FirstTimeDialog({
super.key,
});
@override
Widget build(BuildContext context) {
return HookBuilder(
builder: (context) {
final isTextShown = useState(false);
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: isTextShown.value ? () {
SmartDialog.dismiss(result: true);
}: null,
child: Stack(
children: [
Center(
child: AnimatedColumnWidget(
mainAxisSize: MainAxisSize.min,
onDone: () {
isTextShown.value = true;
},
children: [
Images.homeTextDreamTreePageFirstLine,
Images.homeTextDreamTreePageSecondLine,
Images.homeTextDreamTreePageThirdLine,
Images.homeTextDreamTreePageFourthLine,
],
),
),
Positioned(
bottom: 32,
left: 0,
right: 0,
child: AnimatedVisibilityWidget(
animationWidgetBuilder: AnimatedVisibilityWidget.fadeAnimationWidgetBuilder,
isVisible: isTextShown.value,
child: const Center(
child: TouchHintWidget(),
),
),
),
],
),
);
}
);
}
}