如果我使用命名路线和初始路线,则不能使用home参数,这是否意味着我必须在我为应用创建的每个新屏幕上创建“脚手架和材料应用”小部件?
答案 0 :(得分:0)
不,你不知道。给出示例
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: 'inicio',
routes: <String, WidgetBuilder>{
'tabs': (BuildContext context) => TabsPage(),
'eventos': (BuildContext context) => EventosPage(),
'agenda': (BuildContext context) => AgendaPage(),
'sobre': (BuildContext context) => SobrePage(),
'palestrantes': (BuildContext context) => PalestrantesPage(),
'inicio': (BuildContext context) => InicioPage(),
'hoteis': (BuildContext context) => HoteisPage(),
'restaurantes': (BuildContext context) => RestaurantesPage(),
'info': (BuildContext context) => InfoPage(),
'homeParticipante': (BuildContext context) => HomeParticipante(),
'qr': (BuildContext context) => QrPage(),
},
title: 'Siepex App',
);
}
每条路线都会返回一个小部件(通常是脚手架),并将其作为子级安装在materialApp上。