美文网首页
Flutter之Cupertino (iOS风格) Widget

Flutter之Cupertino (iOS风格) Widget

作者: 笑破天 | 来源:发表于2020-08-21 15:23 被阅读0次
    1、按钮CupertinoButton
    /// Creates an iOS-style button.
      const CupertinoButton({
        Key key,
        @required this.child,//通常是一个Text
        this.padding,//内边距,默认16
        this.color,
        this.disabledColor = CupertinoColors.quaternarySystemFill,
        this.minSize = kMinInteractiveDimensionCupertino,//最小尺寸,默认44
        this.pressedOpacity = 0.4,//按下时透明度,默认0.4
        this.borderRadius = const BorderRadius.all(Radius.circular(8.0)),//圆角,默认8
        @required this.onPressed,//点击事件,为空时禁用
      })
    
    2、对话框CupertinoAlertDialog
    /// Creates an iOS-style alert dialog.
      const CupertinoAlertDialog({
        Key key,
        this.title,
        this.content,
        this.actions = const <Widget>[],//不能为空
        this.scrollController,
        this.actionScrollController,
        this.insetAnimationDuration = const Duration(milliseconds: 100),
        this.insetAnimationCurve = Curves.decelerate,
      })
    
    CupertinoAlertDialog(
                              title: Text("温馨提示"),
                              content: SingleChildScrollView(
                                //对话框内容部分
                                child: ListBody(
                                  children: [
                                    Text('是否要删除?'),
                                    Text('一旦删除数据不可恢复!'),
                                  ],
                                ),
                              ),
                              actions: <Widget>[
                                CupertinoDialogAction(
                                  child: Text("取消"),
                                  onPressed: () {
                                    Navigator.pop(context);
                                    print("取消");
                                  },
                                ),
                                CupertinoDialogAction(
                                  child: Text("确定"),
                                  onPressed: () {
                                    print("确定");
                                  },
                                ),
                              ],
                            );
    
    3、Widges列表
    1.App结构相关:

    CupertinoApp
    CupertinoPageScaffold
    CupertinoNavigationBar
    CupertinoTabBar
    CupertinoTabController
    CupertinoTabScaffold
    CupertinoTabView

    2.UI相关

    CupertinoButton
    CupertinoActionSheet
    CupertinoActionSheetAction
    CupertinoActivityIndicator
    CupertinoContextMenu/CupertinoContextMenuAction
    CupertinoDatePicker
    CupertinoAlertDialog/CupertinoDialogAction
    CupertinoUserInterfaceLevel
    CupertinoPicker
    CupertinoSliverRefreshControl
    CupertinoScrollbar
    CupertinoSegmentedControl
    CupertinoSlider
    CupertinoSlidingSegmentedControl
    CupertinoSwitch
    CupertinoTextField
    CupertinoTextSelectionToolbar

    3.其他:

    CupertinoPageRoute
    CupertinoTextThemeData
    CupertinoTheme
    CupertinoThumbPainter
    CupertinoDynamicColor

    官网https://flutterchina.club/widgets/cupertino/

    相关文章

      网友评论

          本文标题:Flutter之Cupertino (iOS风格) Widget

          本文链接:https://www.haomeiwen.com/subject/wpkujktx.html