示例#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);
        }
示例#2
0
 public override Widget build(BuildContext context)
 {
     return(new IconButton(
                icon: new Icon(Icons.library_books),
                tooltip: "API documentation",
                onPressed: () => BrowserUtils.launch(this.documentationUrl)
                ));
 }
示例#3
0
 public _LinkTextSpan(TextStyle style = null, string url = null, string text = null) : base(
         style: style,
         text: text ?? url,
         recognizer: new TapGestureRecognizer {
     onTap = () => { BrowserUtils.launch(url); }
 }
         )
 {
 }
示例#4
0
 private void _checkForUpdates()
 {
     // Only prompt once a day
     if (_lastUpdateCheck != null &&
         DateTime.Now - _lastUpdateCheck < new TimeSpan(1, 0, 0, 0))
     {
         return; // We already checked for updates recently
     }
     _lastUpdateCheck = DateTime.Now;
     this.widget.updateUrlFetcher.Invoke().then(updateUrl =>
     {
         if (updateUrl != null)
         {
             material_.showDialog <bool>(context: this.context, builder: this._buildDialog).then(wantsUpdate =>
             {
                 if (wantsUpdate != null && (bool)wantsUpdate)
                 {
                     BrowserUtils.launch((string)updateUrl);
                 }
             });
         }
     });
 }