album_default_select_dialog.dart 4.2 KB

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