| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import 'package:electronic_assistant/resource/assets.gen.dart';
- import 'package:electronic_assistant/resource/colors.gen.dart';
- import 'package:electronic_assistant/resource/string.gen.dart';
- import 'package:electronic_assistant/utils/common_style.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:get/get.dart';
- void showAddDesktopShortcutDialog(
- {required void Function() onConfirm, required void Function() onCancel}) {
- SmartDialog.show(
- backType: SmartBackType.block,
- clickMaskDismiss: false,
- builder: (_) {
- return IntrinsicHeight(
- child: Column(
- children: [
- Stack(
- children: [
- Assets.images.bgDesktopShortcutHeader
- .image(width: 300.w, height: 142.w),
- Positioned(
- top: 14.w,
- right: 14.w,
- child: GestureDetector(
- onTap: () {
- onCancel.call();
- SmartDialog.dismiss();
- },
- child: Assets.images.iconDesktopShortcutClose
- .image(width: 28.w, height: 28.w),
- ),
- ),
- ],
- ),
- Container(
- decoration: BoxDecoration(
- color: ColorName.white,
- borderRadius: BorderRadius.only(
- bottomLeft: Radius.circular(12.w),
- bottomRight: Radius.circular(12.w))),
- width: 300.w,
- child: Column(
- children: [
- SizedBox(height: 24.h),
- Text(
- StringName.addDesktopShortcut.tr,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 18.sp,
- color: ColorName.primaryTextColor),
- ),
- SizedBox(height: 6.h),
- SizedBox(
- width: 238.w,
- child: Text(
- textAlign: TextAlign.center,
- StringName.addDesktopShortcutTips.tr,
- style: TextStyle(
- fontSize: 14.sp,
- color: ColorName.secondaryTextColor),
- )),
- SizedBox(height: 33.h),
- GestureDetector(
- onTap: () {
- SmartDialog.dismiss();
- onConfirm.call();
- },
- child: Container(
- width: 268.w,
- height: 48.w,
- decoration: getCommonDecoration(8.w),
- child: Center(
- child: Text(
- StringName.addDesktopShortcutBtnTxt.tr,
- style: TextStyle(
- fontSize: 16.sp, color: ColorName.white),
- ))),
- ),
- SizedBox(height: 16.h),
- ],
- ),
- )
- ],
- ),
- );
- });
- }
- void showAddDesktopShortcutTipsDialog(
- {required void Function() onConfirm, required void Function() onDismiss}) {
- SmartDialog.show(
- onDismiss: onDismiss,
- builder: (_) {
- return IntrinsicHeight(
- child: Container(
- width: 280.w,
- padding: EdgeInsets.only(
- left: 16.w, right: 16.w, top: 28.h, bottom: 24.h),
- decoration: BoxDecoration(
- color: ColorName.white,
- borderRadius: BorderRadius.circular(12.w)),
- child: Column(
- children: [
- Text(
- '“小听快听”已尝试添加到桌面',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 15.sp,
- color: ColorName.primaryTextColor),
- ),
- SizedBox(height: 12.h),
- Expanded(
- child: Text(
- textAlign: TextAlign.center,
- '若添加失败,请前往系统设置,为小听打开“创建桌面快捷方式”的权限。',
- style: TextStyle(
- fontSize: 14.sp, color: ColorName.secondaryTextColor),
- ),
- ),
- SizedBox(height: 32.h),
- GestureDetector(
- onTap: () {
- SmartDialog.dismiss();
- onConfirm.call();
- },
- child: Container(
- decoration: BoxDecoration(
- color: ColorName.colorPrimary,
- borderRadius: BorderRadius.circular(8.w)),
- height: 38.w,
- child: Center(
- child: Text(
- StringName.sure.tr,
- style: TextStyle(
- fontSize: 14.sp, color: ColorName.white),
- ))))
- ],
- ),
- ),
- );
- });
- }
|