【发布时间】:2020-02-07 04:25:39
【问题描述】:
如果我使用命名路由和初始路由,则无法使用 home 参数,这是否意味着我必须在我为应用创建的每个新屏幕上创建 Scaffold 和 Material App Widget?
【问题讨论】:
标签: android mobile flutter flutter-layout
如果我使用命名路由和初始路由,则无法使用 home 参数,这是否意味着我必须在我为应用创建的每个新屏幕上创建 Scaffold 和 Material App Widget?
【问题讨论】:
标签: android mobile flutter flutter-layout
不,你不知道。举个例子
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 上。
【讨论】: