talk_delete_dialog.dart 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import 'package:electronic_assistant/utils/expand.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  6. import 'package:get/get.dart';
  7. import '../resource/colors.gen.dart';
  8. import '../resource/string.gen.dart';
  9. typedef TalkDeleteBuilder = void Function();
  10. void talkDeleteDialog(String? talkId, String? talkTitle,
  11. {TalkDeleteBuilder? returnBuilder}) {
  12. SmartDialog.show(
  13. builder: (_) {
  14. return Container(
  15. padding: EdgeInsets.all(16.w),
  16. width: 280.w,
  17. decoration: BoxDecoration(
  18. color: Colors.white,
  19. borderRadius: BorderRadius.circular(12),
  20. ),
  21. child: IntrinsicHeight(
  22. child: Column(
  23. children: [
  24. SizedBox(height: 24.h),
  25. Text(
  26. StringName.talkRenameDeletePrompt.tr
  27. .replacePlaceholders([talkTitle]),
  28. style: TextStyle(
  29. fontSize: 15.sp,
  30. color: ColorName.primaryTextColor,
  31. fontWeight: FontWeight.bold),
  32. ),
  33. SizedBox(height: 35.h),
  34. Row(
  35. children: [
  36. Expanded(
  37. child: GestureDetector(
  38. onTap: () {
  39. SmartDialog.dismiss();
  40. },
  41. child: Container(
  42. padding: EdgeInsets.symmetric(vertical: 8.h),
  43. decoration: BoxDecoration(
  44. color: '#F0F0F0'.toColor(),
  45. borderRadius: BorderRadius.circular(8),
  46. ),
  47. child: Center(
  48. child: Text(
  49. StringName.cancel.tr,
  50. style: TextStyle(
  51. fontSize: 16.sp,
  52. color: ColorName.secondaryTextColor),
  53. ),
  54. ),
  55. ),
  56. )),
  57. SizedBox(width: 12.w),
  58. Expanded(
  59. child: GestureDetector(
  60. onTap: () {
  61. SmartDialog.dismiss();
  62. if (returnBuilder != null) {
  63. returnBuilder.call();
  64. }
  65. },
  66. child: Container(
  67. padding: EdgeInsets.symmetric(vertical: 8.h),
  68. decoration: BoxDecoration(
  69. color: ColorName.colorPrimary,
  70. borderRadius: BorderRadius.circular(8),
  71. ),
  72. child: Center(
  73. child: Text(
  74. StringName.sure.tr,
  75. style: TextStyle(
  76. fontSize: 16.sp, color: ColorName.white),
  77. ),
  78. ),
  79. ),
  80. )),
  81. ],
  82. ),
  83. SizedBox(height: 4.h),
  84. ],
  85. ),
  86. ),
  87. );
  88. },
  89. clickMaskDismiss: false);
  90. }