SHARE
TWEET

Untitled

a guest Oct 17th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/rendering.dart';
  3. import 'ListPage.dart';
  4. import 'TextPage.dart';
  5. import 'RootPage.dart';
  6. import 'GamesPage.dart';
  7.  
  8. class Destination {
  9.   const Destination(this.index, this.title, this.icon, this.color);
  10.   final int index;
  11.   final String title;
  12.   final IconData icon;
  13.   final MaterialColor color;
  14. }
  15.  
  16. const List<Destination> allDestinations = <Destination>[
  17.   Destination(0, 'Feed', Icons.home, Colors.blue),
  18.   Destination(1, 'Games', Icons.gamepad, Colors.blue),
  19.   Destination(2, 'World League', Icons.star, Colors.blue),
  20.   Destination(3, 'Your Leagues', Icons.star, Colors.blue),
  21.   Destination(4, 'Profile', Icons.person, Colors.blue),
  22. ];
  23.  
  24. class DestinationView extends StatefulWidget {
  25.   const DestinationView({ Key key, this.destination }) : super(key: key);
  26.  
  27.   final Destination destination;
  28.  
  29.   @override
  30.   _DestinationViewState createState() => _DestinationViewState();
  31. }
  32.  
  33. class _DestinationViewState extends State<DestinationView> {
  34.   @override
  35.   Widget build(BuildContext context) {
  36.     return Navigator(
  37.       onGenerateRoute: (RouteSettings settings) {
  38.         return MaterialPageRoute(
  39.           settings: settings,
  40.           builder: (BuildContext context) {
  41.             switch(settings.name) {
  42.               case '/':
  43.                 return RootPage(destination: widget.destination);
  44.               case '/list':
  45.                 return ListPage(destination: widget.destination);
  46.               case '/text':
  47.                 return TextPage(destination: widget.destination);
  48.             }
  49.           },
  50.         );
  51.       },
  52.     );
  53.   }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top