model_explain_dialog.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import 'package:electronic_assistant/resource/assets.gen.dart';
  2. import 'package:electronic_assistant/resource/colors.gen.dart';
  3. import 'package:electronic_assistant/utils/mmkv_util.dart';
  4. import 'package:flutter/cupertino.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  7. import 'package:get/get.dart';
  8. void showModelExplainTipsDialog() {
  9. const key = 'isShowModelExplainTipsDialog';
  10. if (KVUtil.getBool(key, true)) {
  11. final isCheck = false.obs;
  12. const tag = 'showModelExplainTipsDialog';
  13. SmartDialog.show(
  14. tag: tag,
  15. builder: (_) {
  16. return Container(
  17. padding: EdgeInsets.only(
  18. left: 16.w, right: 16.w, top: 37.h, bottom: 20.h),
  19. width: 280.w,
  20. decoration: BoxDecoration(
  21. borderRadius: BorderRadius.circular(12.w),
  22. color: ColorName.white),
  23. child: IntrinsicHeight(
  24. child: Column(
  25. children: [
  26. Text(
  27. textAlign: TextAlign.center,
  28. '本应用提供人工智能服务,禁止利用人工智能从事违法犯罪相关活动',
  29. style: TextStyle(
  30. fontWeight: FontWeight.bold,
  31. fontSize: 15.sp,
  32. color: ColorName.primaryTextColor),
  33. ),
  34. SizedBox(height: 8.h),
  35. GestureDetector(
  36. onTap: () {
  37. isCheck.value = !isCheck.value;
  38. },
  39. child: Row(
  40. mainAxisAlignment: MainAxisAlignment.center,
  41. children: [
  42. Obx(() {
  43. return isCheck.value
  44. ? Assets.images.iconSelectTrue
  45. .image(width: 20.w, height: 20.w)
  46. : Assets.images.iconSelectFalse
  47. .image(width: 20.w, height: 20.w);
  48. }),
  49. SizedBox(width: 5.w),
  50. Text('以后不再提示',
  51. style: TextStyle(
  52. fontSize: 15.sp,
  53. color: ColorName.tertiaryTextColor))
  54. ],
  55. ),
  56. ),
  57. SizedBox(height: 24.5.h),
  58. GestureDetector(
  59. onTap: () {
  60. if (isCheck.value) {
  61. KVUtil.putBool(key, false);
  62. }
  63. SmartDialog.dismiss(tag: tag);
  64. },
  65. child: Container(
  66. height: 36.h,
  67. decoration: BoxDecoration(
  68. color: ColorName.colorPrimary,
  69. borderRadius: BorderRadius.circular(8.w)),
  70. child: Center(
  71. child: Text(
  72. '知道了',
  73. style: TextStyle(
  74. fontSize: 14.sp,
  75. fontWeight: FontWeight.bold,
  76. color: ColorName.white),
  77. ),
  78. ),
  79. ),
  80. )
  81. ],
  82. ),
  83. ),
  84. );
  85. });
  86. }
  87. }