| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:keyboard/resource/assets.gen.dart';
- import '../../../resource/colors.gen.dart';
- import '../../../utils/widget_location_util.dart';
- /// 键盘引导-引导覆盖弹窗
- class KeyboardGuideOverlayDialog {
- static final tag = "KeyboardGuideOverlayDialog";
- /// 显示
- /// [targetWidgetKey] 目标组件的key
- /// [onFinishCallback] 结束引导时回调
- static void show(
- GlobalKey targetWidgetKey, {
- required VoidCallback onFinishCallback,
- }) {
- // 获取组件的位置信息
- var targetWidgetInfo = WidgetLocationUtil.getWidgetLocation(
- targetWidgetKey,
- );
- SmartDialog.show(
- tag: tag,
- backType: SmartBackType.normal,
- clickMaskDismiss: true,
- maskColor: ColorName.black70,
- onDismiss: () {
- onFinishCallback();
- },
- builder: (_) {
- return SizedBox(
- width: double.infinity,
- height: double.infinity,
- child: Stack(
- children: [
- Positioned(
- left: targetWidgetInfo.position.dx,
- top: targetWidgetInfo.position.dy,
- child: Assets.images.iconKeyboardGuideOverlay1.image(
- width: 320.w,
- ),
- ),
- ],
- ),
- );
- },
- );
- }
- }
|