import 'package:animated_flip_counter/animated_flip_counter.dart'; import 'package:flutter/material.dart'; import 'dart:ui'; class AnimatedFlightInfoBar extends StatefulWidget { final int altitude; final int speed; final int? heading; const AnimatedFlightInfoBar({ super.key, required this.altitude, required this.speed, this.heading, }); @override State createState() => _AnimatedFlightInfoBarState(); } class _AnimatedFlightInfoBarState extends State { @override Widget build(BuildContext context) { return ClipRRect( borderRadius: BorderRadius.circular(20), child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), child: Container( padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), decoration: BoxDecoration( color: Colors.black.withOpacity(0.5), borderRadius: BorderRadius.circular(20), border: Border.all( color: Colors.white.withOpacity(0.3), width: 1, ), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ AnimatedFlipCounter( value: widget.altitude, duration: Duration(milliseconds: 500), textStyle: TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold, letterSpacing: 0.5, ), ), Text( ' ft', style: TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold, letterSpacing: 0.5, ), ), ], ), Padding( padding: EdgeInsets.symmetric(horizontal: 8), child: Text( '•', style: TextStyle( color: Colors.white.withOpacity(0.8), fontSize: 12, fontWeight: FontWeight.bold, ), ), ), Row( mainAxisSize: MainAxisSize.min, children: [ AnimatedFlipCounter( value: widget.speed, duration: Duration(milliseconds: 500), textStyle: TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold, letterSpacing: 0.5, ), ), Text( ' kts', style: TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold, letterSpacing: 0.5, ), ), ], ), if (widget.heading != null) ...[ Padding( padding: EdgeInsets.symmetric(horizontal: 8), child: Text( '•', style: TextStyle( color: Colors.white.withOpacity(0.8), fontSize: 12, fontWeight: FontWeight.bold, ), ), ), Row( mainAxisSize: MainAxisSize.min, children: [ AnimatedFlipCounter( value: widget.heading!, duration: Duration(milliseconds: 500), textStyle: TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold, letterSpacing: 0.5, ), ), Text( '°', style: TextStyle( color: Colors.white, fontSize: 13, fontWeight: FontWeight.bold, letterSpacing: 0.5, ), ), ], ), ], ], ), ), ), ); } }