【发布时间】:2018-08-08 21:16:35
【问题描述】:
我想通过简单的向左滑动来改变一个窗口,我需要 2 个窗口,当用户向右滑动时,我想改变我的路线。
我正在使用命名路由。
void main() => runApp(new HeatMapApp());
class HeatMapApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'HeatMap',
initialRoute: '/',
routes: {
'/': (context) => new Main(),
'/home': (context) => new Home()
},
theme: new ThemeData(
primaryColor: Colors.black
)
);
}
}
这是我在我的应用程序中的代码,主文件现在没有太多数据,我想知道滑动事件重定向到'home'路径。
Main.dart
class Main extends StatelessWidget {
final bool _isLoggedIn = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _isLoggedIn ? AppBar (
title: Text('Logged In')
) : null,
body: Center(
child: Text('Hello World!')
)
);
}
}
【问题讨论】: