getPages
这是我的getRoutesclass
import 'package:flutter/material.dart';
import 'package:todos/routes.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
fontFamily: "Poppins"
),
initialRoute: GetRoutes.login,
getPages: GetRoutes.routes, //This line here isn't defined
);
}
}
改变到class GetRoutes{
static const String login = "/login";
static const String signup = "/signup";
static const String home = "/home";
static List<GetPage> routes = [
GetPage(
name: GetRoutes.login,
page: () => const LoginScreen()
),
GetPage(
name: GetRoutes.signup,
page: () => const SignupScreen(),
),
];
}
MaterialApp
GetMaterialApp
@override
Widget build(BuildContext context) {
return GetMaterialApp(