Instantly share code, notes, and snippets.

Embed
What would you like to do?
class TicketsPage extends StatefulWidget {
@override
_TicketsPageState createState() => _TicketsPageState();
}
class _TicketsPageState extends State<TicketsPage>
with TickerProviderStateMixin {
List<FlightStopTicket> stops = [
new FlightStopTicket("Sahara", "SHE", "Macao", "MAC", "SE2341"),
new FlightStopTicket("Macao", "MAC", "Cape Verde", "CAP", "KU2342"),
new FlightStopTicket("Cape Verde", "CAP", "Ireland", "IRE", "KR3452"),
new FlightStopTicket("Ireland", "IRE", "Sahara", "SHE", "MR4321"),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: new Stack(
children: <Widget>[
AirAsiaBar(height: 180.0,),
Positioned.fill(
top: MediaQuery.of(context).padding.top + 64.0,
child: SingleChildScrollView(
child: new Column(
children: _buildTickets().toList(),
),
),
)
],
),
floatingActionButton: _buildFab(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
}
Iterable<Widget> _buildTickets() {
return stops.map((stop) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
child: TicketCard(stop: stop),
);
});
}
_buildFab() {
return FloatingActionButton(
onPressed: () => Navigator.of(context).pop(),
child: new Icon(Icons.fingerprint),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment