// 1、配置路由
import 'package:flutter/material.dart';

import 'pages/Tabs.dart';

import 'pages/Search.dart';
import 'pages/Form.dart';

void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// home:Tabs(),
initialRoute: '/',
routes: {
'/':(contxt)=>Tabs(),
'/search':(contxt) =>SearchPage(),
'/form': (context) => FormPage(),
},
);
}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 2、路由跳转
RaisedButton(
child: Text("跳转到搜索页面"),
onPressed: (){
Navigator.pushNamed(context, '/search');
},
color: Theme.of(context).accentColor,
textTheme: ButtonTextTheme.primary
)
————————————————

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-09-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-20
  • 2021-08-03
  • 2021-06-14
  • 2021-10-04
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案