account_deactivation_dialog.dart 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:widgets/ext/ex_widget.dart';
  6. import 'package:widgets/my_load_image.dart';
  7. import 'package:widgets/my_text_view.dart';
  8. import 'package:widgets/widget_export.dart';
  9. class AccountDeactivationDialog extends StatelessWidget {
  10. VoidCallback confirmAction;
  11. AccountDeactivationDialog({
  12. required this.confirmAction,
  13. });
  14. Widget CheckboxList(BuildContext context) {
  15. final List<String> items = ['苹果', '香蕉', '橙子'];
  16. final List<bool> selections = [false, false, false];
  17. return Expanded(child:ListView.builder(
  18. itemCount: items.length,
  19. itemBuilder: (context, index) {
  20. return Container(
  21. padding: EdgeInsets.symmetric(vertical: 5.0),
  22. child: CheckboxListTile(
  23. value: selections[index],
  24. onChanged: (bool? val) {
  25. print('Option 1 is now ${val ?? false}');
  26. selections[index] = val!;
  27. },
  28. title: Text(items[index]),
  29. ),
  30. );
  31. },
  32. )
  33. );
  34. }
  35. @override
  36. Widget build(BuildContext context) {
  37. return Column(
  38. crossAxisAlignment: CrossAxisAlignment.center,
  39. mainAxisAlignment: MainAxisAlignment.center,
  40. children: [
  41. Container(
  42. width: double.infinity,
  43. height: 55,
  44. decoration: BoxDecoration(
  45. color: context.appColors.btnBgDefault,
  46. borderRadius: const BorderRadius.only(
  47. topRight: Radius.circular(15),
  48. topLeft: Radius.circular(15),
  49. ),
  50. ),
  51. child: Row(
  52. children: [
  53. const SizedBox(width: 45),
  54. MyTextView(
  55. 'Choose a Category',
  56. fontSize: 18,
  57. textAlign: TextAlign.center,
  58. isFontMedium: true,
  59. textColor: Colors.white,
  60. ).expanded(),
  61. const MyAssetImage(
  62. Assets.baseServiceDialogDeleteIcon,
  63. width: 25,
  64. height: 25.5,
  65. ).onTap(() {
  66. onCancel();
  67. }, padding: 10)
  68. ],
  69. ),
  70. ),
  71. Container(
  72. width: double.infinity,
  73. padding: const EdgeInsets.only(top: 22),
  74. decoration: BoxDecoration(
  75. color: context.appColors.whiteSecondBG,
  76. borderRadius: const BorderRadius.only(
  77. bottomLeft: Radius.circular(15),
  78. bottomRight: Radius.circular(15),
  79. ),
  80. ),
  81. child: Column(
  82. children: [
  83. Container(height:200, child:CheckboxList(context)),
  84. Row(
  85. children: [
  86. const SizedBox(width: 18),
  87. Expanded(
  88. flex: 1,
  89. child: InkWell(
  90. onTap: () async {
  91. onCancel();
  92. confirmAction();
  93. },
  94. child: MyTextView(
  95. 'Ok',
  96. fontSize: 16,
  97. paddingTop: 13,
  98. paddingBottom: 13,
  99. isFontMedium: true,
  100. textAlign: TextAlign.center,
  101. textColor: Colors.white,
  102. backgroundColor: context.appColors.btnBgDefault,
  103. cornerRadius: 7,
  104. ),
  105. )),
  106. const SizedBox(width: 18),
  107. ],
  108. ).marginOnly(bottom: 30, top: 28),
  109. ],
  110. ),
  111. ),
  112. ],
  113. ).constrained(width: 340);
  114. }
  115. //取消弹框
  116. void onCancel() async {
  117. SmartDialog.dismiss();
  118. }
  119. }