|
|
@@ -8,8 +8,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
-void mainGuide(GlobalKey topGuide, {VoidCallback? knowCallback}) {
|
|
|
- final topGuideOffset = getWidgetPosition(topGuide);
|
|
|
+void mainGuide(GlobalKey topGuide, GlobalKey aiGuide,
|
|
|
+ {VoidCallback? knowCallback}) {
|
|
|
+ final topWidgetInfo = getWidgetPosition(topGuide);
|
|
|
+ final aiWidgetInfo = getWidgetPosition(aiGuide);
|
|
|
+ double aiBottom =
|
|
|
+ Get.height - aiWidgetInfo.position.dy - aiWidgetInfo.size.height;
|
|
|
const tag = 'mainGuideDialog';
|
|
|
double padding = 7.5.w;
|
|
|
SmartDialog.show(
|
|
|
@@ -26,7 +30,7 @@ void mainGuide(GlobalKey topGuide, {VoidCallback? knowCallback}) {
|
|
|
Positioned(
|
|
|
left: 0,
|
|
|
right: 0,
|
|
|
- top: topGuideOffset.dy - padding,
|
|
|
+ top: topWidgetInfo.position.dy - padding,
|
|
|
child: Column(
|
|
|
children: [
|
|
|
Container(
|
|
|
@@ -67,80 +71,84 @@ void mainGuide(GlobalKey topGuide, {VoidCallback? knowCallback}) {
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- Positioned(
|
|
|
- left: 0,
|
|
|
- right: 0,
|
|
|
- bottom: 8.h,
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- SmartDialog.dismiss(tag: tag);
|
|
|
- knowCallback?.call();
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- border:
|
|
|
- Border.all(color: ColorName.white, width: 2.w),
|
|
|
- borderRadius: BorderRadius.circular(100.w),
|
|
|
- ),
|
|
|
- padding: EdgeInsets.symmetric(
|
|
|
- horizontal: 28.w, vertical: 11.w),
|
|
|
- child: Text(
|
|
|
- StringName.guideAiKnow.tr,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 15.sp, color: ColorName.white),
|
|
|
+ Builder(builder: (context) {
|
|
|
+ return Positioned(
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ bottom:
|
|
|
+ aiBottom - 7.h + MediaQuery.of(context).padding.bottom,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ SmartDialog.dismiss(tag: tag);
|
|
|
+ knowCallback?.call();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border:
|
|
|
+ Border.all(color: ColorName.white, width: 2.w),
|
|
|
+ borderRadius: BorderRadius.circular(100.w),
|
|
|
+ ),
|
|
|
+ padding: EdgeInsets.symmetric(
|
|
|
+ horizontal: 28.w, vertical: 11.w),
|
|
|
+ child: Text(
|
|
|
+ StringName.guideAiKnow.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 15.sp, color: ColorName.white),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- SizedBox(height: 32.h),
|
|
|
- Container(
|
|
|
- width: 274.w,
|
|
|
- decoration: BoxDecoration(
|
|
|
- image: DecorationImage(
|
|
|
- image: Assets.images.bgGuideMainAiPopup.provider(),
|
|
|
- fit: BoxFit.cover,
|
|
|
+ SizedBox(height: 32.h),
|
|
|
+ Container(
|
|
|
+ width: 274.w,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image:
|
|
|
+ Assets.images.bgGuideMainAiPopup.provider(),
|
|
|
+ fit: BoxFit.cover,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- child: AspectRatio(
|
|
|
- aspectRatio: 274 / 76,
|
|
|
- child: Align(
|
|
|
- alignment: const FractionalOffset(0.6016, 0.361),
|
|
|
- child: IntrinsicHeight(
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- StringName.guideAiSecretary.tr,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 16.sp,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- color: ColorName.white),
|
|
|
- ),
|
|
|
- Text(
|
|
|
- StringName.guideAiSecretaryDesc.tr,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.white90),
|
|
|
- )
|
|
|
- ],
|
|
|
+ child: AspectRatio(
|
|
|
+ aspectRatio: 274 / 76,
|
|
|
+ child: Align(
|
|
|
+ alignment: const FractionalOffset(0.6016, 0.361),
|
|
|
+ child: IntrinsicHeight(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ StringName.guideAiSecretary.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ color: ColorName.white),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ StringName.guideAiSecretaryDesc.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.white90),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- )),
|
|
|
- SizedBox(height: 12.h),
|
|
|
- Assets.images.iconGuideMainAi
|
|
|
- .image(width: 66.w, height: 66.w),
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
+ )),
|
|
|
+ SizedBox(height: 12.h),
|
|
|
+ Assets.images.iconGuideMainAi
|
|
|
+ .image(width: 66.w, height: 66.w),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ })
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-Offset getWidgetPosition(GlobalKey key) {
|
|
|
+WidgetInfo getWidgetPosition(GlobalKey key) {
|
|
|
final context = key.currentContext;
|
|
|
if (context == null) {
|
|
|
throw Exception('Context is null');
|
|
|
@@ -152,5 +160,18 @@ Offset getWidgetPosition(GlobalKey key) {
|
|
|
}
|
|
|
|
|
|
final offset = renderObject.localToGlobal(Offset.zero);
|
|
|
- return offset;
|
|
|
+ final size = renderObject.size;
|
|
|
+ return WidgetInfo(offset, size);
|
|
|
+}
|
|
|
+
|
|
|
+class WidgetInfo {
|
|
|
+ final Offset position;
|
|
|
+ final Size size;
|
|
|
+
|
|
|
+ WidgetInfo(this.position, this.size);
|
|
|
+
|
|
|
+ @override
|
|
|
+ String toString() {
|
|
|
+ return 'WidgetInfo{position: $position, size: $size}';
|
|
|
+ }
|
|
|
}
|