コード例 #1
0
ファイル: SplitView.cs プロジェクト: the6th/UIWidgets.AddOns
        public override Widget build(BuildContext context)
        {
            weight      = new ValueNotifier <float>(defaultWeight);
            _prevWeight = defaultWeight;

            return(new LayoutBuilder(
                       builder: (___, constraints) =>
            {
                return new ValueListenableBuilder <float>(
                    valueListenable: weight,
                    builder: (_, w, __) =>
                {
                    if (widget.onWeightChanged != null && _prevWeight != w)
                    {
                        _prevWeight = w;
                        widget.onWeightChanged(w);
                    }
                    if (widget.viewMode == SplitViewMode.Vertical)
                    {
                        return BuildVerticalView(context, constraints, w);
                    }
                    else
                    {
                        return BuildHorizontalView(context, constraints, w);
                    }
                }          //builder
                    );     //ValueListenableBuilder
            }
                       )); //LayoutBuilder
        }
コード例 #2
0
 public _AllSectionsView(
     Key key                             = null,
     int?sectionIndex                    = null,
     List <Section> sections             = null,
     ValueNotifier <float> selectedIndex = null,
     float?minHeight                     = null,
     float?midHeight                     = null,
     float?maxHeight                     = null,
     List <Widget> sectionCards          = null
     ) : base(key: key, listenable: selectedIndex)
 {
     sectionCards = sectionCards ?? new List <Widget>();
     D.assert(sections != null);
     D.assert(sectionCards.Count == sections.Count);
     D.assert(sectionIndex >= 0 && sectionIndex < sections.Count);
     D.assert(selectedIndex != null);
     D.assert(selectedIndex.value >= 0.0f && (float)selectedIndex.value < sections.Count);
     this.sectionIndex  = sectionIndex;
     this.sections      = sections;
     this.selectedIndex = selectedIndex;
     this.minHeight     = minHeight;
     this.midHeight     = midHeight;
     this.maxHeight     = maxHeight;
     this.sectionCards  = sectionCards;
 }
コード例 #3
0
ファイル: editable.cs プロジェクト: wxFancer/UIWidgets
        public RenderEditable(TextSpan text, TextDirection textDirection, ViewportOffset offset,
                              ValueNotifier <bool> showCursor,
                              TextAlign textAlign                = TextAlign.left, double textScaleFactor = 1.0, Color cursorColor = null,
                              bool?hasFocus                      = null, int?maxLines = 1, Color selectionColor = null,
                              TextSelection selection            = null, bool obscureText = false, SelectionChangedHandler onSelectionChanged = null,
                              CaretChangedHandler onCaretChanged = null, bool ignorePointer = false)
        {
            this._textPainter = new TextPainter(text: text, textAlign: textAlign, textDirection: textDirection,
                                                textScaleFactor: textScaleFactor);
            this._cursorColor       = cursorColor;
            this._showCursor        = showCursor ?? new ValueNotifier <bool>(false);
            this._hasFocus          = hasFocus ?? false;
            this._maxLines          = maxLines;
            this._selectionColor    = selectionColor;
            this._selection         = selection;
            this._obscureText       = obscureText;
            this._offset            = offset;
            this.ignorePointer      = ignorePointer;
            this.onCaretChanged     = onCaretChanged;
            this.onSelectionChanged = onSelectionChanged;

            D.assert(this._maxLines == null || this._maxLines > 0);
            D.assert(this._showCursor != null);
            D.assert(!this._showCursor.value || cursorColor != null);

            this._tap                   = new TapGestureRecognizer(this);
            this._doubleTap             = new DoubleTapGestureRecognizer(this);
            this._tap.onTapDown         = this._handleTapDown;
            this._tap.onTap             = this._handleTap;
            this._doubleTap.onDoubleTap = this._handleDoubleTap;
            this._longPress             = new LongPressGestureRecognizer(debugOwner: this);
            this._longPress.onLongPress = this._handleLongPress;
        }
コード例 #4
0
ファイル: editable_text.cs プロジェクト: zmtzawqlp/UIWidgets
 public _Editable(TextSpan textSpan                  = null, TextEditingValue value          = null,
                  Color cursorColor                  = null, ValueNotifier <bool> showCursor = null, bool hasFocus = false,
                  int?maxLines                       = null, Color selectionColor   = null, float textScaleFactor  = 1.0f,
                  TextDirection?textDirection        = null, bool obscureText       = false, TextAlign textAlign   = TextAlign.left,
                  bool autocorrect                   = false, ViewportOffset offset = null, SelectionChangedHandler onSelectionChanged = null,
                  CaretChangedHandler onCaretChanged = null, bool rendererIgnoresPointer = false,
                  Key key = null) : base(key)
 {
     this.textSpan               = textSpan;
     this.value                  = value;
     this.cursorColor            = cursorColor;
     this.showCursor             = showCursor;
     this.hasFocus               = hasFocus;
     this.maxLines               = maxLines;
     this.selectionColor         = selectionColor;
     this.textScaleFactor        = textScaleFactor;
     this.textAlign              = textAlign;
     this.textDirection          = textDirection;
     this.obscureText            = obscureText;
     this.autocorrect            = autocorrect;
     this.offset                 = offset;
     this.onSelectionChanged     = onSelectionChanged;
     this.onCaretChanged         = onCaretChanged;
     this.rendererIgnoresPointer = rendererIgnoresPointer;
 }
コード例 #5
0
 public LoadWrapper(
     bool up,
     ValueNotifier <int> modeListener = null,
     bool autoLoad            = true,
     IndicatorBuilder builder = null,
     float triggerDistance    = 0,
     Key key = null
     ) : base(modeListener, up, builder, triggerDistance, key)
 {
     this.autoLoad = autoLoad;
 }
コード例 #6
0
 protected Wrapper(
     ValueNotifier <int> modeListener,
     bool up,
     IndicatorBuilder builder = null,
     float triggerDistance    = 0,
     Key key = null
     ) : base(key)
 {
     this.modeListener    = modeListener;
     this.up              = up;
     this.builder         = builder;
     this.triggerDistance = triggerDistance;
 }
コード例 #7
0
 public RefreshWrapper(
     bool up,
     ValueNotifier <int> modeListener = null,
     int completeDuration             = DefaultConstants.default_completeDuration,
     OnOffsetChange onOffsetChange    = null,
     float visibleRange       = DefaultConstants.default_VisibleRange,
     IndicatorBuilder builder = null,
     float triggerDistance    = 0,
     Key key = null
     ) : base(modeListener, up, builder, triggerDistance, key)
 {
     this.completeDuration = completeDuration;
     this.onOffsetChange   = onOffsetChange;
     this.visibleRange     = visibleRange;
 }
コード例 #8
0
        protected internal override void didChangePrevious(Route previousRoute)
        {
            string previousTitleString = previousRoute is CupertinoPageRoute
                ? ((CupertinoPageRoute)previousRoute).title
                : null;

            if (_previousTitle == null)
            {
                _previousTitle = new ValueNotifier <string>(previousTitleString);
            }

            else
            {
                _previousTitle.value = previousTitleString;
            }

            base.didChangePrevious(previousRoute);
        }
コード例 #9
0
        protected override void didChangePrevious(Route previousRoute)
        {
            string previousTitleString = previousRoute is CustomPageRoute
                ? ((CustomPageRoute)previousRoute).title
                : null;

            if (this._previousTitle == null)
            {
                this._previousTitle = new ValueNotifier <string>(previousTitleString);
            }

            else
            {
                this._previousTitle.value = previousTitleString;
            }

            base.didChangePrevious(previousRoute);
        }
コード例 #10
0
        void _didChangeMode(bool up, ValueNotifier <int> mode)
        {
            switch (mode.value)
            {
            case RefreshStatus.refreshing:
                if (this.widget.onRefresh != null)
                {
                    this.widget.onRefresh(up);
                }

                if (up && this.widget.headerConfig is RefreshConfig config)
                {
                    this._scrollController
                    .jumpTo(this._scrollController.offset + config.visibleRange);
                }

                break;
            }
        }
コード例 #11
0
        public _DraggableSheetExtent(
            float minExtent,
            float maxExtent,
            float initialExtent,
            VoidCallback listener
            )
        {
            D.assert(minExtent >= 0);
            D.assert(maxExtent <= 1);
            D.assert(minExtent <= initialExtent);
            D.assert(initialExtent <= maxExtent);

            this.minExtent     = minExtent;
            this.maxExtent     = maxExtent;
            this.initialExtent = initialExtent;
            _currentExtent     = new ValueNotifier <float>(initialExtent);
            _currentExtent.addListener(listener);
            availablePixels = float.PositiveInfinity;
        }