Exemple #1
0
            public override Widget build(BuildContext buildContext)
            {
                return(new Clickable(
                           onTap: () =>
                {
                    if (_expanded)
                    {
                        return;
                    }
                    _expanded = true;
                    switch (widget._overlayType)
                    {
                    case DropDownOverlayType.scrollable:
                        _guid = ScrollableOverlay.of(buildContext).Add(_dropDownOverlayBuilder);
                        break;

                    case DropDownOverlayType.builtin:
                        Overlay.of(buildContext).insert(_overlayEntry);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    if (_screenOverlayState == null)
                    {
                        _screenOverlayState = ScreenOverlay.of(buildContext);
                    }
                    _screenOverlayState.AddOnTapListener(OnScreenTap);
                },
                           child: widget._selectBuilder.Invoke()
                           ));
            }
Exemple #2
0
 public override void initState()
 {
     base.initState();
     _filterType            = FilterType.manual;
     _textEditingController = new TextEditingController();
     _focusNode             = new FocusNode();
     _screenOverlayState    = ScreenOverlay.of(context);
     _screenOverlayState.AddOnTapListener(LoseFocus);
 }
Exemple #3
0
        public override Widget build(BuildContext buildContext)
        {
            Widget page = null;

            if (_version == null)
            {
                return(new Container());
            }
            if (_overwriteUnknown)
            {
                page = OnUnknownPath();
            }
            else
            {
                foreach (var entry in Router)
                {
                    if (!entry.Key.IsMatch(_currentPath))
                    {
                        continue;
                    }

                    var match     = entry.Key.Match(_currentPath);
                    var arguments = new Dictionary <string, string>();
                    foreach (var parameterName in entry.Value.Item2)
                    {
                        arguments[parameterName] = match.Groups[parameterName].Value;
                    }

                    page = entry.Value.Item1.Invoke(arguments);

                    break;
                }
            }

            var screenOverlay = new ScreenOverlay(
                child: page ?? OnUnknownPath()
                );

            var defaultTextStyle = new DefaultTextStyle(
                child: screenOverlay,
                style: new TextStyle(
                    fontFamily: "PingFang"
                    )
                );

            return(defaultTextStyle);
        }