Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

186 linhas
6.8 KiB

  1. // ignore_for_file: public_member_api_docs, sort_constructors_first
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_gen/gen_l10n/app_localizations.dart';
  4. import 'package:provider/provider.dart';
  5. import 'package:qadirneyriz/config/config.dart';
  6. import 'package:qadirneyriz/screens/meeting/state.dart';
  7. import 'package:qadirneyriz/screens/private_meeting/screen.dart';
  8. class CustomCardMeeting extends StatelessWidget {
  9. final String titel;
  10. final String date;
  11. final String location;
  12. final String fromTime;
  13. final String toTime;
  14. final int status;
  15. final int cardId;
  16. final void Function(String)? onSelectedMoreButton;
  17. final List<PopupMenuEntry<String>> Function(BuildContext)?
  18. itemBuilderMoreButton;
  19. const CustomCardMeeting({
  20. Key? key,
  21. required this.titel,
  22. required this.date,
  23. required this.status,
  24. required this.location,
  25. required this.fromTime,
  26. required this.toTime,
  27. required this.cardId,
  28. this.onSelectedMoreButton,
  29. this.itemBuilderMoreButton,
  30. }) : super(key: key);
  31. @override
  32. Widget build(BuildContext context) {
  33. return Padding(
  34. padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
  35. child: Consumer<MeetingsState>(
  36. builder: (context, value, child) {
  37. return Container(
  38. width: 350,
  39. decoration: BoxDecoration(
  40. color: const Color(0xffF4F9F6),
  41. boxShadow: [
  42. BoxShadow(
  43. color: config.ui.mainGray.withOpacity(.1),
  44. spreadRadius: .1,
  45. offset: const Offset(0, 2),
  46. blurRadius: 6)
  47. ],
  48. borderRadius: const BorderRadius.all(Radius.circular(12))),
  49. child: Row(
  50. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  51. crossAxisAlignment: CrossAxisAlignment.start,
  52. children: [
  53. Flexible(
  54. child: Padding(
  55. padding: const EdgeInsets.all(10.0),
  56. child: Column(
  57. crossAxisAlignment: CrossAxisAlignment.start,
  58. children: [
  59. Row(
  60. mainAxisSize: MainAxisSize.min,
  61. children: [
  62. Icon(
  63. Icons.check,
  64. color: config.ui.mainGreen,
  65. ),
  66. const SizedBox(
  67. width: 8,
  68. ),
  69. Flexible(
  70. fit: FlexFit.loose,
  71. child: Text(
  72. titel,
  73. maxLines: 1,
  74. style: const TextStyle(fontSize: 14),
  75. overflow: TextOverflow.ellipsis,
  76. ),
  77. )
  78. ],
  79. ),
  80. const SizedBox(
  81. height: 8,
  82. ),
  83. Row(
  84. children: [
  85. Icon(
  86. Icons.location_city_outlined,
  87. color: config.ui.mainGreen,
  88. ),
  89. const SizedBox(
  90. width: 8,
  91. ),
  92. Flexible(
  93. fit: FlexFit.loose,
  94. child: Text(
  95. location,
  96. maxLines: 1,
  97. style: const TextStyle(fontSize: 14),
  98. overflow: TextOverflow.ellipsis,
  99. ),
  100. ),
  101. ],
  102. ),
  103. const SizedBox(
  104. height: 8,
  105. ),
  106. Row(
  107. children: [
  108. Icon(
  109. Icons.date_range,
  110. color: config.ui.mainGreen,
  111. ),
  112. const SizedBox(
  113. width: 8,
  114. ),
  115. Flexible(
  116. fit: FlexFit.loose,
  117. child: Text(
  118. date,
  119. maxLines: 1,
  120. style: const TextStyle(fontSize: 14),
  121. overflow: TextOverflow.ellipsis,
  122. ),
  123. ),
  124. ],
  125. ),
  126. const SizedBox(
  127. height: 8,
  128. ),
  129. Row(
  130. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  131. children: [
  132. Row(
  133. children: [
  134. Icon(
  135. Icons.alarm,
  136. color: config.ui.mainGreen,
  137. ),
  138. const SizedBox(
  139. width: 8,
  140. ),
  141. Text(
  142. '$fromTime ${AppLocalizations.of(context)!.to} $toTime',
  143. maxLines: 1,
  144. style: const TextStyle(fontSize: 14),
  145. overflow: TextOverflow.ellipsis,
  146. ),
  147. ],
  148. ),
  149. if (this.status != 0)
  150. PrivateMeetingLabel(
  151. status: this.status,
  152. )
  153. ],
  154. ),
  155. ],
  156. ),
  157. ),
  158. ),
  159. itemBuilderMoreButton != null
  160. ? _moreButton(context, value)
  161. : Container(),
  162. ],
  163. ),
  164. );
  165. },
  166. ),
  167. );
  168. }
  169. Widget _moreButton(BuildContext context, MeetingsState state) {
  170. return PopupMenuButton<String>(
  171. color: Colors.white,
  172. shape: const RoundedRectangleBorder(
  173. borderRadius: BorderRadius.all(
  174. Radius.circular(10.0),
  175. ),
  176. ),
  177. onSelected: onSelectedMoreButton,
  178. itemBuilder: itemBuilderMoreButton!,
  179. icon: const Icon(Icons.more_horiz),
  180. );
  181. }
  182. }