private Widget _buildImage(string src) { string[] parts = src.Split('#'); if (parts.isEmpty()) { return(SizedBox.expand()); } string path = parts.first(); float width = 0, height = 0; if (parts.Length == 2) { var dimensions = parts.last().Split('x'); if (dimensions.Length == 2) { width = float.Parse(dimensions[0]); height = float.Parse(dimensions[1]); } } Uri uri = new Uri(path); Widget child; if (uri.Scheme == "http" || uri.Scheme == "https") { child = Image.network(uri.ToString(), null, 1); } else if (uri.Scheme == "data") { child = _handleDataSchemeUri(uri, width, height); } else if (uri.Scheme == "resource") { //TODO: child = Image.asset(path.Substring(9), null, null, width, height); } else { string filePath = imageDirectory == null ? uri.ToString() : System.IO.Path.Combine(imageDirectory, uri.ToString()); child = Image.file(filePath, null, 1, width, height); } if (_linkHandlers.isNotEmpty()) { TapGestureRecognizer recognizer = _linkHandlers.last() as TapGestureRecognizer; return(new GestureDetector(null, child, null, null, recognizer.onTap)); } else { return(child); } }
public override Widget build(BuildContext context) { return(new LayoutBuilder( builder: (BuildContext subContext, BoxConstraints subConstraints) => { _extent.availablePixels = widget.maxChildSize * subConstraints.biggest.height; Widget sheet = new FractionallySizedBox( heightFactor: _extent.currentExtent, child: widget.builder(subContext, _scrollController), alignment: Alignment.bottomCenter ); return widget.expand ? SizedBox.expand(child: sheet) : sheet; } )); }
public readonly BannerTapCallback onBannerTap; // User taps on the photo's header or footer. private void showPhoto(BuildContext context) { Navigator.push <object>(context, new MaterialPageRoute( builder: (BuildContext subContext) => { return(new Scaffold( appBar: new AppBar( title: new Text(photo.title) ), body: SizedBox.expand( child: new Hero( tag: photo.tag, child: new GridPhotoViewer(photo: photo) ) ) )); } )); }
public override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; var screenWidth = size.width * 0.8f; return(new Game( child: new KeyboardController( child: SizedBox.expand( child: new Container( color: AppConstants.APP_BACKGROUND_COLOR, child: new Padding( padding: MediaQuery.of(context).padding, child: new Column( children: new List <Widget> { new Row( children: new List <Widget>() { new Spacer(), new FlatButton( onPressed: () => { DialogUtils.showDialog(context, builder: ctx => new DonationDialog()); }, child: new Text(L.of(context).Reward) ) } ), new Spacer(), new ScreenDecoration(child: new GBScreen(width: screenWidth)), new Spacer(flex: 2), new GBJoyStick() } ) ) ) ) ) )); }
Widget _buildBody(BuildContext context) { MediaQueryData mediaQueryData = MediaQuery.of(context); float statusBarHeight = mediaQueryData.padding.top; float screenHeight = mediaQueryData.size.height; float appBarMaxHeight = screenHeight - statusBarHeight; float appBarMidScrollOffset = statusBarHeight + appBarMaxHeight - AnimationHomeUtils._kAppBarMidHeight; return(SizedBox.expand( child: new Stack( children: new List <Widget> { new NotificationListener <ScrollNotification>( onNotification: (ScrollNotification notification) => { return this._handleScrollNotification(notification, appBarMidScrollOffset); }, child: new CustomScrollView( controller: this._scrollController, physics: new _SnappingScrollPhysics(midScrollOffset: appBarMidScrollOffset), slivers: new List <Widget> { new _StatusBarPaddingSliver( maxHeight: statusBarHeight, scrollFactor: 7.0f ), new SliverPersistentHeader( pinned: true, del: new _SliverAppBarDelegate( minHeight: AnimationHomeUtils._kAppBarMinHeight, maxHeight: appBarMaxHeight, child: new NotificationListener <ScrollNotification>( onNotification: (ScrollNotification notification) => { return this._handlePageNotification(notification, this._headingPageController, this._detailsPageController); }, child: new PageView( physics: this._headingScrollPhysics, controller: this._headingPageController, children: this._allHeadingItems(appBarMaxHeight, appBarMidScrollOffset) ) ) ) ), new SliverToBoxAdapter( child: new SizedBox( height: 610.0f, child: new NotificationListener <ScrollNotification>( onNotification: (ScrollNotification notification) => { return this._handlePageNotification(notification, this._detailsPageController, this._headingPageController); }, child: new PageView( controller: this._detailsPageController, children: AnimationSectionsUtils.allSections .Select <Section, Widget>((Section section) => { return new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: this._detailItemsFor(section).ToList() ); }).ToList() ) ) ) ) } ) ), new Positioned( top: statusBarHeight, left: 0.0f, child: new IconTheme( data: new IconThemeData(color: Colors.white), child: new SafeArea( top: false, bottom: false, child: new IconButton( icon: new BackButtonIcon(), tooltip: "Back", onPressed: () => { this._handleBackButton(appBarMidScrollOffset); } ) ) ) ) } ) )); }
public override Widget build(BuildContext context, float shrinkOffset, bool overlapsContent) { return(SizedBox.expand(child: this.child)); }
Widget _handleDataSchemeUri(Uri uri, float? width, float? height) { //TODO: return SizedBox.expand(); }
Widget _buildImage(string src) { string[] parts = src.Split('#'); if (parts.isEmpty()) return SizedBox.expand(); string path = parts.first(); float? width = null, height = null; if (parts.Length == 2) { var dimensions = parts.last().Split('x'); if (dimensions.Length == 2) { width = float.Parse(dimensions[0]); height = float.Parse(dimensions[1]); } } Uri uri; Widget child = null; if (Uri.TryCreate(src, UriKind.RelativeOrAbsolute, out uri) && uri.IsAbsoluteUri) { if (uri.Scheme == "http" || uri.Scheme == "https") { child = Image.network(src: uri.ToString(), scale: 1, width: width, height: height); } else if (uri.Scheme == "data") { child = _handleDataSchemeUri(uri, width, height); } else if (uri.Scheme == "resource") { child = Image.asset(path.Substring(9), scale: 1, width: width, height: height); } else if (uri.Scheme == "file") { child = Image.file(file: uri.ToString(), scale: 1, width: width, height: height); } } else { if (!string.IsNullOrEmpty(imageDirectory)) { if (imageDirectory.StartsWith("http")) { uri = new Uri(new Uri(imageDirectory), uri); child = Image.network(src: uri.ToString(), scale: 1, width: width, height: height); } else { child = Image.file(file: System.IO.Path.Combine(imageDirectory, uri.ToString()), scale: 1, width: width, height: height); } } else { child = Image.file(file: uri.ToString(), scale: 1, width: width, height: height); } } if (_linkHandlers.isNotEmpty()) { TapGestureRecognizer recognizer = _linkHandlers.last() as TapGestureRecognizer; return new GestureDetector(null, child, null, null, recognizer.onTap); } else { return child; } }
private Widget _handleDataSchemeUri(Uri uri, float widht, float height) { //TODO: return(SizedBox.expand()); }
public override Widget build(BuildContext context) { return(new DefaultTabController( length: 2, child: new Scaffold( extendBody: true, drawer: new Drawer( child: new FlatButton( child: new Text("About"), onPressed: () => Navigator.popAndPushNamed(context, Routes.AboutPageRouteText))), appBar: new AppBar( bottom: new TabBar( tabs: new List <Widget> { new Container(height: 30, child: new Text("Home", style: new TextStyle( shadows: new List <BoxShadow> { new BoxShadow( color: Colors.red, offset: new Offset(0, 0), blurRadius: 5, spreadRadius: 5 ) } ))), new Container(height: 30, child: new Text("Settings", style: new TextStyle( shadows: new List <BoxShadow> { new BoxShadow( color: Colors.red, offset: new Offset(0, 0), blurRadius: 5, spreadRadius: 5 ) } ))) //, //new Container (height: 30, child: new Text ("About")), }, labelStyle: new TextStyle(fontSize: 24f), indicatorSize: TabBarIndicatorSize.tab ), title: new Container( child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, children: new List <Widget> { new Text("MikuMikuManager"), new Container( padding: EdgeInsets.all(8), width: Screen.width / 2, decoration: new BoxDecoration( Colors.white24, border: Border.all(Colors.white24), borderRadius: BorderRadius.circular(18)), child: new TextField( decoration: InputDecoration.collapsed( "Search..." ), autofocus: false, style: new TextStyle(fontSize: 17), onSubmitted: x => widget.SearchPattern.Value = x )), new PopupMenuButton <SortType>( child: new Icon(Icons.sort), itemBuilder: _ => new List <PopupMenuEntry <SortType> > { new PopupMenuItem <SortType>( value: SortType.ByDefault, child: new Text("By Default") ), new PopupMenuItem <SortType>( value: SortType.ByFavorite, child: new Text("By Favorite") ), new PopupMenuItem <SortType>( value: SortType.ByFolder, child: new Text("By Folder") ) }, initialValue: widget.SortTypeProperty.Value, onSelected: x => { widget.SortTypeProperty.Value = x; } ) } ) ) ), body: new Padding( padding: EdgeInsets.all(8), child: new TabBarView( children: new List <Widget> { new GalleryPage(), new SettingPage() } ) ), floatingActionButton: new Column( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, children: new List <Widget> { FloatingActionButton.extended( icon: new Icon(Icons.track_changes), label: new Text("Generate All"), onPressed: () => { var builder = GameObject.Find("MMDRenderer") .GetComponent <PreviewBuilder.PreviewBuilder>(); builder.StartRender(); }), new SizedBox(height: 10, width: 10), FloatingActionButton.extended( icon: new Icon(Icons.refresh), label: new Text("Refresh"), onPressed: () => MMMServices.RefreshObservedMmdObjects()) } ), bottomNavigationBar: new Container( height: 30, decoration: new BoxDecoration( Colors.white, boxShadow: new List <BoxShadow> { new BoxShadow(Colors.black.withOpacity(0.3f), new Offset(0, -5), 5) } ), child: new Stack( children: new List <Widget> { SizedBox.expand( child: new LinearProgressIndicator( backgroundColor: Colors.transparent, value: _progress, valueColor: new AlwaysStoppedAnimation <Color>( Colors.pink))), //Status text new Container( margin: EdgeInsets.only(5), alignment: Alignment.centerLeft, child: new Row( children: new List <Widget> { PaddingText(_renderStatus), VerticalDivider, PaddingText(_savingStatus) } ) ) } ) ) ) )); }