Flutter设置TargetPlatform.iOS
new MaterialApp(
title: 'Mian',
theme: new ThemeData(
primarySwatch: Colors.orange,
platform: TargetPlatform.iOS,
)
)
可以跳过关闭页面。
Flutter设置TargetPlatform.android
new MaterialApp(
title: 'Mian',
theme: new ThemeData(
primarySwatch: Colors.orange,
platform: TargetPlatform.android,
)
)
无法跳过关闭页面。
答案 0 :(得分:2)
您可以在按下CupertinoPageRoute
时使用Widget
进行操作。
首先,您必须导入cupertino:
import 'package:flutter/cupertino.dart';
然后使用Navigator
:
Navigator.of(context)
.push(CupertinoPageRoute(builder: (context) => YourNewWidgetPage()));
答案 1 :(得分:0)
通过阅读文章,我有新的答案要更新,这种方式更加友好。
enter code class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
pageTransitionsTheme: PageTransitionsTheme(builders: {
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
})),
routes: {
"/": (BuildContext context) =>
MyHomePage(title: 'Flutter Demo Home Page'),
"/two": (BuildContext context) => TwoPage(),
},
);
}
}
感谢Arvinth的文章:https://medium.com/flutter-community/page-transitions-using-themedata-in-flutter-c24afadb0b5d