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 generateRoute(RouteSettings settings) { switch (settings.name) { case home: return MaterialPageRoute( builder: (_) => const Scaffold(), settings: settings, ); case index: return MaterialPageRoute( builder: (_) => const IndexPage(), settings: settings, ); case login: return MaterialPageRoute( builder: (_) => const IndexPage(), settings: settings, ); case carAdd: return MaterialPageRoute( builder: (_) => const AddcardPage(), settings: settings, ); default: return MaterialPageRoute( builder: (_) => const Scaffold(), settings: settings, ); } } void go(BuildContext context, String routeName) { Navigator.pushNamed(context, routeName); } }