Пример #1
0
        public override Widget build(BuildContext context)
        {
            DialogTheme dialogTheme = DialogTheme.of(context);

            return(new AnimatedPadding(
                       padding: MediaQuery.of(context).viewInsets + EdgeInsets.symmetric(horizontal: 40.0f, vertical: 24.0f),
                       duration: this.insetAnimationDuration,
                       curve: this.insetAnimationCurve,
                       child: MediaQuery.removeViewInsets(
                           removeLeft: true,
                           removeTop: true,
                           removeRight: true,
                           removeBottom: true,
                           context: context,
                           child: new Center(
                               child: new ConstrainedBox(
                                   constraints: new BoxConstraints(minWidth: 280.0f),
                                   child: new Material(
                                       color: this.backgroundColor ?? dialogTheme.backgroundColor ??
                                       Theme.of(context).dialogBackgroundColor,
                                       elevation: this.elevation ?? dialogTheme.elevation ?? _defaultElevation,
                                       shape: this.shape ?? dialogTheme.shape ?? _defaultDialogShape,
                                       type: MaterialType.card,
                                       child: this.child
                                       )
                                   )
                               )
                           )
                       ));
        }
Пример #2
0
        public override Widget build(BuildContext context)
        {
            DialogTheme dialogTheme      = DialogTheme.of(context);
            EdgeInsets  effectivePadding = MediaQuery.of(context).viewInsets + (insetPadding ?? EdgeInsets.all(0.0f));

            return(new AnimatedPadding(
                       padding: effectivePadding,
                       duration: insetAnimationDuration,
                       curve: insetAnimationCurve,
                       child: MediaQuery.removeViewInsets(
                           removeLeft: true,
                           removeTop: true,
                           removeRight: true,
                           removeBottom: true,
                           context: context,
                           child: new Center(
                               child: new ConstrainedBox(
                                   constraints: new BoxConstraints(minWidth: 280.0f),
                                   child: new Material(
                                       color: backgroundColor ?? dialogTheme.backgroundColor ??
                                       Theme.of(context).dialogBackgroundColor,
                                       elevation: elevation ?? dialogTheme.elevation ?? _defaultElevation,
                                       shape: shape ?? dialogTheme.shape ?? _defaultDialogShape,
                                       type: MaterialType.card,
                                       clipBehavior: clipBehavior,
                                       child: child
                                       )
                                   )
                               )
                           )
                       ));
        }
Пример #3
0
        public override Widget build(BuildContext context)
        {
            // D.assert(debugCheckHasMaterialLocalizations(context));

            ThemeData   theme       = Theme.of(context);
            DialogTheme dialogTheme = DialogTheme.of(context);

            List <Widget> children = new List <Widget>();

            if (this.title != null)
            {
                children.Add(new Padding(
                                 padding: this.titlePadding ??
                                 EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, this.content == null ? 20.0f : 0.0f),
                                 child: new DefaultTextStyle(
                                     style: this.titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.title,
                                     child: this.title
                                     )
                                 ));
            }

            if (this.content != null)
            {
                children.Add(new Flexible(
                                 child: new Padding(
                                     padding: this.contentPadding,
                                     child: new DefaultTextStyle(
                                         style: this.contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subhead,
                                         child: this.content
                                         )
                                     )
                                 ));
            }

            if (this.actions != null)
            {
                children.Add(ButtonTheme.bar(
                                 child: new ButtonBar(
                                     children: this.actions
                                     )
                                 ));
            }

            Widget dialogChild = new IntrinsicWidth(
                child: new Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: children
                    )
                );

            return(new Dialog(
                       backgroundColor: this.backgroundColor,
                       elevation: this.elevation,
                       shape: this.shape,
                       child: dialogChild
                       ));
        }
Пример #4
0
        public override Widget build(BuildContext context)
        {
            D.assert(material_.debugCheckHasMaterialLocalizations(context));

            ThemeData   theme       = Theme.of(context);
            DialogTheme dialogTheme = DialogTheme.of(context);

            Widget titleWidget   = null;
            Widget contentWidget = null;
            Widget actionsWidget = null;

            if (title != null)
            {
                titleWidget = new Padding(
                    padding: titlePadding ?? EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, content == null ? 20.0f : 0.0f),
                    child: new DefaultTextStyle(
                        style: titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.headline6,
                        child: title
                        )
                    );
            }

            if (content != null)
            {
                contentWidget = new Padding(
                    padding: contentPadding,
                    child: new DefaultTextStyle(
                        style: contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subtitle1,
                        child: content
                        )
                    );
            }

            if (actions != null)
            {
                actionsWidget = new Padding(
                    padding: actionsPadding,
                    child: new ButtonBar(
                        buttonPadding: buttonPadding,
                        overflowDirection: actionsOverflowDirection,
                        overflowButtonSpacing: actionsOverflowButtonSpacing,
                        children: actions
                        )
                    );
            }

            List <Widget> columnChildren;

            if (scrollable)
            {
                var titleList = new List <Widget>();

                if (title != null)
                {
                    titleList.Add(titleWidget);
                }

                if (content != null)
                {
                    titleList.Add(contentWidget);
                }

                columnChildren = new List <Widget>();

                if (title != null || content != null)
                {
                    columnChildren.Add(new Flexible(
                                           child: new SingleChildScrollView(
                                               child: new Column(
                                                   mainAxisSize: MainAxisSize.min,
                                                   crossAxisAlignment: CrossAxisAlignment.stretch,
                                                   children: titleList
                                                   )
                                               )
                                           ));
                }

                if (actions != null)
                {
                    columnChildren.Add(actionsWidget);
                }
            }
            else
            {
                columnChildren = new List <Widget>();
                if (title != null)
                {
                    columnChildren.Add(titleWidget);
                }

                if (content != null)
                {
                    columnChildren.Add(new Flexible(child: contentWidget));
                }

                if (actions != null)
                {
                    columnChildren.Add(actionsWidget);
                }
            }

            Widget dialogChild = new IntrinsicWidth(
                child: new Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: columnChildren
                    )
                );

            return(new Dialog(
                       backgroundColor: backgroundColor,
                       elevation: elevation,
                       insetPadding: insetPadding,
                       clipBehavior: clipBehavior,
                       shape: shape,
                       child: dialogChild
                       ));
        }