iOS风格应用的顶级组件,包含路由生成器、主题、语言、主页等属性。

相关组件

CupertinoPageScaffold CupertinoTabScaffold

CupertinoApp基本用法

  1. <br />【theme】 : 主题 【ThemeData】<br />【title】 : 任务栏标题 【String】<br />【onGenerateRoute】 : 路由生成器 【RouteFactory】<br />【home】 : 主页 【Widget】<br />![image.png](https://cdn.nlark.com/yuque/0/2020/png/326147/1589450006965-70cbb4f7-1438-4059-a6bf-20c25113656b.png#align=left&display=inline&height=553&margin=%5Bobject%20Object%5D&name=image.png&originHeight=553&originWidth=402&size=16745&status=done&style=none&width=402)
import 'package:flutter/cupertino.dart';
class CustomCupertinoApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height - 200,
      child: CupertinoApp(
        title: 'Flutter Demo',
        theme: CupertinoThemeData(
          primaryColor: CupertinoColors.white,
        ),
        home: CupertinoPageScaffold(
          navigationBar: CupertinoNavigationBar(
            leading: Icon(
              CupertinoIcons.reply,
              color: CupertinoColors.black,
            ),
            trailing: Icon(
              CupertinoIcons.share,
              color: CupertinoColors.black,
            ),
            middle: Text('Flutter Unit'),
          ),
          backgroundColor: CupertinoColors.systemBackground,
          child: Center(
            child: Text('Hello, World!'),
          ),
        ),
      ),
    );
  }
}