Exemple #1
0
        private Future _showApiDocumentation(BuildContext context)
        {
            string url = this.demos[DefaultTabController.of(context).index].documentationUrl;

            if (url == null)
            {
                return(null);
            }

            if (BrowserUtils.canLaunch(url))
            {
                BrowserUtils.launch(url);
            }
            else
            {
                material_.showDialog <object>(
                    context: context,
                    builder: (BuildContext subContext) =>
                {
                    return(new SimpleDialog(
                               title: new Text("Couldn't display URL:"),
                               children: new List <Widget>
                    {
                        new Padding(
                            padding: EdgeInsets.symmetric(horizontal: 16.0f),
                            child: new Text(url)
                            )
                    }
                               ));
                }
                    );
            }

            return(null);
        }
Exemple #2
0
 void _showExampleCode(BuildContext context) {
     string tag = this.demos[DefaultTabController.of(context).index].exampleCodeTag;
     if (tag != null) {
         Navigator.push(context, new MaterialPageRoute(
             builder: (BuildContext _context) => new FullScreenCodeDialog(exampleCodeTag: tag)
         ));
     }
 }
        void _showApiDocumentation(BuildContext context)
        {
            string url = this.demos[DefaultTabController.of(context).index].documentationUrl;

            if (url != null)
            {
                Application.OpenURL(url);
            }
        }
Exemple #4
0
        void _handleArrowButtonPress(BuildContext context, int delta)
        {
            TabController controller = DefaultTabController.of(context);

            if (!controller.indexIsChanging)
            {
                controller.animateTo((controller.index + delta).clamp(0, icons.Count - 1));
            }
        }
Exemple #5
0
        public override Widget build(BuildContext context)
        {
            TabController controller = DefaultTabController.of(context);
            Color         color      = Theme.of(context).accentColor;

            return(new SafeArea(
                       top: false,
                       bottom: false,
                       child: new Column(
                           children: new List <Widget> {
                new Container(
                    margin: EdgeInsets.only(top: 16.0f),
                    child: new Row(
                        children: new List <Widget> {
                    new IconButton(
                        icon: new  Icon(Icons.chevron_left),
                        color: color,
                        onPressed: () => { _handleArrowButtonPress(context, -1); },
                        tooltip: "Page back"
                        ),
                    new TabPageSelector(controller: controller),
                    new IconButton(
                        icon: new  Icon(Icons.chevron_right),
                        color: color,
                        onPressed: () => { _handleArrowButtonPress(context, 1); },
                        tooltip: "Page forward"
                        )
                },
                        mainAxisAlignment: MainAxisAlignment.spaceBetween
                        )
                    ),
                new Expanded(
                    child: new IconTheme(
                        data: new IconThemeData(
                            size: 128.0f,
                            color: color
                            ),
                        child: new TabBarView(
                            children: icons.Select <Icon, Widget>((Icon icon) => {
                    return new Container(
                        padding: EdgeInsets.all(12.0f),
                        child: new Card(
                            child: new Center(
                                child: icon
                                )
                            )
                        );
                }).ToList()
                            )
                        )
                    )
            }
                           )
                       ));
        }
Exemple #6
0
        void _showApiDocumentation(BuildContext context)
        {
            string url = this.demos[DefaultTabController.of(context).index].documentationUrl;

            if (url != null)
            {
                // TODO: find Unity equivalent
                // Open the URL in browser
                // launch(url, forceWebView: true);
            }
        }
Exemple #7
0
        private void _showExampleCode(BuildContext context)
        {
            string tag = this.demos[DefaultTabController.of(context).index].exampleCodeTag;

            if (tag != null)
            {
                D.assert(false, () => "TO DO >>>");
            }

            /*Navigator.push(context, MaterialPageRoute<FullScreenCodeDialog>(
             *  builder: (BuildContext context) => FullScreenCodeDialog(exampleCodeTag: tag)
             * ));*/
        }
Exemple #8
0
        public override Widget build(BuildContext context)
        {
            Color         fixColor           = this.color ?? Colors.transparent;
            Color         fixSelectedColor   = this.selectedColor ?? Theme.of(context).accentColor;
            ColorTween    selectedColorTween = new ColorTween(begin: fixColor, end: fixSelectedColor);
            ColorTween    previousColorTween = new ColorTween(begin: fixSelectedColor, end: fixColor);
            TabController tabController      = this.controller ?? DefaultTabController.of(context);

            D.assert(() => {
                if (tabController == null)
                {
                    throw new UIWidgetsError(
                        "No TabController for " + this.GetType() + ".\n" +
                        "When creating a " + this.GetType() + ", you must either provide an explicit TabController " +
                        "using the \"controller\" property, or you must ensure that there is a " +
                        "DefaultTabController above the " + this.GetType() + ".\n" +
                        "In this case, there was neither an explicit controller nor a default controller."
                        );
                }

                return(true);
            });

            Animation <float> animation = new CurvedAnimation(
                parent: tabController.animation,
                curve: Curves.fastOutSlowIn
                );

            return(new AnimatedBuilder(
                       animation: animation,
                       builder: (BuildContext subContext, Widget child) => {
                List <Widget> children = new List <Widget>();

                for (int tabIndex = 0; tabIndex < tabController.length; tabIndex++)
                {
                    children.Add(this._buildTabIndicator(
                                     tabIndex,
                                     tabController,
                                     selectedColorTween,
                                     previousColorTween)
                                 );
                }

                return new Row(
                    mainAxisSize: MainAxisSize.min,
                    children: children
                    );
            }
                       ));
        }