import 'package:flutter/material.dart';
import 'package:hyzp_ybqx/pages/Login/FaceLogin.dart';
import 'package:hyzp_ybqx/pages/Login/FaceReg.dart';
import 'package:hyzp_ybqx/pages/Login/LoginTabs2.dart';

//import '../pages/CheckOut.dart';
import '../pages/Address/AddressAdd.dart';
import '../pages/Address/AddressEdit.dart';
import '../pages/Address/AddressList.dart';
import '../pages/Login/ForgotPassword.dart';
//import '../pages/Login/TakePictuer.dart';
import '../pages/Login/TakePictuer.dart';
import '../pages/Order.dart';
import '../pages/OrderInfo.dart';
import '../pages/Pay.dart';
import '../pages/ProductList.dart';
import '../pages/RegisterFirst.dart';
import '../pages/RegisterSecond.dart';
import '../pages/RegisterThird.dart';
import '../pages/Search.dart';
// import '../pages/ProductContent.dart';
// import '../pages/tabs/Cart.dart';

import '../pages/tabs/Tabs.dart';
import '../pages/tabs/page_details.dart';

//配置路由
final routes = {
  '/': (context) => LoginTabs2(),
  '/tabs': (context, {arguments}) => Tabs(arguments: arguments),
  '/search': (context) => SearchPage(),
  //'/cart': (context) => CartPage(),

  '/forgotPassword': (context) => ForgotPassword(),
  '/faceReg_take_pictuer': (context, {arguments}) => TakePictuer(arguments: arguments),
  '/fackReg': (context, {arguments}) => FaceReg(arguments: arguments),

  '/faceLogin_take_pictuer': (context, {arguments}) => TakePictuer(arguments: arguments),
  '/fackLogin': (context, {arguments}) => FaceLogin(arguments: arguments),

  '/details': (context, {arguments}) => DetailsPage(arguments: arguments),

  '/registerFirst': (context) => RegisterFirstPage(),
  '/registerSecond': (context, {arguments}) => RegisterSecondPage(arguments: arguments),
  '/registerThird': (context, {arguments}) => RegisterThirdPage(arguments: arguments),
  '/productList': (context, {arguments}) => ProductListPage(arguments: arguments),
  //'/productContent': (context, {arguments}) => ProductContentPage(arguments: arguments),
  //'/checkOut': (context) => CheckOutPage(),
  '/addressAdd': (context) => AddressAddPage(),
  '/addressEdit': (context, {arguments}) => AddressEditPage(arguments: arguments),
  '/addressList': (context) => AddressListPage(),
  '/pay': (context) => PayPage(),
  '/order': (context) => OrderPage(),
  '/orderinfo': (context) => OrderInfoPage(),
  //'/page5player': (context, {arguments}) => PlayerPro(arguments: arguments),
};

//统一处理命名路由传参
//var onGenerateRoute = (RouteSettings settings) {
Route onGenerateRoute(RouteSettings settings) {
  String name = settings.name;
  Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      Route route = MaterialPageRoute(
          builder: (context) => pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      Route route = MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
}
