1
0

w_crewlist.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import 'package:flutter/material.dart';
  2. import 'package:gap/gap.dart';
  3. import 'package:jiffy/jiffy.dart';
  4. import 'package:tp5/core/core.dart';
  5. import 'package:tp5/roster/models/crewlist_leg.dart';
  6. import 'package:tp5/roster/widgets/w_citypair.dart';
  7. import 'package:tp5/roster/widgets/w_fnum.dart';
  8. import 'package:tp5/roster/widgets/w_hour.dart';
  9. class WCrewlist extends StatelessWidget {
  10. const WCrewlist({super.key, required this.leg, this.date, this.onTap});
  11. final CrewlistLeg leg;
  12. final String? date;
  13. final dynamic onTap;
  14. @override
  15. Widget build(BuildContext context) {
  16. return Row(
  17. crossAxisAlignment: CrossAxisAlignment.start,
  18. children: [
  19. Container(
  20. width: 120,
  21. color: Colors.grey[900],
  22. child: Column(
  23. children: [
  24. Card(
  25. shape: RoundedRectangleBorder(
  26. borderRadius: BorderRadius.circular(6.0),
  27. ),
  28. elevation: 8.0,
  29. margin:
  30. const EdgeInsets.symmetric(horizontal: 5.0, vertical: 3.0),
  31. child: Column(children: [
  32. Row(
  33. mainAxisSize: MainAxisSize.max,
  34. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  35. children: [
  36. const Gap(2),
  37. WHour(jiffy: leg.jdep),
  38. const Gap(20),
  39. WHour(
  40. jiffy: leg.jdes,
  41. color: leg.jdes.format(pattern: "yyyy-MM-dd") ==
  42. leg.date
  43. ? null
  44. : Colors.yellow[800]),
  45. const Gap(2),
  46. ]),
  47. Row(
  48. mainAxisAlignment: MainAxisAlignment.center,
  49. children: [WCitypair(iata1: leg.dep, iata2: leg.des)],
  50. ),
  51. WFnum(al: leg.al, fnum: leg.fnum),
  52. ]),
  53. ),
  54. Text(
  55. Jiffy.parse(leg.date, pattern: "yyyy-MM-dd", isUtc: true)
  56. .format(pattern: "EEE dd MMM'yy"),
  57. style: const TextStyle(
  58. fontSize: 10,
  59. color: Colors.blueGrey,
  60. letterSpacing: 2,
  61. fontWeight: FontWeight.w700))
  62. ],
  63. ),
  64. ),
  65. const Gap(5),
  66. Container(
  67. width: 130,
  68. color: Colors.grey[900],
  69. child:
  70. Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  71. Row(
  72. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  73. children: [
  74. const Gap(20),
  75. const Text(
  76. "<Cockpit>",
  77. style:
  78. TextStyle(fontWeight: FontWeight.w600, letterSpacing: 2),
  79. ),
  80. Text("${leg.cockpit.length}",
  81. style: const TextStyle(
  82. fontWeight: FontWeight.w900, color: Colors.amber)),
  83. ],
  84. ),
  85. const Gap(5),
  86. ...leg.cockpit.map(
  87. (e) => Text(
  88. "+ ${e.capitalizeword()}",
  89. overflow: TextOverflow.ellipsis,
  90. style: const TextStyle(fontSize: 12),
  91. ),
  92. ),
  93. const Gap(10)
  94. ]),
  95. ),
  96. const Gap(5),
  97. Container(
  98. width: 130,
  99. color: Colors.grey[900],
  100. child:
  101. Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  102. Row(
  103. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  104. children: [
  105. const Gap(20),
  106. const Text(
  107. "<Cabin>",
  108. style:
  109. TextStyle(fontWeight: FontWeight.w600, letterSpacing: 2),
  110. ),
  111. Text("${leg.cabin.length}",
  112. style: const TextStyle(
  113. fontWeight: FontWeight.w900, color: Colors.amber)),
  114. ],
  115. ),
  116. const Gap(5),
  117. ...leg.cabin.map(
  118. (e) => Text(
  119. "+ ${e.capitalizeword()}",
  120. overflow: TextOverflow.ellipsis,
  121. style: const TextStyle(fontSize: 12),
  122. ),
  123. ),
  124. const Gap(10)
  125. ]),
  126. ),
  127. const Gap(5),
  128. Container(
  129. width: 130,
  130. color: Colors.grey[900],
  131. child:
  132. Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  133. Row(
  134. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  135. children: [
  136. const Gap(20),
  137. const Text(
  138. "<DH>",
  139. style:
  140. TextStyle(fontWeight: FontWeight.w600, letterSpacing: 2),
  141. ),
  142. Text("${leg.dh.length}",
  143. style: const TextStyle(
  144. fontWeight: FontWeight.w900, color: Colors.amber)),
  145. ],
  146. ),
  147. const Gap(5),
  148. ...leg.dh.map(
  149. (e) => Text(
  150. "+ ${e.capitalizeword()}",
  151. overflow: TextOverflow.ellipsis,
  152. style: const TextStyle(fontSize: 12),
  153. ),
  154. ),
  155. const Gap(10)
  156. ]),
  157. )
  158. ],
  159. );
  160. }
  161. // Widget _text(String? msg) => Flexible(
  162. // child: Tooltip(
  163. // message: msg ?? "",
  164. // child: Text(msg ?? "",
  165. // overflow: TextOverflow.ellipsis,
  166. // style: const TextStyle(color: Colors.white38, fontSize: 12))));
  167. }