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.
 
 
 
 
 
 

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