| 1 | import 'package:cached_network_image/cached_network_image.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_svg/flutter_svg.dart' show SvgPicture; |
| 4 | import 'package:gap/gap.dart'; |
| 5 | import 'package:google_fonts/google_fonts.dart'; |
| 6 | import 'package:openapi/openapi.dart'; |
| 7 | |
| 8 | import 'package:aero/extensions/datetime.dart'; |
| 9 | import 'package:aero/extensions/duration.dart'; |
| 10 | import 'package:aero/formatters/time.dart'; |
| 11 | import 'package:aero/utils/duration.dart'; |
| 12 | |
| 13 | class ShareableFlightCard extends StatelessWidget |
| 14 | const ShareableFlightCard({super |
| 15 | |
| 16 | final FlightResponseEntity info; |
| 17 | |
| 18 | static const _bgBottom = |
| 19 | static const _bgTop = |
| 20 | static const _line = |
| 21 | static const _muted = |
| 22 | static const _faint = |
| 23 | |
| 24 | @override |
| 25 | Widget build(BuildContext |
| 26 | final departure = info.departure; |
| 27 | final arrival = info.arrival; |
| 28 | final airline = info.airline; |
| 29 | final fa = info.flightAwareData; |
| 30 | |
| 31 | final departureTime = |
| 32 | DateTime.parse((departure.revisedTime |
| 33 | final arrivalTime = |
| 34 | DateTime.parse((arrival.revisedTime |
| 35 | final departureScheduled = DateTime. |
| 36 | final arrivalScheduled = DateTime. |
| 37 | final departureDelay = departure.revisedTime != |
| 38 | ? departureTime.difference(departureScheduled) |
| 39 | : null; |
| 40 | final arrivalDelay = arrival.revisedTime != |
| 41 | ? arrivalTime.difference(arrivalScheduled) |
| 42 | : null; |
| 43 | |
| 44 | Duration duration; |
| 45 | try { |
| 46 | duration = calculateFlightDuration( |
| 47 | departureTime: departureTime.toIso8601String(), |
| 48 | departureTimezone: departure.airport.timeZone, |
| 49 | arrivalTime: arrivalTime.toIso8601String(), |
| 50 | arrivalTimezone: arrival.airport.timeZone, |
| 51 | ); |
| 52 | } catch (_) { |
| 53 | duration = arrivalTime.difference(departureTime); |
| 54 | } |
| 55 | |
| 56 | final use24 = MediaQuery. |
| 57 | final status = _statusText(fa) |
| 58 | |
| 59 | final flightLine = info.flightNo + |
| 60 | (fa?.identIata != null && fa |
| 61 | ? ' · ${fa.identIata |
| 62 | : ''); |
| 63 | |
| 64 | return Container( |
| 65 | width: 480, |
| 66 | height: 740, |
| 67 | decoration: BoxDecoration( |
| 68 | borderRadius: BorderRadius.circular( |
| 69 | color: _bgBottom, |
| 70 | border: Border.all(color |
| 71 | ), |
| 72 | clipBehavior: Clip.antiAlias, |
| 73 | child: Column( |
| 74 | children: [ |
| 75 | Expanded( |
| 76 | flex: 6, |
| 77 | child: Container( |
| 78 | color: _bgTop, |
| 79 | padding: const EdgeInsets. |
| 80 | child: Column( |
| 81 | crossAxisAlignment: CrossAxisAlignment.start, |
| 82 | children: [ |
| 83 | _Header( |
| 84 | airline: airline, |
| 85 | flightLine: flightLine, |
| 86 | status: status, |
| 87 | ), |
| 88 | const Spacer(), |
| 89 | _RouteBlock( |
| 90 | depCode: departure.airport.iata.isNotEmpty |
| 91 | ? departure.airport.iata |
| 92 | : '—', |
| 93 | arrCode: arrival.airport.iata.isNotEmpty |
| 94 | ? arrival.airport.iata |
| 95 | : '—', |
| 96 | depCity: departure.airport.municipalityName, |
| 97 | arrCity: arrival.airport.municipalityName, |
| 98 | depTime: departureTime.toTimezoneString( |
| 99 | departure.airport.timeZone, |
| 100 | use24Hrs: use24, |
| 101 | ), |
| 102 | arrTime: arrivalTime.toTimezoneString( |
| 103 | arrival.airport.timeZone, |
| 104 | use24Hrs: use24, |
| 105 | ), |
| 106 | depDelay: departureDelay, |
| 107 | arrDelay: arrivalDelay, |
| 108 | duration: duration, |
| 109 | ), |
| 110 | ], |
| 111 | ), |
| 112 | ), |
| 113 | ), |
| 114 | |
| 115 | const _Perforation(), |
| 116 | |
| 117 | Expanded( |
| 118 | flex: 5, |
| 119 | child: Padding( |
| 120 | padding: const EdgeInsets. |
| 121 | child: Column( |
| 122 | crossAxisAlignment: CrossAxisAlignment.start, |
| 123 | children: [ |
| 124 | _MetaGrid( |
| 125 | date: formatDayAndMonth(departureTime), |
| 126 | duration: duration.toHumanReadable(), |
| 127 | aircraft: info.aircraft?.model ?? |
| 128 | info.aircraft?.registration ?? |
| 129 | '—', |
| 130 | ), |
| 131 | const Gap(18) |
| 132 | _AirportRow( |
| 133 | side: 'DEPARTURE', |
| 134 | terminal: departure.terminal, |
| 135 | gate: fa?.gateOrigin ?? departure.gate |
| 136 | baggage: null, |
| 137 | runway: fa?.actualRunwayOff, |
| 138 | ), |
| 139 | const Gap(12) |
| 140 | _AirportRow( |
| 141 | side: 'ARRIVAL', |
| 142 | terminal: arrival.terminal, |
| 143 | gate: fa?.gateDestination ?? arrival.gate |
| 144 | baggage: fa?.baggageClaim ?? arrival.baggageBelt |
| 145 | runway: fa?.actualRunwayOn, |
| 146 | ), |
| 147 | const Spacer(), |
| 148 | _Footer( |
| 149 | distanceKm: info.greatCircleDistance.km, |
| 150 | registration: info.aircraft?.registration, |
| 151 | ), |
| 152 | ], |
| 153 | ), |
| 154 | ), |
| 155 | ), |
| 156 | ], |
| 157 | ), |
| 158 | ); |
| 159 | } |
| 160 | |
| 161 | static String? _statusText |
| 162 | if (fa?.cancelled == true) |
| 163 | if (fa?.diverted == true) |
| 164 | return null; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | class _Header extends StatelessWidget |
| 169 | const _Header({ |
| 170 | required this.airline, |
| 171 | required this.flightLine, |
| 172 | required this.status, |
| 173 | }); |
| 174 | final dynamic airline; |
| 175 | final String flightLine; |
| 176 | final String? status; |
| 177 | |
| 178 | @override |
| 179 | Widget build(BuildContext |
| 180 | final logo = airline.image as |
| 181 | final icao = airline.icao as |
| 182 | |
| 183 | Widget logoWidget = const |
| 184 | if (logo != null) { |
| 185 | logoWidget = SvgPicture.network(logo |
| 186 | } else if (icao != null && |
| 187 | logoWidget = CachedNetworkImage( |
| 188 | imageUrl: |
| 189 | 'https://www.flightaware.com/images/airline_logos/180px/$icao.png', |
| 190 | width: 38, |
| 191 | height: 38, |
| 192 | errorWidget: (_, __, ___) => const |
| 193 | ); |
| 194 | } |
| 195 | |
| 196 | return Row( |
| 197 | crossAxisAlignment: CrossAxisAlignment.center, |
| 198 | children: [ |
| 199 | logoWidget, |
| 200 | const Gap(12) |
| 201 | Expanded( |
| 202 | child: Column( |
| 203 | crossAxisAlignment: CrossAxisAlignment.start, |
| 204 | mainAxisSize: MainAxisSize.min, |
| 205 | children: [ |
| 206 | Text( |
| 207 | (airline.name as String?) |
| 208 | maxLines: 1, |
| 209 | overflow: TextOverflow.ellipsis, |
| 210 | style: const TextStyle( |
| 211 | fontFamily: 'DM Sans', |
| 212 | fontSize: 17, |
| 213 | fontWeight: FontWeight.w700, |
| 214 | color: Colors.white, |
| 215 | letterSpacing: 0.2, |
| 216 | ), |
| 217 | ), |
| 218 | const Gap(3) |
| 219 | Text( |
| 220 | flightLine, |
| 221 | maxLines: 1, |
| 222 | overflow: TextOverflow.ellipsis, |
| 223 | style: GoogleFonts.jetBrainsMono( |
| 224 | fontSize: 11, |
| 225 | color: ShareableFlightCard._faint, |
| 226 | letterSpacing: 1.2, |
| 227 | fontWeight: FontWeight.w500, |
| 228 | ), |
| 229 | ), |
| 230 | ], |
| 231 | ), |
| 232 | ), |
| 233 | if (status != null) ...[ |
| 234 | const Gap(12) |
| 235 | Container( |
| 236 | padding: const EdgeInsets. |
| 237 | decoration: BoxDecoration( |
| 238 | color: status == 'CANCELLED' |
| 239 | ? const Color( |
| 240 | : const Color( |
| 241 | borderRadius: BorderRadius.circular( |
| 242 | ), |
| 243 | child: Text( |
| 244 | status!, |
| 245 | style: const TextStyle( |
| 246 | fontFamily: 'DM Sans', |
| 247 | fontSize: 10, |
| 248 | fontWeight: FontWeight.w800, |
| 249 | color: Colors.white, |
| 250 | letterSpacing: 1.2, |
| 251 | ), |
| 252 | ), |
| 253 | ), |
| 254 | ], |
| 255 | ], |
| 256 | ); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | class _RouteBlock extends StatelessWidget |
| 261 | const _RouteBlock({ |
| 262 | required this.depCode, |
| 263 | required this.arrCode, |
| 264 | required this.depCity, |
| 265 | required this.arrCity, |
| 266 | required this.depTime, |
| 267 | required this.arrTime, |
| 268 | required this.depDelay, |
| 269 | required this.arrDelay, |
| 270 | required this.duration, |
| 271 | }); |
| 272 | final String depCode; |
| 273 | final String arrCode; |
| 274 | final String depCity; |
| 275 | final String arrCity; |
| 276 | final String depTime; |
| 277 | final String arrTime; |
| 278 | final Duration? depDelay; |
| 279 | final Duration? arrDelay; |
| 280 | final Duration duration; |
| 281 | |
| 282 | @override |
| 283 | Widget build(BuildContext |
| 284 | return Row( |
| 285 | crossAxisAlignment: CrossAxisAlignment.start, |
| 286 | children: [ |
| 287 | Expanded( |
| 288 | child: _Endpoint( |
| 289 | code: depCode, |
| 290 | city: depCity, |
| 291 | time: depTime, |
| 292 | delay: depDelay, |
| 293 | alignEnd: false, |
| 294 | ), |
| 295 | ), |
| 296 | SizedBox( |
| 297 | width: 96, |
| 298 | child: Padding( |
| 299 | // align the path roughly with the centre of the IATA codes |
| 300 | padding: const EdgeInsets. |
| 301 | child: _RouteLine(label: duration. |
| 302 | ), |
| 303 | ), |
| 304 | Expanded( |
| 305 | child: _Endpoint( |
| 306 | code: arrCode, |
| 307 | city: arrCity, |
| 308 | time: arrTime, |
| 309 | delay: arrDelay, |
| 310 | alignEnd: true, |
| 311 | ), |
| 312 | ), |
| 313 | ], |
| 314 | ); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | class _Endpoint extends StatelessWidget |
| 319 | const _Endpoint({ |
| 320 | required this.code, |
| 321 | required this.city, |
| 322 | required this.time, |
| 323 | required this.delay, |
| 324 | required this.alignEnd, |
| 325 | }); |
| 326 | final String code; |
| 327 | final String city; |
| 328 | final String time; |
| 329 | final Duration? delay; |
| 330 | final bool alignEnd; |
| 331 | |
| 332 | static const _codeStyle = |
| 333 | fontFamily: 'DM Sans', |
| 334 | fontSize: 54, |
| 335 | fontWeight: FontWeight.w800, |
| 336 | color: Colors.white, |
| 337 | height: 1, |
| 338 | letterSpacing: -1.5, |
| 339 | ); |
| 340 | |
| 341 | static const _cityStyle = |
| 342 | fontFamily: 'DM Sans', |
| 343 | fontSize: 14, |
| 344 | color: ShareableFlightCard._muted, |
| 345 | fontWeight: FontWeight.w500, |
| 346 | height: 1.2, |
| 347 | ); |
| 348 | |
| 349 | @override |
| 350 | Widget build(BuildContext |
| 351 | final align = |
| 352 | alignEnd ? CrossAxisAlignment.end : |
| 353 | final textAlign = alignEnd ? TextAlign |
| 354 | return Column( |
| 355 | crossAxisAlignment: align, |
| 356 | children: [ |
| 357 | Text(code, style: _codeStyle, |
| 358 | const Gap(8) |
| 359 | Text( |
| 360 | city, |
| 361 | style: _cityStyle, |
| 362 | textAlign: textAlign, |
| 363 | maxLines: 2, |
| 364 | softWrap: true, |
| 365 | ), |
| 366 | const Gap(14) |
| 367 | _TimeBlock(time: time, delay: |
| 368 | ], |
| 369 | ); |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | class _Perforation extends StatelessWidget |
| 374 | const _Perforation(); |
| 375 | |
| 376 | static const _height = |
| 377 | static const _notch = |
| 378 | |
| 379 | @override |
| 380 | Widget build(BuildContext |
| 381 | return SizedBox( |
| 382 | height: _height, |
| 383 | child: Stack( |
| 384 | clipBehavior: Clip.none, |
| 385 | children: [ |
| 386 | Container(color: ShareableFlightCard. |
| 387 | Positioned( |
| 388 | left: -_notch / 2, |
| 389 | top: (_height - _notch) / 2, |
| 390 | child: Container( |
| 391 | width: _notch, |
| 392 | height: _notch, |
| 393 | decoration: const BoxDecoration( |
| 394 | color: ShareableFlightCard._bgBottom, |
| 395 | shape: BoxShape.circle, |
| 396 | ), |
| 397 | ), |
| 398 | ), |
| 399 | Positioned( |
| 400 | right: -_notch / 2, |
| 401 | top: (_height - _notch) / 2, |
| 402 | child: Container( |
| 403 | width: _notch, |
| 404 | height: _notch, |
| 405 | decoration: const BoxDecoration( |
| 406 | color: ShareableFlightCard._bgBottom, |
| 407 | shape: BoxShape.circle, |
| 408 | ), |
| 409 | ), |
| 410 | ), |
| 411 | Padding( |
| 412 | padding: const EdgeInsets. |
| 413 | child: Center( |
| 414 | child: _DashedLine(color: Colors |
| 415 | ), |
| 416 | ), |
| 417 | ], |
| 418 | ), |
| 419 | ); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | class _RouteLine extends StatelessWidget |
| 424 | const _RouteLine({required |
| 425 | final String label; |
| 426 | |
| 427 | @override |
| 428 | Widget build(BuildContext |
| 429 | return Column( |
| 430 | mainAxisSize: MainAxisSize.min, |
| 431 | children: [ |
| 432 | Text( |
| 433 | label, |
| 434 | textAlign: TextAlign.center, |
| 435 | style: const TextStyle( |
| 436 | fontFamily: 'DM Sans', |
| 437 | fontSize: 11, |
| 438 | color: ShareableFlightCard._faint, |
| 439 | fontWeight: FontWeight.w600, |
| 440 | letterSpacing: 0.6, |
| 441 | ), |
| 442 | ), |
| 443 | const Gap(8) |
| 444 | Row( |
| 445 | children: [ |
| 446 | const Expanded(child: |
| 447 | const Gap(6) |
| 448 | Container( |
| 449 | width: 28, |
| 450 | height: 28, |
| 451 | alignment: Alignment.center, |
| 452 | decoration: BoxDecoration( |
| 453 | color: Colors.white.withOpacity |
| 454 | shape: BoxShape.circle, |
| 455 | border: Border.all(color |
| 456 | ), |
| 457 | child: Transform.rotate( |
| 458 | angle: 1.5708, |
| 459 | child: const Icon( |
| 460 | Icons.flight, |
| 461 | size: 14, |
| 462 | color: Colors.white, |
| 463 | ), |
| 464 | ), |
| 465 | ), |
| 466 | const Gap(6) |
| 467 | const Expanded(child: |
| 468 | ], |
| 469 | ), |
| 470 | ], |
| 471 | ); |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | class _TimeBlock extends StatelessWidget |
| 476 | const _TimeBlock({ |
| 477 | required this.time, |
| 478 | required this.delay, |
| 479 | required this.alignment, |
| 480 | }); |
| 481 | final String time; |
| 482 | final Duration? delay; |
| 483 | final CrossAxisAlignment alignment; |
| 484 | |
| 485 | @override |
| 486 | Widget build(BuildContext |
| 487 | final hasDelay = delay != null |
| 488 | final isEarly = hasDelay && delay! |
| 489 | final color = !hasDelay |
| 490 | ? ShareableFlightCard._faint |
| 491 | : isEarly |
| 492 | ? const Color( |
| 493 | : const Color( |
| 494 | return Column( |
| 495 | crossAxisAlignment: alignment, |
| 496 | children: [ |
| 497 | Text( |
| 498 | time, |
| 499 | style: const TextStyle( |
| 500 | fontFamily: 'DM Sans', |
| 501 | fontSize: 20, |
| 502 | fontWeight: FontWeight.w700, |
| 503 | color: Colors.white, |
| 504 | letterSpacing: -0.3, |
| 505 | ), |
| 506 | ), |
| 507 | if (hasDelay) ...[ |
| 508 | const Gap(2) |
| 509 | Text( |
| 510 | isEarly |
| 511 | ? '${delay!.abs |
| 512 | : '${delay!.toHumanReadable |
| 513 | style: TextStyle( |
| 514 | fontFamily: 'DM Sans', |
| 515 | fontSize: 10, |
| 516 | color: color, |
| 517 | fontWeight: FontWeight.w600, |
| 518 | letterSpacing: 0.3, |
| 519 | ), |
| 520 | ), |
| 521 | ], |
| 522 | ], |
| 523 | ); |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | class _MetaGrid extends StatelessWidget |
| 528 | const _MetaGrid({ |
| 529 | required this.date, |
| 530 | required this.duration, |
| 531 | required this.aircraft, |
| 532 | }); |
| 533 | final String date; |
| 534 | final String duration; |
| 535 | final String aircraft; |
| 536 | |
| 537 | @override |
| 538 | Widget build(BuildContext |
| 539 | return Column( |
| 540 | crossAxisAlignment: CrossAxisAlignment.stretch, |
| 541 | children: [ |
| 542 | Row( |
| 543 | children: [ |
| 544 | Expanded(child: _MetaCell(label |
| 545 | Expanded(child: _MetaCell(label |
| 546 | ], |
| 547 | ), |
| 548 | const Gap(14) |
| 549 | _MetaCell(label: 'AIRCRAFT', value |
| 550 | ], |
| 551 | ); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | class _MetaCell extends StatelessWidget |
| 556 | const _MetaCell({ |
| 557 | required this.label, |
| 558 | required this.value, |
| 559 | this.align = CrossAxisAlignment |
| 560 | }); |
| 561 | final String label; |
| 562 | final String value; |
| 563 | final CrossAxisAlignment align; |
| 564 | |
| 565 | @override |
| 566 | Widget build(BuildContext |
| 567 | return Column( |
| 568 | crossAxisAlignment: align, |
| 569 | children: [ |
| 570 | Text( |
| 571 | label, |
| 572 | style: const TextStyle( |
| 573 | fontFamily: 'DM Sans', |
| 574 | fontSize: 9, |
| 575 | fontWeight: FontWeight.w700, |
| 576 | color: ShareableFlightCard._faint, |
| 577 | letterSpacing: 1.4, |
| 578 | ), |
| 579 | ), |
| 580 | const Gap(4) |
| 581 | Text( |
| 582 | value, |
| 583 | softWrap: true, |
| 584 | textAlign: align == CrossAxisAlignment.end |
| 585 | ? TextAlign.end |
| 586 | : TextAlign.start, |
| 587 | style: const TextStyle( |
| 588 | fontFamily: 'DM Sans', |
| 589 | fontSize: 13, |
| 590 | fontWeight: FontWeight.w600, |
| 591 | color: Colors.white, |
| 592 | height: 1.2, |
| 593 | ), |
| 594 | ), |
| 595 | ], |
| 596 | ); |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | class _AirportRow extends StatelessWidget |
| 601 | const _AirportRow({ |
| 602 | required this.side, |
| 603 | required this.terminal, |
| 604 | required this.gate, |
| 605 | required this.baggage, |
| 606 | required this.runway, |
| 607 | }); |
| 608 | final String side; |
| 609 | final String? terminal; |
| 610 | final String? gate; |
| 611 | final String? baggage; |
| 612 | final String? runway; |
| 613 | |
| 614 | @override |
| 615 | Widget build(BuildContext |
| 616 | final cells = <Widget |
| 617 | _MetaCell(label: 'TERMINAL', value |
| 618 | _MetaCell(label: 'GATE', value |
| 619 | _MetaCell(label: 'BAGGAGE', value |
| 620 | _MetaCell( |
| 621 | label: 'RUNWAY', |
| 622 | value: _val(runway), |
| 623 | align: CrossAxisAlignment.end, |
| 624 | ), |
| 625 | ]; |
| 626 | |
| 627 | final isDeparture = side == 'DEPARTURE' |
| 628 | |
| 629 | return Row( |
| 630 | crossAxisAlignment: CrossAxisAlignment.center, |
| 631 | children: [ |
| 632 | SizedBox( |
| 633 | width: 64, |
| 634 | child: Row( |
| 635 | children: [ |
| 636 | Icon( |
| 637 | isDeparture ? Icons.flight_takeoff : |
| 638 | size: 13, |
| 639 | color: ShareableFlightCard._faint, |
| 640 | ), |
| 641 | const Gap(6) |
| 642 | Expanded( |
| 643 | child: Text( |
| 644 | isDeparture ? 'DEP' : 'ARR', |
| 645 | style: const TextStyle( |
| 646 | fontFamily: 'DM Sans', |
| 647 | fontSize: 9, |
| 648 | color: ShareableFlightCard._faint, |
| 649 | fontWeight: FontWeight.w700, |
| 650 | letterSpacing: 1.4, |
| 651 | ), |
| 652 | ), |
| 653 | ), |
| 654 | ], |
| 655 | ), |
| 656 | ), |
| 657 | for (var i = 0 |
| 658 | ], |
| 659 | ); |
| 660 | } |
| 661 | |
| 662 | String _val(String |
| 663 | } |
| 664 | |
| 665 | class _Footer extends StatelessWidget |
| 666 | const _Footer({required |
| 667 | final String? distanceKm; |
| 668 | final String? registration; |
| 669 | |
| 670 | @override |
| 671 | Widget build(BuildContext |
| 672 | final km = distanceKm != null |
| 673 | final distance = km != null |
| 674 | ? '${km.toStringAsFixed |
| 675 | : null; |
| 676 | |
| 677 | return Column( |
| 678 | crossAxisAlignment: CrossAxisAlignment.stretch, |
| 679 | children: [ |
| 680 | _DashedLine(color: Colors. |
| 681 | const Gap(14) |
| 682 | Row( |
| 683 | crossAxisAlignment: CrossAxisAlignment.center, |
| 684 | children: [ |
| 685 | Text( |
| 686 | 'AERO', |
| 687 | style: GoogleFonts.jetBrainsMono( |
| 688 | fontSize: 11, |
| 689 | color: ShareableFlightCard._muted, |
| 690 | letterSpacing: 3, |
| 691 | fontWeight: FontWeight.w700, |
| 692 | ), |
| 693 | ), |
| 694 | if (registration != null && registration! |
| 695 | const Gap(12) |
| 696 | Container( |
| 697 | padding: const EdgeInsets. |
| 698 | decoration: BoxDecoration( |
| 699 | color: Colors.white.withOpacity |
| 700 | borderRadius: BorderRadius.circular( |
| 701 | border: Border.all(color |
| 702 | ), |
| 703 | child: Text( |
| 704 | registration!, |
| 705 | style: GoogleFonts.jetBrainsMono( |
| 706 | fontSize: 10, |
| 707 | color: ShareableFlightCard._muted, |
| 708 | letterSpacing: 1.2, |
| 709 | fontWeight: FontWeight.w600, |
| 710 | ), |
| 711 | ), |
| 712 | ), |
| 713 | ], |
| 714 | const Spacer(), |
| 715 | if (distance != null) |
| 716 | Text( |
| 717 | distance, |
| 718 | style: const TextStyle( |
| 719 | fontFamily: 'DM Sans', |
| 720 | fontSize: 11, |
| 721 | color: ShareableFlightCard._faint, |
| 722 | fontWeight: FontWeight.w500, |
| 723 | letterSpacing: 0.4, |
| 724 | ), |
| 725 | ), |
| 726 | ], |
| 727 | ), |
| 728 | ], |
| 729 | ); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | class _DashedLine extends StatelessWidget |
| 734 | const _DashedLine({required |
| 735 | final Color color; |
| 736 | |
| 737 | @override |
| 738 | Widget build(BuildContext |
| 739 | return LayoutBuilder( |
| 740 | builder: (context, constraints) { |
| 741 | const dashWidth = 4.0; |
| 742 | const dashSpace = 4.0; |
| 743 | final count = |
| 744 | (constraints.maxWidth / (dashWidth + dashSpace)).floor |
| 745 | return Row( |
| 746 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 747 | children: List.generate( |
| 748 | count, |
| 749 | (_) => SizedBox( |
| 750 | width: dashWidth, |
| 751 | height: 1, |
| 752 | child: DecoratedBox(decoration: BoxDecoration |
| 753 | ), |
| 754 | ), |
| 755 | ); |
| 756 | }, |
| 757 | ); |
| 758 | } |
| 759 | } |