ios_shortcut_guide_dialog.dart 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import 'package:electronic_assistant/resource/assets.gen.dart';
  2. import 'package:electronic_assistant/resource/colors.gen.dart';
  3. import 'package:electronic_assistant/utils/common_style.dart';
  4. import 'package:electronic_assistant/utils/expand.dart';
  5. import 'package:flutter/cupertino.dart';
  6. import 'package:flutter_screenutil/flutter_screenutil.dart';
  7. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  8. void showIosShortcutGuideDialog(
  9. {void Function()? onConfirm, void Function()? onCancel}) {
  10. const tag = 'showIosShortcutGuideDialog';
  11. SmartDialog.show(
  12. tag: tag,
  13. backType: SmartBackType.block,
  14. clickMaskDismiss: false,
  15. alignment: const Alignment(0.0, 0.9),
  16. builder: (_) {
  17. return Container(
  18. margin: EdgeInsets.symmetric(horizontal: 12.w),
  19. child: IntrinsicHeight(
  20. child: Container(
  21. decoration: BoxDecoration(
  22. color: ColorName.white,
  23. borderRadius: BorderRadius.circular(12.w)),
  24. child: Column(
  25. children: [
  26. Container(
  27. decoration: BoxDecoration(
  28. gradient: LinearGradient(
  29. begin: Alignment.topCenter,
  30. end: Alignment.bottomCenter,
  31. colors: ['#6177F2'.color, '#7EBAFF'.color],
  32. ),
  33. borderRadius: BorderRadius.only(
  34. topLeft: Radius.circular(12.w),
  35. topRight: Radius.circular(12.w))),
  36. child: Stack(
  37. children: [
  38. AspectRatio(
  39. aspectRatio: 336 / 201,
  40. child: Assets.images.dialogIosAddShortcutGuide
  41. .image(width: double.infinity)),
  42. Align(
  43. alignment: Alignment.topRight,
  44. child: Padding(
  45. padding: EdgeInsets.all(16.w),
  46. child: GestureDetector(
  47. onTap: () {
  48. SmartDialog.dismiss(tag: tag);
  49. onCancel?.call();
  50. },
  51. child: Assets.images.iconDesktopShortcutClose
  52. .image(width: 26.w, height: 26.w),
  53. ),
  54. ),
  55. )
  56. ],
  57. ),
  58. ),
  59. SizedBox(height: 20.w),
  60. Text('轻敲背面,快捷录音',
  61. style: TextStyle(
  62. color: ColorName.primaryTextColor, fontSize: 18.sp)),
  63. SizedBox(height: 6.w),
  64. Text(
  65. textAlign: TextAlign.center,
  66. '想更快打开录音吗?\n设置快捷方式,让小听更快听见~',
  67. style: TextStyle(
  68. fontSize: 14.sp, color: ColorName.secondaryTextColor),
  69. ),
  70. SizedBox(height: 24.w),
  71. GestureDetector(
  72. onTap: () {
  73. SmartDialog.dismiss(tag: tag);
  74. onConfirm?.call();
  75. },
  76. child: Container(
  77. decoration: getCommonDecoration(8.w),
  78. width: 304.w,
  79. height: 48.w,
  80. child: Center(
  81. child: Text('立即设置',
  82. style: TextStyle(
  83. fontSize: 16.sp,
  84. color: ColorName.white,
  85. fontWeight: FontWeight.bold)),
  86. ),
  87. ),
  88. ),
  89. SizedBox(height: 20.w),
  90. ],
  91. ),
  92. ),
  93. ),
  94. );
  95. });
  96. }