예제 #1
0
 public ButtonBar(
     Key key = null,
     MainAxisAlignment alignment     = MainAxisAlignment.end,
     MainAxisSize mainAxisSize       = MainAxisSize.max,
     ButtonTextTheme?buttonTextTheme = null,
     float?buttonMinWidth            = null,
     float?buttonHeight = null,
     EdgeInsetsGeometry buttonPadding       = null,
     bool?buttonAlignedDropdown             = null,
     ButtonBarLayoutBehavior?layoutBehavior = null,
     VerticalDirection?overflowDirection    = null,
     float?overflowButtonSpacing            = null,
     List <Widget> children = null
     ) : base(key: key)
 {
     D.assert(buttonMinWidth == null || buttonMinWidth >= 0.0f);
     D.assert(buttonHeight == null || buttonHeight >= 0.0f);
     D.assert(overflowButtonSpacing == null || overflowButtonSpacing >= 0.0f);
     this.alignment             = alignment;
     this.mainAxisSize          = mainAxisSize;
     this.buttonTextTheme       = buttonTextTheme;
     this.buttonMinWidth        = buttonMinWidth;
     this.buttonHeight          = buttonHeight;
     this.buttonPadding         = buttonPadding;
     this.buttonAlignedDropdown = buttonAlignedDropdown;
     this.layoutBehavior        = layoutBehavior;
     this.overflowDirection     = overflowDirection;
     this.overflowButtonSpacing = overflowButtonSpacing;
     this.children = children ?? new List <Widget>();
 }
예제 #2
0
 public ScrollList(
     [NotNull] List <Widget> children,
     [CanBeNull] Key key = null,
     CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.Start,
     MainAxisAlignment mainAxisAlignment   = MainAxisAlignment.Start
     ) : base(children, key)
 {
     CrossAxisAlignment = crossAxisAlignment;
     MainAxisAlignment  = mainAxisAlignment;
 }
예제 #3
0
 public ButtonBar(
     Key key = null,
     MainAxisAlignment alignment = MainAxisAlignment.end,
     MainAxisSize mainAxisSize   = MainAxisSize.max,
     List <Widget> children      = null
     ) : base(key: key)
 {
     this.alignment    = alignment;
     this.mainAxisSize = mainAxisSize;
     this.children     = children ?? new List <Widget>();
 }
예제 #4
0
파일: Column.cs 프로젝트: Mefodei/UniMob
 public Column(
     [NotNull] List <Widget> children,
     [CanBeNull] Key key = null,
     CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.Start,
     MainAxisAlignment mainAxisAlignment   = MainAxisAlignment.Start,
     AxisSize crossAxisSize = AxisSize.Min,
     AxisSize mainAxisSize  = AxisSize.Min
     ) : base(
         children,
         key
         )
 {
     CrossAxisAlignment = crossAxisAlignment;
     MainAxisAlignment  = mainAxisAlignment;
     CrossAxisSize      = crossAxisSize;
     MainAxisSize       = mainAxisSize;
 }
예제 #5
0
파일: GridFlow.cs 프로젝트: Mefodei/UniMob
 public GridFlow(
     [NotNull] List <Widget> children,
     [CanBeNull] Key key = null,
     CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.Start,
     MainAxisAlignment mainAxisAlignment   = MainAxisAlignment.Start,
     AxisSize crossAxisSize               = AxisSize.Min,
     AxisSize mainAxisSize                = AxisSize.Min,
     [CanBeNull] int?maxCrossAxisCount    = null,
     [CanBeNull] float?maxCrossAxisExtent = null)
     : base(children, key)
 {
     CrossAxisAlignment = crossAxisAlignment;
     MainAxisAlignment  = mainAxisAlignment;
     CrossAxisSize      = crossAxisSize;
     MainAxisSize       = mainAxisSize;
     MaxCrossAxisCount  = Math.Max(maxCrossAxisCount ?? int.MaxValue, 1);
     MaxCrossAxisExtent = Math.Max(maxCrossAxisExtent ?? float.MaxValue, 1);
 }
예제 #6
0
        public override Widget build(BuildContext context)
        {
            bool isLoggedInUser = sender == App.UserModel.Profile.Id;

            // messages from the current logged in user show up on the right, others on the left
            MainAxisAlignment align = isLoggedInUser ? MainAxisAlignment.end : MainAxisAlignment.start;

            List <Widget> childList = this.BuildChildList(context, isLoggedInUser);

            // we reverse the widget list so that the bubble appears to the left of the avatar image for the logged in user
            if (isLoggedInUser)
            {
                childList.Reverse();
            }

            return(new Row(
                       mainAxisAlignment: align,
                       children: childList
                       ));
        }
예제 #7
0
파일: flex.cs 프로젝트: wxFancer/UIWidgets
        public RenderFlex(
            List <RenderBox> children             = null,
            Axis direction                        = Axis.horizontal,
            MainAxisSize mainAxisSize             = MainAxisSize.max,
            MainAxisAlignment mainAxisAlignment   = MainAxisAlignment.start,
            CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
            TextDirection textDirection           = TextDirection.ltr,
            VerticalDirection verticalDirection   = VerticalDirection.down,
            TextBaseline textBaseline             = TextBaseline.alphabetic
            )
        {
            this._direction          = direction;
            this._mainAxisAlignment  = mainAxisAlignment;
            this._mainAxisSize       = mainAxisSize;
            this._crossAxisAlignment = crossAxisAlignment;
            this._textDirection      = textDirection;
            this._verticalDirection  = verticalDirection;
            this._textBaseline       = textBaseline;

            this.addAll(children);
        }
        private static TextAnchor ToTextAnchor(MainAxisAlignment main, CrossAxisAlignment cross)
        {
            switch (main)
            {
            case MainAxisAlignment.Center:
                return(cross == CrossAxisAlignment.Start ? TextAnchor.MiddleLeft
                        : cross == CrossAxisAlignment.Center ? TextAnchor.MiddleCenter
                        : TextAnchor.MiddleRight);

            case MainAxisAlignment.End:
                return(cross == CrossAxisAlignment.Start ? TextAnchor.LowerLeft
                        : cross == CrossAxisAlignment.Center ? TextAnchor.LowerCenter
                        : TextAnchor.LowerRight);

            case MainAxisAlignment.Start:
                return(cross == CrossAxisAlignment.Start ? TextAnchor.UpperLeft
                        : cross == CrossAxisAlignment.Center ? TextAnchor.UpperCenter
                        : TextAnchor.UpperRight);

            default:
                return(TextAnchor.UpperLeft);
            }
        }
예제 #9
0
 internal _ButtonBarRow(
     List <Widget> children,
     Axis direction                        = Axis.horizontal,
     MainAxisSize mainAxisSize             = MainAxisSize.max,
     MainAxisAlignment mainAxisAlignment   = MainAxisAlignment.start,
     CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
     TextDirection?textDirection           = null,
     VerticalDirection overflowDirection   = VerticalDirection.down,
     TextBaseline?textBaseline             = null,
     float?overflowButtonSpacing           = null
     ) : base(
         children: children,
         direction: direction,
         mainAxisSize: mainAxisSize,
         mainAxisAlignment: mainAxisAlignment,
         crossAxisAlignment: crossAxisAlignment,
         textDirection: textDirection,
         verticalDirection: overflowDirection,
         textBaseline: textBaseline
         )
 {
     this.overflowButtonSpacing = overflowButtonSpacing;
 }
예제 #10
0
 internal _RenderButtonBarRow(
     List <RenderBox> children             = null,
     Axis direction                        = Axis.horizontal,
     MainAxisSize mainAxisSize             = MainAxisSize.max,
     MainAxisAlignment mainAxisAlignment   = MainAxisAlignment.start,
     CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
     TextDirection textDirection           = TextDirection.ltr,
     VerticalDirection verticalDirection   = VerticalDirection.down,
     TextBaseline textBaseline             = TextBaseline.alphabetic,
     float?overflowButtonSpacing           = null
     ) : base(
         children: children,
         direction: direction,
         mainAxisSize: mainAxisSize,
         mainAxisAlignment: mainAxisAlignment,
         crossAxisAlignment: crossAxisAlignment,
         textDirection: textDirection,
         verticalDirection: verticalDirection,
         textBaseline: textBaseline
         )
 {
     D.assert(overflowButtonSpacing == null || overflowButtonSpacing >= 0);
     this.overflowButtonSpacing = overflowButtonSpacing;
 }
예제 #11
0
        public override Widget build(BuildContext context)
        {
            MaterialLocalizations localizations   = MaterialLocalizations.of(context);
            ThemeData             themeData       = Theme.of(context);
            TextTheme             headerTextTheme = themeData.primaryTextTheme;
            Color dayColor  = null;
            Color yearColor = null;

            switch (themeData.primaryColorBrightness)
            {
            case Brightness.light:
                dayColor  = this.mode == DatePickerMode.day ? Colors.black87 : Colors.black54;
                yearColor = this.mode == DatePickerMode.year ? Colors.black87 : Colors.black54;
                break;

            case Brightness.dark:
                dayColor  = this.mode == DatePickerMode.day ? Colors.white : Colors.white70;
                yearColor = this.mode == DatePickerMode.year ? Colors.white : Colors.white70;
                break;
            }

            TextStyle dayStyle        = headerTextTheme.display1.copyWith(color: dayColor, height: 1.4f);
            TextStyle yearStyle       = headerTextTheme.subhead.copyWith(color: yearColor, height: 1.4f);
            Color     backgroundColor = null;

            switch (themeData.brightness)
            {
            case Brightness.light:
                backgroundColor = themeData.primaryColor;
                break;

            case Brightness.dark:
                backgroundColor = themeData.backgroundColor;
                break;
            }

            float             width             = 0f;
            float             height            = 0f;
            EdgeInsets        padding           = null;
            MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center;

            switch (this.orientation)
            {
            case Orientation.portrait:
                height            = DatePickerUtils._kDatePickerHeaderPortraitHeight;
                padding           = EdgeInsets.symmetric(horizontal: 16.0f);
                mainAxisAlignment = MainAxisAlignment.center;
                break;

            case Orientation.landscape:
                width             = DatePickerUtils._kDatePickerHeaderLandscapeWidth;
                padding           = EdgeInsets.all(8.0f);
                mainAxisAlignment = MainAxisAlignment.start;
                break;
            }

            Widget yearButton = new IgnorePointer(
                ignoring: this.mode != DatePickerMode.day,
                child: new _DateHeaderButton(
                    color: backgroundColor,
                    onTap: Feedback.wrapForTap(() => this._handleChangeMode(DatePickerMode.year), context),
                    child: new Text(localizations.formatYear(this.selectedDate), style: yearStyle)
                    )
                );
            Widget dayButton = new IgnorePointer(
                ignoring: this.mode == DatePickerMode.day,
                child: new _DateHeaderButton(
                    color: backgroundColor,
                    onTap: Feedback.wrapForTap(() => this._handleChangeMode(DatePickerMode.day), context),
                    child: new Text(localizations.formatMediumDate(this.selectedDate), style: dayStyle)
                    )
                );

            return(new Container(
                       width: width,
                       height: height,
                       padding: padding,
                       color: backgroundColor,
                       child: new Column(
                           mainAxisAlignment: mainAxisAlignment,
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                yearButton, dayButton
            }
                           )
                       ));
        }