Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:flutter/rendering.dart';
- import 'ListPage.dart';
- import 'TextPage.dart';
- import 'RootPage.dart';
- class Destination {
- const Destination(this.title, this.icon, this.color);
- final String title;
- final IconData icon;
- final MaterialColor color;
- }
- const List<Destination> allDestinations = <Destination>[
- Destination('Feed', Icons.home, Colors.blue),
- Destination('Games', Icons.gamepad, Colors.blue),
- Destination('World League', Icons.star, Colors.blue),
- Destination('Your Leagues', Icons.star, Colors.blue),
- Destination('Profile', Icons.person, Colors.blue),
- ];
- class DestinationView extends StatefulWidget {
- const DestinationView({ Key key, this.destination }) : super(key: key);
- final Destination destination;
- @override
- _DestinationViewState createState() => _DestinationViewState();
- }
- class _DestinationViewState extends State<DestinationView> {
- @override
- Widget build(BuildContext context) {
- return Navigator(
- onGenerateRoute: (RouteSettings settings) {
- return MaterialPageRoute(
- settings: settings,
- builder: (BuildContext context) {
- switch(settings.name) {
- case '/':
- return RootPage(destination: widget.destination);
- case '/list':
- return ListPage(destination: widget.destination);
- case '/text':
- return TextPage(destination: widget.destination);
- }
- },
- );
- },
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement