Flutter之CupertinoPageScaffold和CupertinoNavigationBar组件

/**
 *  ios风格的页面基本布局结构,包括导航栏和内容栏
 *
 * const CupertinoPageScaffold({
    Key key,
    this.navigationBar,顶部导航栏
    this.backgroundColor = CupertinoColors.white,//背景色
    this.resizeToAvoidBottomInset = true,
    @required this.child,//内容栏
    })
 */
/**
 *  iOS风格导航栏
 *
 * const CupertinoNavigationBar({
    Key key,
    this.leading,//导航栏左侧组件,leading优先级高于previousPageTitle
    this.automaticallyImplyLeading = true,//是否显示左边组件
    this.automaticallyImplyMiddle = true,//是否显示中间组件,好像无效
    this.previousPageTitle,//导航栏左侧组件的右边的文本
    this.middle,////导航栏中间组件
    this.trailing,////导航栏右侧组件
    this.border = _kDefaultNavBarBorder,//
    this.backgroundColor = _kDefaultNavBarBackgroundColor,//背景色
    this.padding,//
    this.actionsForegroundColor = CupertinoColors.activeBlue,//左侧默认组件和左侧组件右边文本的颜色
    this.transitionBetweenRoutes = true,//
    this.heroTag = _defaultHeroTag,//transitionBetweenRoutes:false时才能设置
    })
 */
return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
          middle: Text("标题"),
          trailing: Image.asset("images/app.png", width: 25.0, height: 25.0,),
          backgroundColor: Color(0xfff1f1f1),
          previousPageTitle: "返回",
          actionsForegroundColor: Colors.red,
//        automaticallyImplyLeading: false,
          automaticallyImplyMiddle: false,
//          transitionBetweenRoutes:false,
//          heroTag: Text("aa")
      ),
      child: Center(
        child: Text("CupertinoPageScaffold页面",
          style: TextStyle(
            color: Colors.black,
            fontSize: 15.0,
            decoration: TextDecoration.none,
          ),
        ),
      ),
    );

码云地址:https://gitee.com/xgljh/Flutter.git

你可能感兴趣的:(Flutter之CupertinoPageScaffold和CupertinoNavigationBar组件)