| 1 | import 'package:animated_flip_counter/animated_flip_counter.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | import 'dart:ui'; |
| 4 | |
| 5 | class AnimatedFlightInfoBar extends StatefulWidget |
| 6 | final int altitude; |
| 7 | final int speed; |
| 8 | final int? heading; |
| 9 | |
| 10 | const AnimatedFlightInfoBar({ |
| 11 | super.key, |
| 12 | required this.altitude, |
| 13 | required this.speed, |
| 14 | this.heading, |
| 15 | }); |
| 16 | |
| 17 | @override |
| 18 | State<AnimatedFlightInfoBar> createState |
| 19 | } |
| 20 | |
| 21 | class _AnimatedFlightInfoBarState extends State |
| 22 | @override |
| 23 | Widget build(BuildContext |
| 24 | return ClipRRect( |
| 25 | borderRadius: BorderRadius.circular( |
| 26 | child: BackdropFilter( |
| 27 | filter: ImageFilter.blur(sigmaX |
| 28 | child: Container( |
| 29 | padding: EdgeInsets.symmetric(horizontal |
| 30 | decoration: BoxDecoration( |
| 31 | color: Colors.black.withOpacity |
| 32 | borderRadius: BorderRadius.circular( |
| 33 | border: Border.all( |
| 34 | color: Colors.white.withOpacity |
| 35 | width: 1, |
| 36 | ), |
| 37 | ), |
| 38 | child: Row( |
| 39 | mainAxisSize: MainAxisSize.min, |
| 40 | children: [ |
| 41 | Row( |
| 42 | mainAxisSize: MainAxisSize.min, |
| 43 | children: [ |
| 44 | AnimatedFlipCounter( |
| 45 | value: widget.altitude, |
| 46 | duration: Duration(milliseconds: 500 |
| 47 | textStyle: TextStyle( |
| 48 | color: Colors.white, |
| 49 | fontSize: 13, |
| 50 | fontWeight: FontWeight.bold, |
| 51 | letterSpacing: 0.5, |
| 52 | ), |
| 53 | ), |
| 54 | Text( |
| 55 | ' ft', |
| 56 | style: TextStyle( |
| 57 | color: Colors.white, |
| 58 | fontSize: 13, |
| 59 | fontWeight: FontWeight.bold, |
| 60 | letterSpacing: 0.5, |
| 61 | ), |
| 62 | ), |
| 63 | ], |
| 64 | ), |
| 65 | Padding( |
| 66 | padding: EdgeInsets.symmetric(horizontal |
| 67 | child: Text( |
| 68 | '•', |
| 69 | style: TextStyle( |
| 70 | color: Colors.white.withOpacity |
| 71 | fontSize: 12, |
| 72 | fontWeight: FontWeight.bold, |
| 73 | ), |
| 74 | ), |
| 75 | ), |
| 76 | Row( |
| 77 | mainAxisSize: MainAxisSize.min, |
| 78 | children: [ |
| 79 | AnimatedFlipCounter( |
| 80 | value: widget.speed, |
| 81 | duration: Duration(milliseconds: 500 |
| 82 | textStyle: TextStyle( |
| 83 | color: Colors.white, |
| 84 | fontSize: 13, |
| 85 | fontWeight: FontWeight.bold, |
| 86 | letterSpacing: 0.5, |
| 87 | ), |
| 88 | ), |
| 89 | Text( |
| 90 | ' kts', |
| 91 | style: TextStyle( |
| 92 | color: Colors.white, |
| 93 | fontSize: 13, |
| 94 | fontWeight: FontWeight.bold, |
| 95 | letterSpacing: 0.5, |
| 96 | ), |
| 97 | ), |
| 98 | ], |
| 99 | ), |
| 100 | if (widget.heading != null) ... |
| 101 | Padding( |
| 102 | padding: EdgeInsets.symmetric(horizontal |
| 103 | child: Text( |
| 104 | '•', |
| 105 | style: TextStyle( |
| 106 | color: Colors.white.withOpacity |
| 107 | fontSize: 12, |
| 108 | fontWeight: FontWeight.bold, |
| 109 | ), |
| 110 | ), |
| 111 | ), |
| 112 | Row( |
| 113 | mainAxisSize: MainAxisSize.min, |
| 114 | children: [ |
| 115 | AnimatedFlipCounter( |
| 116 | value: widget.heading!, |
| 117 | duration: Duration(milliseconds: 500 |
| 118 | textStyle: TextStyle( |
| 119 | color: Colors.white, |
| 120 | fontSize: 13, |
| 121 | fontWeight: FontWeight.bold, |
| 122 | letterSpacing: 0.5, |
| 123 | ), |
| 124 | ), |
| 125 | Text( |
| 126 | '°', |
| 127 | style: TextStyle( |
| 128 | color: Colors.white, |
| 129 | fontSize: 13, |
| 130 | fontWeight: FontWeight.bold, |
| 131 | letterSpacing: 0.5, |
| 132 | ), |
| 133 | ), |
| 134 | ], |
| 135 | ), |
| 136 | ], |
| 137 | ], |
| 138 | ), |
| 139 | ), |
| 140 | ), |
| 141 | ); |
| 142 | } |
| 143 | } |
| 144 | |