account_deactivation_dialog.dart 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. selections[index] = val!;
  26. },
  27. title: Text(items[index]),
  28. ),
  29. );
  30. },
  31. )
  32. );
  33. }
  34. @override
  35. Widget build(BuildContext context) {
  36. return Column(
  37. crossAxisAlignment: CrossAxisAlignment.center,
  38. mainAxisAlignment: MainAxisAlignment.center,
  39. children: [
  40. Container(
  41. width: double.infinity,
  42. height: 55,
  43. decoration: BoxDecoration(
  44. color: context.appColors.btnBgDefault,
  45. borderRadius: const BorderRadius.only(
  46. topRight: Radius.circular(15),
  47. topLeft: Radius.circular(15),
  48. ),
  49. ),
  50. child: Row(
  51. children: [
  52. const SizedBox(width: 45),
  53. MyTextView(
  54. 'Choose a Category',
  55. fontSize: 18,
  56. textAlign: TextAlign.center,
  57. isFontMedium: true,
  58. textColor: Colors.white,
  59. ).expanded(),
  60. const MyAssetImage(
  61. Assets.baseServiceDialogDeleteIcon,
  62. width: 25,
  63. height: 25.5,
  64. ).onTap(() {
  65. onCancel();
  66. }, padding: 10)
  67. ],
  68. ),
  69. ),
  70. Container(
  71. width: double.infinity,
  72. padding: const EdgeInsets.only(top: 22),
  73. decoration: BoxDecoration(
  74. color: context.appColors.whiteSecondBG,
  75. borderRadius: const BorderRadius.only(
  76. bottomLeft: Radius.circular(15),
  77. bottomRight: Radius.circular(15),
  78. ),
  79. ),
  80. child: Column(
  81. children: [
  82. CheckboxList(context),
  83. Row(
  84. children: [
  85. const SizedBox(width: 18),
  86. Expanded(
  87. flex: 1,
  88. child: InkWell(
  89. onTap: () async {
  90. onCancel();
  91. confirmAction();
  92. },
  93. child: MyTextView(
  94. 'Ok',
  95. fontSize: 16,
  96. paddingTop: 13,
  97. paddingBottom: 13,
  98. isFontMedium: true,
  99. textAlign: TextAlign.center,
  100. textColor: Colors.white,
  101. backgroundColor: context.appColors.btnBgDefault,
  102. cornerRadius: 7,
  103. ),
  104. )),
  105. const SizedBox(width: 18),
  106. ],
  107. ).marginOnly(bottom: 30, top: 28),
  108. ],
  109. ),
  110. ),
  111. ],
  112. ).constrained(width: 340);
  113. }
  114. //取消弹框
  115. void onCancel() async {
  116. SmartDialog.dismiss();
  117. }
  118. }