Widget _buildNavigationBar(BuildContext context) { return(new Container( width: MediaQuery.of(context: context).size.width, height: 94, decoration: new BoxDecoration( color: CColors.White, border: new Border( bottom: new BorderSide(color: CColors.Separator2) ) ), child: new Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( padding: EdgeInsets.symmetric(8, 16), onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( icon: Icons.arrow_back, size: 24, color: CColors.Icon ) ), new CustomButton( padding: EdgeInsets.symmetric(8, 16), onPressed: () => this.widget.actionModel.pushToCreateFavorite(""), child: new Text( "新建", style: CTextStyle.PLargeBlue ) ) } ), new Container( margin: EdgeInsets.only(16, bottom: 8), child: new Text( "我的收藏", style: CTextStyle.H2 ) ) } ) )); }
/// <summary> /// apply css rules to current document. /// </summary> /// <param name="dom"></param> /// <param name="rulelist"></param> /// <param name="mediadeviceInfo"></param> public void ApplyCssRules(CSS.CSSRuleList rulelist, string mediadeviceInfo) { if (rulelist == null) { return; } foreach (var item in rulelist.item) { if (item.type == CSS.enumCSSRuleType.STYLE_RULE) { CSS.CSSStyleRule stylerule = item as CSS.CSSStyleRule; foreach (var elemntitem in this.Select(stylerule.selectorText).item) { elemntitem.StyleRules.Add(stylerule); } } else if (item.type == CSS.enumCSSRuleType.MEDIA_RULE) { CSS.CSSMediaRule mediarule = item as CSS.CSSMediaRule; if (string.IsNullOrEmpty(mediadeviceInfo)) { ApplyCssRules(mediarule.cssRules, string.Empty); } else { if (MediaQuery.isMatch(mediarule.media, mediadeviceInfo)) { ApplyCssRules(mediarule.cssRules, string.Empty); } } } else if (item.type == enumCSSRuleType.IMPORT_RULE) { CSS.CSSImportRule importrule = item as CSS.CSSImportRule; if (importrule.stylesheet != null && importrule.stylesheet.cssRules != null) { if (MediaQuery.isMatch(importrule.media, mediadeviceInfo)) { ApplyCssRules(importrule.stylesheet.cssRules, mediadeviceInfo); } } } } }
public override Widget build(BuildContext context) { if (this.game == null || this.game.attachmentURLs.isNullOrEmpty()) { return(new Container()); } var attachmentURLs = this.game.attachmentURLs; return(new Container( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( height: 1, margin: EdgeInsets.symmetric(horizontal: 16), color: CColors.Separator ), new Padding( padding: EdgeInsets.all(16), child: new Text( "预览", style: CTextStyle.H5 ) ), new Container( height: MediaQuery.of(context: context).size.width * 0.4f, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: attachmentURLs.Count, itemBuilder: (cxt, index) => new Container( margin: EdgeInsets.only(index == 0 ? 16 : 8, right: index == attachmentURLs.Count - 1 ? 16 : 0), child: new AspectRatio( aspectRatio: 16 / 9f, child: new PlaceholderImage( attachmentURLs[index: index], borderRadius: 8, fit: BoxFit.cover, useCachedNetworkImage: true ) ) ) ) ) } ) )); }
bool _onNotification(BuildContext context, ScrollNotification notification) { var pixels = notification.metrics.pixels; if (this._titleHeight == 0.0f) { var width = MediaQuery.of(context).size.width; var imageHeight = width / this._aspectRatio; this._titleHeight = imageHeight + eventTitleKey.currentContext.size.height - (44 + this._topPadding) + 16; // (44 + this._topPadding) 是顶部的高度 16 是文字与图片的间隙 } if (pixels >= 44 + this._topPadding) { if (this._showNavBarShadow) { this.setState(() => { this._showNavBarShadow = false; }); StatusBarManager.statusBarStyle(false); } } else { if (!this._showNavBarShadow) { this.setState(() => { this._showNavBarShadow = true; }); StatusBarManager.statusBarStyle(true); } } if (pixels > this._titleHeight) { if (!this._isHaveTitle) { this._controller.forward(); this.setState(() => { this._isHaveTitle = true; }); } } else { if (this._isHaveTitle) { this._controller.reverse(); this.setState(() => { this._isHaveTitle = false; }); } } return(true); }
public override Widget buildPage(BuildContext context, Animation <float> animation, Animation <float> secondaryAnimation) { int?selectedItemIndex = null; if (initialValue != null) { for (int index = 0; selectedItemIndex == null && index < items.Count; index += 1) { if (items[index].represents(initialValue)) { selectedItemIndex = index; } } } Widget menu = new _PopupMenu <T>(route: this); if (captureInheritedThemes ?? false) { menu = InheritedTheme.captureAll(showMenuContext, menu); } else { if (theme != null) { menu = new Theme(data: theme, child: menu); } } return(MediaQuery.removePadding( context: context, removeTop: true, removeBottom: true, removeLeft: true, removeRight: true, child: new Builder( builder: _ => new CustomSingleChildLayout( layoutDelegate: new _PopupMenuRouteLayout( position, itemSizes, selectedItemIndex ?? 0, Directionality.of(context) ), child: menu )) )); }
private static FilterDefinition <MongoDbMedia> BuildFilter(string appId, MediaQuery query) { var filters = new List <FilterDefinition <MongoDbMedia> > { Filter.Eq(x => x.Doc.AppId, appId) }; if (!string.IsNullOrWhiteSpace(query.Query)) { var regex = new BsonRegularExpression(Regex.Escape(query.Query), "i"); filters.Add(Filter.Regex(x => x.Doc.FileName, regex)); } return(Filter.And(filters)); }
public override Widget build(BuildContext context) { return(new Container( color: CColors.White, child: new Column( mainAxisSize: MainAxisSize.min, children: new List <Widget> { _buildTitle(title: this.title), _buildButtons(items: this.items), new Container( height: MediaQuery.of(context: context).padding.bottom ) } ) )); }
public override Widget buildPage(BuildContext context, Animation <float> animation, Animation <float> secondaryAnimation) { Widget bottomSheet = MediaQuery.removePadding( context: context, removeTop: true, child: new _ModalBottomSheet <T>(route: this) ); if (this.theme != null) { bottomSheet = new Theme(data: this.theme, child: bottomSheet); } return(bottomSheet); }
public override Widget build(BuildContext context) { this._setAnimationPosition(context); var eventObj = new IEvent(); if (this.widget.viewModel.eventsDict.ContainsKey(this.widget.viewModel.eventId)) { eventObj = this.widget.viewModel.eventsDict[this.widget.viewModel.eventId]; } if ((this.widget.viewModel.eventDetailLoading || eventObj?.user == null) && !(eventObj?.isNotFirst ?? false)) { return(new EventDetailLoading(eventType: EventType.online, mainRouterPop: this.widget.actionModel.mainRouterPop)); } if (this._bottomPadding != MediaQuery.of(context).padding.bottom&& Application.platform != RuntimePlatform.Android) { this._bottomPadding = MediaQuery.of(context).padding.bottom; this.setState(() => {}); } var eventStatus = DateConvert.GetEventStatus(eventObj.begin); return(new Container( color: CColors.White, child: new CustomSafeArea( top: !this._isFullScreen, bottom: false, child: new Container( color: this._isFullScreen ? CColors.Black : CColors.White, child: new Column( children: new List <Widget> { this._buildEventHeader(context, eventObj, EventType.online, eventStatus, this.widget.viewModel.isLoggedIn), this._buildEventDetail(context, eventObj, EventType.online, eventStatus, this.widget.viewModel.isLoggedIn), this._buildEventBottom(eventObj, EventType.online, eventStatus, this.widget.viewModel.isLoggedIn) } ) ) ) )); }
Widget _buildCoverButtons(BuildContext context) { var width = MediaQuery.of(context: context).size.width; var imageSize = (float)Math.Ceiling((width - _coverImagePadding - _coverImageSpacing * 6) / 6.5f); var children = new List <Widget>(); for (var i = 0; i < CImageUtils.FavoriteCoverImages.Count; i++) { children.Add(this._buildCoverButtonItem(index: i, buttonSize: imageSize)); } return(new Container( color: CColors.White, child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( padding: EdgeInsets.only(16, right: 16), margin: EdgeInsets.only(top: 16), child: new Text( "选择封面图标", style: CTextStyle.PSmallBody4 ) ), new Container( margin: EdgeInsets.only(top: 16, bottom: 40), height: imageSize * _coverImageColumn + _coverImageRunSpacing * (_coverImageColumn - 1), child: new ListView( scrollDirection: Axis.horizontal, children: new List <Widget> { new Container( padding: EdgeInsets.only(16, right: 16), width: imageSize * 12 + _coverImagePadding * 2 + _coverImageSpacing * 11 + 1, child: new Wrap( spacing: _coverImageSpacing, runSpacing: _coverImageRunSpacing, children: children ) ) } ) ) } ) )); }
public override void initState() { base.initState(); m_AnimationController = new AnimationController( vsync: this, duration: new TimeSpan(0, 0, 0, 0, milliseconds: 240) ); m_AnimationController.addListener(() => setState()); m_AnimationController.addStatusListener(AnimationStatusListener); SchedulerBinding.instance.addPostFrameCallback(value => { if (MediaQuery.of(context).size.width < 750) { m_AnimationController.forward(); } }); }
public override Widget build(BuildContext context) { if (this._bottomPadding != MediaQuery.of(context).padding.bottom&& Application.platform != RuntimePlatform.Android) { this._bottomPadding = MediaQuery.of(context).padding.bottom; } return(new Container( child: new Stack( children: new List <Widget> { this._buildContentView(), this._buildBottomTabBar() } ) )); }
public override Widget build(BuildContext context) { if (this.tipMenuItems == null || this.tipMenuItems.Count == 0) { return(this.child); } return(new GestureDetector( onLongPress: () => { var height = MediaQuery.of(context: context).size.height; var renderBox = (RenderBox)this._tipMenuKey.currentContext.findRenderObject(); var position = renderBox.localToGlobal(point: Offset.zero); ArrowDirection arrowDirection; if (position.dy > 44 + CCommonUtils.getSafeAreaTopPadding(context: context) + CustomTextSelectionControlsUtils._kToolbarTriangleSize.height + this._getTipMenuHeight(context: context)) { arrowDirection = ArrowDirection.down; } else if (position.dy + renderBox.size.height < height - 44) { position = new Offset(dx: position.dx, position.dy + renderBox.size.height); arrowDirection = ArrowDirection.up; } else { position = new Offset(dx: position.dx, height / 2.0f); arrowDirection = ArrowDirection.up; } // var position = renderBox.localToGlobal(new Offset(0, dy: renderBox.size.height)); this._createTipMenu( context: context, arrowDirection: arrowDirection, position: position, size: renderBox.size ); }, child: new Container( key: this._tipMenuKey, child: this.child ) )); }
public override Widget build(BuildContext context) { D.assert(WidgetsD.debugCheckHasDirectionality(context)); D.assert(MaterialD.debugCheckHasMaterialLocalizations(context)); float additionalBottomPadding = Mathf.Max(MediaQuery.of(context).padding.bottom - this.widget.selectedFontSize / 2.0f, 0.0f); Color backgroundColor = null; switch (this.widget.type) { case BottomNavigationBarType.fix: backgroundColor = this.widget.backgroundColor; break; case BottomNavigationBarType.shifting: backgroundColor = this._backgroundColor; break; } return(new Material( elevation: this.widget.elevation, color: backgroundColor, child: new ConstrainedBox( constraints: new BoxConstraints( minHeight: Constants.kBottomNavigationBarHeight + additionalBottomPadding), child: new CustomPaint( painter: new _RadialPainter( circles: this._circles.ToList() ), child: new Material( // Splashes. type: MaterialType.transparency, child: new Padding( padding: EdgeInsets.only(bottom: additionalBottomPadding), child: MediaQuery.removePadding( context: context, removeBottom: true, child: this._createContainer(this._createTiles()) ) ) ) ) ) )); }
float _getTipMenuHeight(BuildContext context) { if (this.tipMenuItems == null || this.tipMenuItems.Count == 0) { return(0); } var width = MediaQuery.of(context: context).size.width; var textHeight = CTextUtils.CalculateTextHeight( this.tipMenuItems.FirstOrDefault()?.title ?? "", textStyle: CustomTextSelectionControlsUtils._kToolbarButtonFontStyle, textWidth: width, 1 ); return(textHeight + 20); }
public override Widget build(BuildContext context) { var mediaQuery = MediaQuery.of(context); return(new Container( width: mediaQuery.size.width, child: new DecoratedBox( decoration: new BoxDecoration( CColors.White, border: new Border( new BorderSide( CColors.Separator ) ) ), child: new Padding( padding: EdgeInsets.only( 16, 13.5f, 8, 13.5f + mediaQuery.padding.bottom ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Expanded( child: new Text(this.widget.message, maxLines: 3, style: CTextStyle.PRegularError.copyWith(this.widget.color) ) ), new CustomButton( padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), onPressed: this.widget.dismiss, child: new Icon( Icons.close, size: 24, color: new Color(0xFFC7CBCF) ) ) } ) ) ) )); }
protected override Widget createWidget() { return(new MaterialApp( showPerformanceOverlay: false, home: new Material( child: new BenchMarkLayoutWidget()), builder: (_, child) => { return new Builder(builder: context => { return new MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0f ), child: child); }); })); }
public void MediaDirective_ParseTest() { string text = "@media screen and (device-aspect-ratio: 16/9), projection and (color) { @page {margin: 3cm;} body { background:lime } }"; ITextProvider tp = new StringTextProvider(text); TokenStream ts = Helpers.MakeTokenStream(tp); MediaDirective md = new MediaDirective(); Assert.IsTrue(md.Parse(new ItemFactory(tp, null), tp, ts)); Assert.IsTrue(tp.CompareTo(md.Keyword.Start, "media", ignoreCase: false)); Assert.AreEqual(2, md.MediaQueries.Count); Assert.IsTrue(md.MediaQueries[0] is MediaQuery); MediaQuery mq = md.MediaQueries[0] as MediaQuery; Assert.IsTrue(tp.CompareTo(mq.MediaType.Start, "screen", ignoreCase: false)); Assert.AreEqual(1, mq.Expressions.Count); Assert.IsTrue(tp.CompareTo(mq.Expressions[0].MediaCombineOperator.Start, "and", ignoreCase: false)); Assert.IsTrue(tp.CompareTo(mq.Expressions[0].MediaFeature.Start, "device-aspect-ratio", ignoreCase: false)); Assert.IsNotNull(mq.Expressions[0].Colon); Assert.IsNotNull(mq.Expressions[0].CloseFunctionBrace); Assert.IsNotNull(tp.CompareTo(mq.Expressions[0].Values[0].Start, "16/9", ignoreCase: false)); Assert.IsTrue(md.MediaQueries[1] is MediaQuery); mq = md.MediaQueries[1] as MediaQuery; Assert.IsNotNull(mq.Comma); Assert.IsTrue(tp.CompareTo(mq.MediaType.Start, "projection", ignoreCase: false)); Assert.AreEqual(1, mq.Expressions.Count); Assert.IsTrue(tp.CompareTo(mq.Expressions[0].MediaCombineOperator.Start, "and", ignoreCase: false)); Assert.IsTrue(tp.CompareTo(mq.Expressions[0].MediaFeature.Start, "color", ignoreCase: false)); Assert.IsNull(mq.Expressions[0].Colon); Assert.IsNotNull(mq.Expressions[0].CloseFunctionBrace); Assert.AreEqual(0, mq.Expressions[0].Values.Count); Assert.IsNotNull(md.MediaBlock); Assert.IsTrue(md.MediaBlock is StyleSheet); Assert.AreEqual(4, md.MediaBlock.Children.Count); Assert.IsInstanceOfType(md.MediaBlock.Children[1], typeof(PageDirective)); Assert.IsInstanceOfType(md.MediaBlock.Children[2], typeof(RuleSet)); RuleSet rs = md.MediaBlock.Children[2] as RuleSet; Assert.IsTrue(tp.CompareTo(rs.Selectors[0].SimpleSelectors[0].Name.Start, "body", ignoreCase: false)); Assert.IsTrue(tp.CompareTo(rs.Block.Declarations[0].PropertyName.Start, "background", ignoreCase: false)); Assert.IsTrue(tp.CompareTo(rs.Block.Declarations[0].Values[0].Start, "lime", ignoreCase: false)); }
public override Widget build(BuildContext context) { float aspectRatio = 160.0f / 180.0f; List <GalleryDemoCategory> categoriesList = this.categories.ToList(); int columnCount = (MediaQuery.of(context).orientation == Orientation.portrait) ? 2 : 3; return(new SingleChildScrollView( key: new PageStorageKey <string>("categories"), child: new LayoutBuilder( builder: (_, constraints) => { float columnWidth = constraints.biggest.width / columnCount; float rowHeight = Mathf.Min(225.0f, columnWidth * aspectRatio); int rowCount = (categoriesList.Count + columnCount - 1) / columnCount; return new RepaintBoundary( child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: Enumerable.Range(0, rowCount).Select(rowIndex => { int columnCountForRow = rowIndex == rowCount - 1 ? categoriesList.Count - columnCount * Mathf.Max(0, rowCount - 1) : columnCount; return (Widget) new Row( children: Enumerable.Range(0, columnCountForRow).Select(columnIndex => { int index = rowIndex * columnCount + columnIndex; GalleryDemoCategory category = categoriesList[index]; return (Widget) new SizedBox( width: columnWidth, height: rowHeight, child: new _CategoryItem( category: category, onTap: () => { this.onCategoryTap(category); } ) ); }).ToList() ); }).ToList() ) ); } ) )); }
public override Widget build(BuildContext context) { Size screenSize = MediaQuery.of(context).size; ShrineTheme theme = ShrineTheme.of(context); return(new SizedBox( height: screenSize.width > screenSize.height ? (screenSize.height - Constants.kToolbarHeight) * 0.85f : (screenSize.height - Constants.kToolbarHeight) * 0.70f, child: new Container( decoration: new BoxDecoration( color: theme.cardBackgroundColor, border: new Border(bottom: new BorderSide(color: theme.dividerColor)) ), child: new CustomMultiChildLayout( layoutDelegate: new _HeadingLayout(), children: new List <Widget> { new LayoutId( id: _HeadingLayout.price, child: new _FeaturePriceItem(product: this.product) ), new LayoutId( id: _HeadingLayout.image, child: Image.asset( this.product.imageAsset, fit: BoxFit.cover ) ), new LayoutId( id: _HeadingLayout.title, child: new Text(this.product.featureTitle, style: theme.featureTitleStyle) ), new LayoutId( id: _HeadingLayout.description, child: new Text(this.product.featureDescription, style: theme.featureStyle) ), new LayoutId( id: _HeadingLayout.vendor, child: new _VendorItem(vendor: this.product.vendor) ) } ) ) )); }
public override Widget build(BuildContext context) { FocusScope.of(context).reparentIfNeeded(this.widget.focusNode); DefaultTextStyle defaultTextStyle = DefaultTextStyle.of(context); TextStyle effectiveTextStyle = this.widget.style; if (this.widget.style == null || this.widget.style.inherit) { effectiveTextStyle = defaultTextStyle.style.merge(this.widget.style); } Widget child = new WealthyText( key: this._richTextKey, textAlign: this.widget.textAlign ?? defaultTextStyle.textAlign ?? TextAlign.left, softWrap: this.widget.softWrap ?? defaultTextStyle.softWrap, overflow: this.widget.overflow ?? defaultTextStyle.overflow, textScaleFactor: this.widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context), maxLines: this.widget.maxLines ?? defaultTextStyle.maxLines, textSpanList: this.widget.textSpanList, style: effectiveTextStyle, onSelectionChanged: () => { if (this._hasFocus) { return; } FocusScope.of(this.context).requestFocus(this.widget.focusNode); }, selectionColor: this.widget.selectionColor ?? Colors.blue); return(new IgnorePointer( ignoring: false, child: new RichTextSelectionGestureDetector( onTapDown: this._handleTapDown, onSingleTapUp: this._handleSingleTapUp, onSingleTapCancel: this._handleSingleTapCancel, onSingleLongTapStart: this._handleLongPress, onDragSelectionStart: this._handleDragSelectionStart, onDragSelectionUpdate: this._handleDragSelectionUpdate, behavior: HitTestBehavior.translucent, child: child ) )); }
public override Widget build(BuildContext context) { // When overriding ListView.padding, it is necessary to manually handle // safe areas. float windowBottomPadding = MediaQuery.of(context).padding.bottom; return(new KeyedSubtree( key: Key.key("GalleryDemoList"), // So the tests can find this ListView child: new ListView( dragStartBehavior: DragStartBehavior.down, key: Key.key(this.category.name), padding: EdgeInsets.only(top: 8.0f, bottom: windowBottomPadding), children: GalleryDemo.kGalleryCategoryToDemos[this.category] .Select <GalleryDemo, Widget>((GalleryDemo demo) => { return new _DemoItem(demo: demo); }) .ToList() ) )); }
void _setAnimationPosition(BuildContext context) { if (this._position != null) { return; } var screenHeight = MediaQuery.of(context).size.height; var screenWidth = MediaQuery.of(context).size.width; var ratio = 1.0f - 64.0f / (screenHeight - screenWidth * 9.0f / 16.0f); this._position = new OffsetTween( new Offset(0, ratio), new Offset(0, 0) ).animate(new CurvedAnimation(this._controller, Curves.easeInOut )); }
public override Widget build(BuildContext context) { return(new StoreConnector <AppState, object>( converter: state => null, builder: ((buildContext, model, dispatcher) => new Container( margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10), child: new ListView( children: new List <Widget> { //使用封装 new ThemeColorButton("Red", Colors.red, () => { dispatcher.dispatch(new ChangeThemeColorAction(ThemeColors.Red)); }), new Divider(), new GestureDetector( onTap: () => { dispatcher.dispatch(new ChangeThemeColorAction(ThemeColors.Teal)); }, child: new Container( width: MediaQuery.of(context).size.width, height: 200, color: Colors.teal, child: new Center(child: new Text("TealTheme", style: new TextStyle(color: Colors.white))))), new Divider(), new GestureDetector( onTap: () => { dispatcher.dispatch(new ChangeThemeColorAction(ThemeColors.Blue)); }, child: new Container( width: MediaQuery.of(context).size.width, height: 200, color: Colors.blue, child: new Center(child: new Text("BlueTheme", style: new TextStyle(color: Colors.white)) ))), new Divider(), new TimerSlider() } ))))); }
public override Widget build(BuildContext context) { var mediaQueryData = MediaQuery.of(context); var px = mediaQueryData.size.width / 2; var py = mediaQueryData.size.width / 2; var container = new Container( color: CLColors.background3, child: new Container( color: CLColors.background3, child: new Transform( transform: Matrix3.makeRotate(Mathf.PI / 180 * 5, px, py), child: new Column( children: new List <Widget> { this._buildHeader(context), this._buildContentList(context), } ) ) ) ); var stack = new Stack( children: new List <Widget> { container, new Positioned( top: 50, right: 50, child: new BackdropFilter( filter: ImageFilter.blur(10, 10), child: new Container( width: 300, height: 300, decoration: new BoxDecoration( color: Colors.transparent ) ) ) ) } ); return(stack); }
public override Widget build(BuildContext context) { var eventObj = new IEvent(); if (this.widget.viewModel.eventsDict.ContainsKey(this.widget.viewModel.eventId)) { eventObj = this.widget.viewModel.eventsDict[this.widget.viewModel.eventId]; } if (this._topPadding != MediaQuery.of(context).padding.top&& Application.platform != RuntimePlatform.Android) { this._topPadding = MediaQuery.of(context).padding.top; } if ((this.widget.viewModel.eventDetailLoading || eventObj?.user == null) && !eventObj.isNotFirst) { return(new EventDetailLoading(eventType: EventType.offline, mainRouterPop: this.widget.actionModel.mainRouterPop)); } var eventStatus = DateConvert.GetEventStatus(eventObj.begin); return(new Container( color: CColors.White, child: new CustomSafeArea( top: false, child: new Container( color: CColors.White, child: new NotificationListener <ScrollNotification>( onNotification: notification => this._onNotification(context, notification), child: new Column( children: new List <Widget> { this._buildEventDetail(eventObj), this._buildOfflineRegisterNow(eventObj, this.widget.viewModel.isLoggedIn, eventStatus) } ) ) ) ) )); }
public override Widget build(BuildContext context) { float bottomPadding = MediaQuery.of(context).padding.bottom; Widget result = new DecoratedBox( decoration: new BoxDecoration( border: this.border, color: this.backgroundColor ?? CupertinoTheme.of(context).barBackgroundColor ), child: new SizedBox( height: BottomAppBarUtils._kTabBarHeight + bottomPadding, child: IconTheme.merge( // Default with the inactive state. data: new IconThemeData( color: this.inactiveColor, size: this.iconSize ), child: new DefaultTextStyle( // Default with the inactive state. style: CupertinoTheme.of(context).textTheme.tabLabelTextStyle .copyWith(color: this.inactiveColor), child: new Padding( padding: EdgeInsets.only(bottom: bottomPadding), child: new Row( crossAxisAlignment: CrossAxisAlignment.end, children: this._buildTabItems(context) ) ) ) ) ) ); if (!this.opaque(context)) { result = new ClipRect( child: new BackdropFilter( filter: ImageFilter.blur(sigmaX: 10.0f, sigmaY: 10.0f), child: result ) ); } return(result); }
public override Widget build(BuildContext context) { D.assert(!widget.primary || WidgetsD.debugCheckHasMediaQuery(context)); float?topPadding = widget.primary ? MediaQuery.of(context).padding.top : 0.0f; float?collapsedHeight = (widget.pinned && widget.floating && widget.bottom != null) ? widget.bottom.preferredSize.height + topPadding : null; return(MediaQuery.removePadding( context: context, removeBottom: true, child: new SliverPersistentHeader( floating: widget.floating, pinned: widget.pinned, del: new _SliverAppBarDelegate( leading: widget.leading, automaticallyImplyLeading: widget.automaticallyImplyLeading, title: widget.title, actions: widget.actions, flexibleSpace: widget.flexibleSpace, bottom: widget.bottom, elevation: widget.elevation, forceElevated: widget.forceElevated, backgroundColor: widget.backgroundColor, brightness: widget.brightness, iconTheme: widget.iconTheme, actionsIconTheme: widget.actionsIconTheme, textTheme: widget.textTheme, primary: widget.primary, centerTitle: widget.centerTitle, titleSpacing: widget.titleSpacing, expandedHeight: widget.expandedHeight, collapsedHeight: collapsedHeight, topPadding: topPadding, floating: widget.floating, pinned: widget.pinned, shape: widget.shape, snapConfiguration: _snapConfiguration, stretchConfiguration: _stretchConfiguration ) ) )); }
public override Widget build(BuildContext context) { D.assert(WidgetsD.debugCheckHasDirectionality(context)); if (route.scrollController == null) { _MenuLimits menuLimits = route.getMenuLimits(buttonRect, constraints.maxHeight, selectedIndex ?? 0); route.scrollController = new ScrollController(initialScrollOffset: menuLimits.scrollOffset ?? 0); } TextDirection textDirection = Directionality.of(context); Widget menu = new _DropdownMenu <T>( route: route, padding: padding.resolve(textDirection), buttonRect: buttonRect, constraints: constraints, dropdownColor: dropdownColor ); if (theme != null) { menu = new Theme(data: theme, child: menu); } return(MediaQuery.removePadding( context: context, removeTop: true, removeBottom: true, removeLeft: true, removeRight: true, child: new Builder( builder: (BuildContext _context) => { return new CustomSingleChildLayout( layoutDelegate: new _DropdownMenuRouteLayout <T>( buttonRect: buttonRect, route: route, textDirection: textDirection ), child: menu ); } ) )); }
public override Widget build(BuildContext context) { float textScaleFactor = MediaQuery.textScaleFactorOf(context); return(new Container( constraints: new BoxConstraints(minHeight: GalleryOptionUtils._kItemHeight *textScaleFactor), padding: GalleryOptionUtils._kItemPadding, alignment: AlignmentDirectional.centerStart, child: new DefaultTextStyle( style: DefaultTextStyle.of(context).style, maxLines: 2, overflow: TextOverflow.fade, child: new IconTheme( data: Theme.of(context).primaryIconTheme, child: this.child ) ) )); }
public Using(string rawPath, MediaQuery media, int start, int stop, string file) { RawPath = rawPath; MediaQuery = media; Start = start; Stop = stop; FilePath = file; }
public InnerMediaProperty(MediaQuery media, SelectorAndBlock block, int start, int stop, string file) { MediaQuery = media; Block = block; Start = start; Stop = stop; FilePath = file; }
/// <summary> /// Re-scanns all the media queries on demand /// </summary> /// <exception cref="Exception"></exception> public void Rescan() { _methodInfos = new Dictionary<string, MethodInfo>(); _queries = new Dictionary<string, MediaQuery>(); /*foreach (Type type in GlobalTypeDictionary.Instance.Values) { if (typeof(MediaQueryBase).IsAssignableFrom(type) && typeof(MediaQueryBase) != type) { MediaQueryBase query = (MediaQueryBase)Activator.CreateInstance(type); _queries[query.Id] = query; } }*/ var queries = GuiReflector.GetMethodsInAllLoadedTypesDecoratedWith(typeof (MediaQueryAttribute)); #if DEBUG if (DebugMode) { Debug.Log(string.Format(@"Found {0} media queries", queries.Count)); } #endif foreach (var methodInfo in queries) { if (null == methodInfo.ReturnParameter || methodInfo.ReturnType != typeof (bool)) throw new Exception(@"Method decorated with MediaQuery attribute should return a boolean value: " + methodInfo); var p = methodInfo.GetParameters(); var parameters = new List<Type>(); foreach (var parameterInfo in p) { parameters.Add(parameterInfo.ParameterType); } // get attribute var attributes = CoreReflector.GetMethodAttributes<MediaQueryAttribute>(methodInfo); if (attributes.Count == 0) throw new Exception(@"Cannot find MediaQuery attribute: " + methodInfo); var attribute = attributes[0]; /** * If there is already an existing query with a same ID, allow overriding * only if this is an editor override. This way we'll get all the editor overrides * override the Play mode media queries. * */ if (_methodInfos.ContainsKey(attribute.Id) && !attribute.EditorOverride) continue; _methodInfos[attribute.Id] = methodInfo; MediaQuery query; if (parameters.Count > 0) { var type = parameters[0]; query = (MediaQuery) NameValueBase.CreateProperty<MediaQuery>(attribute.Id, type); //query.Value = type. } else { query = new MediaQuery { Name = attribute.Id, Parameters = parameters.ToArray() }; } _queries[attribute.Id] = query; } #if DEBUG if (DebugMode) { Debug.Log(string.Format(@"Number of queries after overrides: {0}", _queries.Keys.Count)); } #endif #if DEBUG if (DebugMode) { Debug.Log(string.Format(@"Retrieved {0} media queries: {1}", _queries.Count, DictionaryUtil<string, MediaQuery>.Format(_queries))); } #endif }
private static void VerifyPossible(MediaQuery query, IPosition on) { var comma = query as CommaDelimitedMedia; if (comma != null) { foreach (var part in comma.Clauses) { VerifyPossible(part, part); } return; } var only = query as OnlyMedia; if (only != null) { VerifyPossible(only.Clause, on); return; } var not = query as NotMedia; if (not != null) { VerifyPossible(not.Clause, on); return; } // Type and nothing else is always possible var type = query as MediaType; if (type != null) { return; } var and = query as AndMedia; type = and.LeftHand as MediaType; var unrollStack = new Stack<MediaQuery>(); unrollStack.Push(and); var eqs = new List<EqualFeatureMedia>(); var mins = new List<MinFeatureMedia>(); var maxs = new List<MaxFeatureMedia>(); var has = new List<FeatureMedia>(); while (unrollStack.Count > 0) { var top = unrollStack.Pop(); if (top is AndMedia) { var innerAnd = (AndMedia)top; unrollStack.Push(innerAnd.LeftHand); unrollStack.Push(innerAnd.RightHand); } if (top is EqualFeatureMedia) { eqs.Add((EqualFeatureMedia)top); continue; } if (top is MinFeatureMedia) { mins.Add((MinFeatureMedia)top); continue; } if (top is MaxFeatureMedia) { maxs.Add((MaxFeatureMedia)top); continue; } if (top is FeatureMedia) { has.Add((FeatureMedia)top); continue; } } var multipleMins = mins.GroupBy(g => g.Feature.ToLowerInvariant()).Where(w => w.Count() > 1); var multipleMaxs = maxs.GroupBy(g => g.Feature.ToLowerInvariant()).Where(w => w.Count() > 1); var multipleHas = has.GroupBy(g => g.Feature.ToLowerInvariant()).Where(w => w.Count() > 1); var multipleEqs = eqs.GroupBy(g => g.Feature.ToLowerInvariant()).Where(w => w.Count() > 1); var continueCheck = true; if (multipleMins.Count() > 0) { foreach (var a in multipleMins) { Current.RecordError(ErrorType.Compiler, on, "'" + a.Key + "' has multiple minimum constraints"); } continueCheck = false; } if (multipleMaxs.Count() > 0) { foreach (var a in multipleMaxs) { Current.RecordError(ErrorType.Compiler, on, "'" + a.Key + "' has multiple maximum constraints"); } continueCheck = false; } if (multipleHas.Count() > 0) { foreach (var a in multipleHas) { Current.RecordError(ErrorType.Compiler, on, "'" + a.Key + "' has multiple present constraints"); } continueCheck = false; } if (multipleEqs.Count() > 0) { foreach (var a in multipleEqs) { Current.RecordError(ErrorType.Compiler, on, "'" + a.Key + "' has multiple equality constraints"); } continueCheck = false; } if (!continueCheck) return; foreach (var h in has) { if (!IsSetFeature(type.Type, h.Feature)) { Current.RecordError(ErrorType.Compiler, on, "'" + h.Feature + "' is never set for media type '" + type.Type + "', making this query unsatisfiable"); } } foreach (var min in mins) { var pairedMax = maxs.SingleOrDefault(w => w.Feature.Equals(min.Feature, StringComparison.InvariantCultureIgnoreCase)); if (pairedMax == null) continue; if (min.Min > pairedMax.Max) { Current.RecordError(ErrorType.Compiler, on, "'" + min.Feature + "' is impossibly constrained, [" + min.Min + " < " + pairedMax.Max + "] is impossible"); } } }
private static void VerifyQuery(MediaQuery query) { VerifyTypes(query); VerifyPossible(query, query); }
private static void VerifyTypes(MediaQuery query) { var compound = query as CommaDelimitedMedia; if (compound != null) { foreach (var part in compound.Clauses) { VerifyTypes(part); } return; } var not = query as NotMedia; if (not != null) { VerifyTypes(not.Clause); return; } var only = query as OnlyMedia; if (only != null) { VerifyTypes(only.Clause); return; } var and = query as AndMedia; if (and != null) { VerifyTypes(and.LeftHand); VerifyTypes(and.RightHand); return; } var min = query as MinFeatureMedia; if (min != null) { if (!IsValidFeature(min.Feature)) { Current.RecordError(ErrorType.Compiler, min, "'" + min.Feature + "' is not a valid feature for a media query."); } else { if (!IsValidMinMax(min.Feature)) { Current.RecordError(ErrorType.Compiler, min, "'" + min.Feature + "' cannot have a minimum constraint in a media query."); } else { if (!IsValidTypeFor(min.Feature, min.Min)) { Current.RecordError(ErrorType.Compiler, min, "'" + min.Min + "' is not a valid parameter for media query feature '" + min.Feature + "'."); } } } return; } var max = query as MaxFeatureMedia; if (max != null) { if (!IsValidFeature(max.Feature)) { Current.RecordError(ErrorType.Compiler, max, "'" + max.Feature + "' is not a valid feature for a media query."); } else { if (!IsValidMinMax(max.Feature)) { Current.RecordError(ErrorType.Compiler, max, "'" + max.Feature + "' cannot have a minimum constraint in a media query."); } else { if (!IsValidTypeFor(max.Feature, max.Max)) { Current.RecordError(ErrorType.Compiler, max, "'" + max.Max + "' is not a valid parameter for media query feature '" + max.Feature + "'."); } } } return; } var eq = query as EqualFeatureMedia; if (eq != null) { if (!IsValidFeature(eq.Feature)) { Current.RecordError(ErrorType.Compiler, eq, "'" + eq.Feature + "' is not a valid feature for a media query."); } else { if (!IsValidTypeFor(eq.Feature, eq.EqualsValue)) { Current.RecordError(ErrorType.Compiler, eq, "'" + eq.EqualsValue + "' is not a valid parameter for media query feature '" + eq.Feature + "'."); } } return; } var feature = query as FeatureMedia; if(feature != null) { if (!IsValidFeature(feature.Feature)) { Current.RecordError(ErrorType.Compiler, eq, "'" + feature.Feature + "' is not a valid feature for a media query."); } return; } if (query is MediaType) { return; } throw new InvalidOperationException("Unexpected media query [" + query + "]"); }
public Import(Value import, MediaQuery forMedia, int start, int stop, string file) { ToImport = import; MediaQuery = forMedia; Start = start; Stop = stop; FilePath = file; }
public MediaBlock(MediaQuery media, List<Block> statements, int start, int stop, string file) { MediaQuery = media; Blocks = statements.AsReadOnly(); Start = start; Stop = stop; FilePath = file; }
private static MediaQuery ForQuery(MediaQuery query) { var not = query as NotMedia; if (not != null) { return new NotMedia(ForQuery(not.Clause), not); } var only = query as OnlyMedia; if (only != null) { return new OnlyMedia(ForQuery(only.Clause), only); } var type = query as MediaType; if (type != null) { return type; } var and = query as AndMedia; if (and != null) { return new AndMedia(ForQuery(and.LeftHand), ForQuery(and.RightHand), and); } var has = query as FeatureMedia; if (has != null) return has; var eq = query as EqualFeatureMedia; if (eq != null) { return new EqualFeatureMedia(eq.Feature, MinifyValue(eq.EqualsValue), eq); } var min = query as MinFeatureMedia; if (min != null) { return new MinFeatureMedia(min.Feature, MinifyValue(min.Min), min); } var max = query as MaxFeatureMedia; if (max != null) { return new MaxFeatureMedia(max.Feature, MinifyValue(max.Max), max); } throw new InvalidOperationException("Unexpected media clause [" + query + "]"); }