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 }
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; }
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; }
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; }
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; }
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; }
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; }
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); }
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); }
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; } }
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; }