-
-
Save MarcinusX/2d5ab1a818cec54ff7bb5f36274c6abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _PriceTabState extends State<PriceTab> with TickerProviderStateMixin { | |
final List<FlightStop> _flightStops = [ | |
FlightStop("JFK", "ORY", "JUN 05", "6h 25m", "\$851", "9:26 am - 3:43 pm"), | |
FlightStop("MRG", "FTB", "JUN 20", "6h 25m", "\$532", "9:26 am - 3:43 pm"), | |
FlightStop("ERT", "TVS", "JUN 20", "6h 25m", "\$718", "9:26 am - 3:43 pm"), | |
FlightStop("KKR", "RTY", "JUN 20", "6h 25m", "\$663", "9:26 am - 3:43 pm"), | |
]; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
width: double.infinity, | |
child: Stack( | |
alignment: Alignment.center, | |
children: <Widget>[_buildPlane()] | |
..addAll(_flightStops.map(_buildStopCard)) | |
..addAll(_flightStops.map(_mapFlightStopToDot)), | |
), | |
); | |
} | |
Widget _buildStopCard(FlightStop stop) { | |
int index = _flightStops.indexOf(stop); | |
double topMargin = _dotPositions[index].value - | |
0.5 * (FlightStopCard.height - AnimatedDot.size); | |
bool isLeft = index.isOdd; | |
return Align( | |
alignment: Alignment.topCenter, | |
child: Padding( | |
padding: EdgeInsets.only(top: topMargin), | |
child: Row( | |
mainAxisSize: MainAxisSize.max, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
isLeft ? Container() : Expanded(child: Container()), | |
Expanded( | |
child: FlightStopCard( | |
flightStop: stop, | |
isLeft: isLeft, | |
), | |
), | |
!isLeft ? Container() : Expanded(child: Container()), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment