예제 #1
0
        void _showApiDocumentation(BuildContext context)
        {
            string url = this.demos[DefaultTabController.of(context).index].documentationUrl;

            if (url != null)
            {
                Application.OpenURL(url);
            }
        }
예제 #2
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()
                            )
                        )
                    )
            }
                           )
                       ));
        }
예제 #3
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)
                                   ));
            }
        }
예제 #4
0
파일: demo.cs 프로젝트: silingfei/UIWidgets
        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);
            }
        }
예제 #5
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)
             * ));*/
        }
예제 #6
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
                    );
            }
                       ));
        }