12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import 'package:flutter/material.dart';
- import 'package:flutter_provider_demo/index_page.dart';
- import 'package:flutter_provider_demo/pages/addpage_page.dart';
- /// Description: routes
- /// Time : 09/03/2023 Sunday
- /// Author : liuyuqi.gov@msn.cn
- class Routes {
- static const String home = '/';
- static const String index = '/index';
- static const String login = '/login';
- static const String carAdd = "/carAdd";
- static MaterialPageRoute<dynamic> generateRoute(RouteSettings settings) {
- switch (settings.name) {
- case home:
- return MaterialPageRoute<dynamic>(
- builder: (_) => const Scaffold(),
- settings: settings,
- );
- case index:
- return MaterialPageRoute<dynamic>(
- builder: (_) => const IndexPage(),
- settings: settings,
- );
- case login:
- return MaterialPageRoute<dynamic>(
- builder: (_) => const IndexPage(),
- settings: settings,
- );
- case carAdd:
- return MaterialPageRoute<dynamic>(
- builder: (_) => const AddcardPage(),
- settings: settings,
- );
- default:
- return MaterialPageRoute<dynamic>(
- builder: (_) => const Scaffold(),
- settings: settings,
- );
- }
- }
- void go(BuildContext context, String routeName) {
- Navigator.pushNamed(context, routeName);
- }
- }
|