album_default_select_dialog.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. // ignore_for_file: must_be_immutable
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/widgets.dart';
  4. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  5. import 'package:get/get.dart';
  6. import 'package:cs_resources/constants/color_constants.dart';
  7. import '../my_text_view.dart';
  8. /// 相机相册的选择
  9. class AlbumDefaultSelectDialog extends StatelessWidget {
  10. bool isTypeVideo = false;
  11. VoidCallback? cancelAction;
  12. VoidCallback cameraAction;
  13. VoidCallback albumAction;
  14. AlbumDefaultSelectDialog({
  15. Key? key,
  16. required this.cameraAction,
  17. required this.albumAction,
  18. this.cancelAction,
  19. this.isTypeVideo = false,
  20. }) : super(key: key);
  21. @override
  22. Widget build(BuildContext context) {
  23. final bgColor = const Color(0xFAFFFFFF);
  24. const roundRadios = 10.0;
  25. return Container(
  26. margin: const EdgeInsets.only(left: 30, right: 30, bottom: 30),
  27. child: Column(
  28. //顶部标题
  29. mainAxisSize: MainAxisSize.min,
  30. children: [
  31. // 顶部的文本
  32. Container(
  33. width: double.infinity,
  34. alignment: Alignment.center,
  35. decoration: BoxDecoration(
  36. color: bgColor,
  37. borderRadius: const BorderRadius.only(
  38. topLeft: Radius.circular(roundRadios),
  39. topRight: Radius.circular(roundRadios),
  40. )),
  41. child: MyTextView(
  42. isTypeVideo ? "选择视频".tr : "选择图片".tr,
  43. paddingTop: 10,
  44. paddingBottom: 10,
  45. textColor: const Color(0xff323843),
  46. fontSize: 12,
  47. isFontRegular: true,
  48. ),
  49. ),
  50. // 分割线
  51. Container(
  52. color: ColorConstants.dividerItem,
  53. height: 0.5,
  54. ),
  55. InkWell(
  56. onTap: () {
  57. onCancel();
  58. cameraAction.call();
  59. },
  60. child: Container(
  61. width: double.infinity,
  62. alignment: Alignment.center,
  63. color: bgColor,
  64. child: MyTextView(
  65. "相机".tr,
  66. textColor: ColorConstants.blue1578fe,
  67. paddingTop: 15,
  68. paddingBottom: 15,
  69. fontSize: 16,
  70. isFontMedium: true,
  71. ),
  72. ),
  73. ),
  74. // 分割线
  75. Container(
  76. color: ColorConstants.dividerItem,
  77. height: 0.5,
  78. ),
  79. InkWell(
  80. onTap: () {
  81. onCancel();
  82. albumAction.call();
  83. },
  84. child: Container(
  85. width: double.infinity,
  86. alignment: Alignment.center,
  87. decoration: BoxDecoration(
  88. color: bgColor,
  89. borderRadius: const BorderRadius.only(
  90. bottomRight: Radius.circular(roundRadios),
  91. bottomLeft: Radius.circular(roundRadios),
  92. )),
  93. child: MyTextView(
  94. "相册".tr,
  95. textColor: ColorConstants.blue1578fe,
  96. fontSize: 16,
  97. paddingTop: 15,
  98. paddingBottom: 15,
  99. isFontMedium: true,
  100. ),
  101. ),
  102. ),
  103. // 分割线
  104. Container(
  105. color: ColorConstants.dividerA6,
  106. height: 0.5,
  107. ),
  108. // 取消按钮
  109. InkWell(
  110. onTap: () {
  111. onCancel();
  112. cancelAction?.call();
  113. },
  114. child: Container(
  115. margin: const EdgeInsets.only(top: 10),
  116. width: double.infinity,
  117. alignment: Alignment.center,
  118. decoration: BoxDecoration(
  119. color: bgColor,
  120. borderRadius: const BorderRadius.all(Radius.circular(roundRadios))),
  121. child: MyTextView(
  122. "取消".tr,
  123. textColor: ColorConstants.blue1578fe,
  124. fontSize: 16,
  125. paddingTop: 15,
  126. paddingBottom: 15,
  127. isFontMedium: true,
  128. ),
  129. ),
  130. ),
  131. ],
  132. ),
  133. );
  134. }
  135. //取消弹框
  136. void onCancel() async {
  137. SmartDialog.dismiss();
  138. }
  139. }