2

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,
  )
)

无法跳过关闭页面。

4

2 回答 2

2

您可以CupertinoPageRoute在按下Widget.

首先你必须导入 cupertino:

import 'package:flutter/cupertino.dart';

然后使用Navigator

Navigator.of(context)
            .push(CupertinoPageRoute(builder: (context) => YourNewWidgetPage()));
于 2018-09-08T05:38:38.543 回答
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(),
  },
);
}
}

演示 Gif

感谢 Arvinth 的文章:https ://medium.com/flutter-community/page-transitions-using-themedata-in-flutter-c24afadb0b5d

于 2020-05-19T02:52:12.837 回答