public override void initState() { base.initState(); _leadingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis); _trailingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis); _leadingAndTrailingListener = ListenableUtils.merge(new List <Listenable> { _leadingController, _trailingController }); }
public override void initState() { base.initState(); var animations = new List<Listenable> { }; if (this.widget.route.animation != null) { animations.Add(this.widget.route.animation); } if (this.widget.route.secondaryAnimation != null) { animations.Add(this.widget.route.secondaryAnimation); } this._listenable = ListenableUtils.merge(animations); }
public override Widget build(BuildContext context) { WidgetsD.debugCheckHasDirectionality(context); switch (Directionality.of(context)) { case TextDirection.ltr: keys = widget.children.Keys.ToList(); break; case TextDirection.rtl: widget.children.Keys.ToList().Reverse(); keys = widget.children.Keys.ToList(); break; } List <Listenable> results = new List <Listenable>(); results.AddRange(_highlightControllers.Values); results.AddRange(_pressControllers.Values); return(new AnimatedBuilder( animation: ListenableUtils.merge(results), builder: (BuildContext context1, Widget child1) => { List <Widget> children = new List <Widget>(); foreach (T currentKey in keys) { TextStyle textStyle = DefaultTextStyle.of(context1).style.copyWith( fontWeight: _highlightTween.evaluate(_highlightControllers[currentKey]) ); Widget child = new DefaultTextStyle( style: textStyle, child: new Opacity( opacity: _pressTween.evaluate(_pressControllers[currentKey]), child: new MetaData( behavior: HitTestBehavior.opaque, child: new Center(child: widget.children[currentKey]) ) ) ); children.Add(child); } int selectedIndex = widget.groupValue.Equals(default) ? 0 : keys.IndexOf(widget.groupValue);
public override void initState() { base.initState(); var animations = new List <Listenable>(); if (widget.route.animation != null) { animations.Add(widget.route.animation); } if (widget.route.secondaryAnimation != null) { animations.Add(widget.route.secondaryAnimation); } _listenable = ListenableUtils.merge(animations); if (widget.route.isCurrent) { widget.route.navigator.focusScopeNode.setFirstFocus(focusScopeNode); } }
public override Widget build(BuildContext context) { base.build(context); // See AutomaticKeepAliveClientMixin. D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasDirectionality(context)); ThemeData themeData = Theme.of(context); TextStyle style = this.widget.style ?? themeData.textTheme.subhead; Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.primaryColorBrightness; TextEditingController controller = this._effectiveController; FocusNode focusNode = this._effectiveFocusNode; List <TextInputFormatter> formatters = this.widget.inputFormatters ?? new List <TextInputFormatter>(); if (this.widget.maxLength != null && this.widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength)); } Widget child = new RepaintBoundary( child: new EditableText( key: this._editableTextKey, controller: controller, focusNode: focusNode, keyboardType: this.widget.keyboardType, textInputAction: this.widget.textInputAction, textCapitalization: this.widget.textCapitalization, style: style, textAlign: this.widget.textAlign, textDirection: this.widget.textDirection, autofocus: this.widget.autofocus, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, maxLines: this.widget.maxLines, selectionColor: themeData.textSelectionColor, selectionControls: this.widget.enableInteractiveSelection ? MaterialUtils.materialTextSelectionControls : null, onChanged: this.widget.onChanged, onEditingComplete: this.widget.onEditingComplete, onSubmitted: this.widget.onSubmitted, onSelectionChanged: this._handleSelectionChanged, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: this.widget.cursorWidth, cursorRadius: this.widget.cursorRadius, cursorColor: this.widget.cursorColor ?? Theme.of(context).cursorColor, scrollPadding: this.widget.scrollPadding, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: this.widget.enableInteractiveSelection ) ); if (this.widget.decoration != null) { child = new AnimatedBuilder( animation: ListenableUtils.merge(new List <Listenable> { focusNode, controller }), builder: (_context, _child) => { return(new InputDecorator( decoration: this._getEffectiveDecoration(), baseStyle: this.widget.style, textAlign: this.widget.textAlign, isFocused: focusNode.hasFocus, isEmpty: controller.value.text.isEmpty(), child: _child )); }, child: child ); } return(new IgnorePointer( ignoring: !(this.widget.enabled ?? this.widget.decoration?.enabled ?? true), child: new GestureDetector( behavior: HitTestBehavior.translucent, onTapDown: this._handleTapDown, onTap: this._handleTap, onTapCancel: this._handleTapCancel, onLongPress: this._handleLongPress, child: child ) )); }
public override Widget build(BuildContext context) { base.build(context); // See AutomaticKeepAliveClientMixin. D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasDirectionality(context)); D.assert( !(this.widget.style != null && this.widget.style.inherit == false && (this.widget.style.fontSize == null || this.widget.style.textBaseline == null)), "inherit false style must supply fontSize and textBaseline" ); ThemeData themeData = Theme.of(context); TextStyle style = themeData.textTheme.subhead.merge(this.widget.style); Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.primaryColorBrightness; TextEditingController controller = this._effectiveController; FocusNode focusNode = this._effectiveFocusNode; List <TextInputFormatter> formatters = this.widget.inputFormatters ?? new List <TextInputFormatter>(); if (this.widget.maxLength != null && this.widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength)); } bool forcePressEnabled = false; TextSelectionControls textSelectionControls = MaterialUtils.materialTextSelectionControls;; bool paintCursorAboveText = false; bool cursorOpacityAnimates = false; Offset cursorOffset = null; Color cursorColor = this.widget.cursorColor ?? themeData.cursorColor; Radius cursorRadius = this.widget.cursorRadius; Widget child = new RepaintBoundary( child: new EditableText( key: this._editableTextKey, controller: controller, focusNode: focusNode, keyboardType: this.widget.keyboardType, textInputAction: this.widget.textInputAction, textCapitalization: this.widget.textCapitalization, style: style, textAlign: this.widget.textAlign, textDirection: this.widget.textDirection, autofocus: this.widget.autofocus, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, maxLines: this.widget.maxLines, selectionColor: themeData.textSelectionColor, selectionControls: this.widget.selectionEnabled ? textSelectionControls : null, onChanged: this.widget.onChanged, onSelectionChanged: this._handleSelectionChanged, onEditingComplete: this.widget.onEditingComplete, onSubmitted: this.widget.onSubmitted, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: this.widget.cursorWidth, cursorRadius: cursorRadius, cursorColor: cursorColor, cursorOpacityAnimates: cursorOpacityAnimates, cursorOffset: cursorOffset, paintCursorAboveText: paintCursorAboveText, backgroundCursorColor: new Color(0xFF8E8E93),// TODO: CupertinoColors.inactiveGray, scrollPadding: this.widget.scrollPadding, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: this.widget.enableInteractiveSelection == true, dragStartBehavior: this.widget.dragStartBehavior ) ); if (this.widget.decoration != null) { child = new AnimatedBuilder( animation: ListenableUtils.merge(new List <Listenable> { focusNode, controller }), builder: (_context, _child) => { return(new InputDecorator( decoration: this._getEffectiveDecoration(), baseStyle: this.widget.style, textAlign: this.widget.textAlign, isFocused: focusNode.hasFocus, isEmpty: controller.value.text.isEmpty(), child: _child )); }, child: child ); } return(new IgnorePointer( ignoring: !(this.widget.enabled ?? this.widget.decoration?.enabled ?? true), child: new TextSelectionGestureDetector( onTapDown: this._handleTapDown, // onForcePressStart: forcePressEnabled ? this._handleForcePressStarted : null, // TODO: Remove this when force press is added onSingleTapUp: this._handleSingleTapUp, onSingleTapCancel: this._handleSingleTapCancel, onSingleLongTapStart: this._handleLongPress, onDragSelectionStart: this._handleDragSelectionStart, onDragSelectionUpdate: this._handleDragSelectionUpdate, behavior: HitTestBehavior.translucent, child: child ) )); }
public override Widget build(BuildContext context) { D.assert(material_.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasDirectionality(context)); D.assert( !(widget.style != null && widget.style.inherit == false && (widget.style.fontSize == null || widget.style.textBaseline == null)), () => "inherit false style must supply fontSize and textBaseline" ); ThemeData themeData = Theme.of(context); TextStyle style = themeData.textTheme.subtitle1.merge(widget.style); Brightness keyboardAppearance = widget.keyboardAppearance ?? themeData.primaryColorBrightness; TextEditingController controller = _effectiveController; FocusNode focusNode = _effectiveFocusNode; List <TextInputFormatter> formatters = widget.inputFormatters ?? new List <TextInputFormatter>(); if (widget.maxLength != null && widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(widget.maxLength)); } TextSelectionControls textSelectionControls = MaterialUtils.materialTextSelectionControls; ; bool paintCursorAboveText = false; bool cursorOpacityAnimates = false; Offset cursorOffset = null; Color cursorColor = widget.cursorColor ?? themeData.cursorColor; Radius cursorRadius = widget.cursorRadius; _forcePressEnabled = false; textSelectionControls = _MaterialTextSelectionControls.materialTextSelectionControls; paintCursorAboveText = false; cursorOpacityAnimates = false; cursorColor = cursorColor ?? themeData.cursorColor; Widget child = new RepaintBoundary( child: new EditableText( key: editableTextKey, readOnly: widget.readOnly, toolbarOptions: widget.toolbarOptions, showCursor: widget.showCursor, showSelectionHandles: _showSelectionHandles, controller: controller, focusNode: focusNode, keyboardType: widget.keyboardType, textInputAction: widget.textInputAction, textCapitalization: widget.textCapitalization, style: style, strutStyle: widget.strutStyle, textAlign: widget.textAlign, textDirection: widget.textDirection, autofocus: widget.autofocus, obscureText: widget.obscureText, autocorrect: widget.autocorrect, smartDashesType: widget.smartDashesType, smartQuotesType: widget.smartQuotesType, enableSuggestions: widget.enableSuggestions, maxLines: widget.maxLines, minLines: widget.minLines, expands: widget.expands, selectionColor: themeData.textSelectionColor, selectionControls: widget.selectionEnabled ? textSelectionControls : null, onChanged: widget.onChanged, onSelectionChanged: _handleSelectionChanged, onEditingComplete: widget.onEditingComplete, onSubmitted: widget.onSubmitted, onSelectionHandleTapped: _handleSelectionHandleTapped, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: widget.cursorWidth.Value, cursorRadius: cursorRadius, cursorColor: cursorColor, selectionHeightStyle: widget.selectionHeightStyle, selectionWidthStyle: widget.selectionWidthStyle, cursorOpacityAnimates: cursorOpacityAnimates, cursorOffset: cursorOffset, paintCursorAboveText: paintCursorAboveText, backgroundCursorColor: CupertinoColors.inactiveGray, scrollPadding: widget.scrollPadding, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: widget.enableInteractiveSelection == true, dragStartBehavior: widget.dragStartBehavior, scrollController: widget.scrollController, scrollPhysics: widget.scrollPhysics ) ); if (widget.decoration != null) { child = new AnimatedBuilder( animation: ListenableUtils.merge(new List <Listenable> { focusNode, controller }), builder: (_context, _child) => { return(new InputDecorator( decoration: _getEffectiveDecoration(), baseStyle: widget.style, textAlign: widget.textAlign, textAlignVertical: widget.textAlignVertical, isHovering: _isHovering, isFocused: focusNode.hasFocus, isEmpty: controller.value.text.isEmpty(), expands: widget.expands, child: _child )); }, child: child ); } void onEnter(PointerEnterEvent pEvent) { _handleHover(true); } void onExit(PointerExitEvent pEvent) { _handleHover(false); } return(new IgnorePointer( ignoring: !_isEnabled, child: new MouseRegion( onEnter: onEnter, onExit: onExit, child: new AnimatedBuilder( animation: controller, builder: (BuildContext buildContext, Widget buildChild) => { return buildChild; }, child: _selectionGestureDetectorBuilder.buildGestureDetector( behavior: HitTestBehavior.translucent, child: child ) ) ) )); }