public override Widget build(BuildContext context) { var iconColor = this.done ? CColors.PrimaryBlue : new Color(0xFFC7CBCF); var textColor = this.done ? CColors.PrimaryBlue : CColors.TextBody2; var child = new Container( decoration: new BoxDecoration( CColors.Transparent, borderRadius: BorderRadius.circular(4), border: Border.all(CColors.Separator) ), width: 100, height: 40, child: new Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 10), child: new Icon(this.iconData, color: iconColor)), new Text(this.title, style: new TextStyle( height: 1.09f, fontSize: 16, fontFamily: "Roboto-Regular", color: textColor ) ) } ) ); return(new GestureDetector( onTap: this.onTap, child: child )); }
public override Widget build(BuildContext context) { return(new SizedBox( height: 24.0f, child: new Row( children: new List <Widget> { new SizedBox( width: 24.0f, child: new ClipRRect( borderRadius: BorderRadius.circular(12.0f), child: Image.asset( this.vendor.avatarAsset, fit: BoxFit.cover ) ) ), new SizedBox(width: 8.0f), new Expanded( child: new Text(this.vendor.name, style: ShrineTheme.of(context).vendorItemStyle) ) } ) )); }
Widget _buildChatTextField() { return(new CupertinoTextField( controller: _chatTextController, textCapitalization: TextCapitalization.sentences, placeholder: "Text Message", decoration: new BoxDecoration( border: Border.all( width: 0.0f, color: CupertinoColors.inactiveGray ), borderRadius: BorderRadius.circular(15.0f) ), maxLines: null, keyboardType: TextInputType.multiline, prefix: new Padding(padding: EdgeInsets.symmetric(horizontal: 4.0f)), suffix: new Padding( padding: EdgeInsets.symmetric(horizontal: 4.0f), child: new CupertinoButton( color: CupertinoColors.activeGreen, minSize: 0.0f, child: new Icon( CupertinoIcons.up_arrow, size: 21.0f, color: CupertinoColors.white ), padding: EdgeInsets.all(2.0f), borderRadius: BorderRadius.circular(15.0f), onPressed: () => setState(() => _chatTextController.clear()) ) ), autofocus: true, suffixMode: OverlayVisibilityMode.editing, onSubmitted: (string text) => setState(() => _chatTextController.clear()) )); }
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) } ) ) } ) ) ) )); }
public override Widget build(BuildContext context) { MediaQueryData mediaQueryData = MediaQuery.of(context); D.assert(widget.animation != null); ThemeData theme = Theme.of(context); ColorScheme colorScheme = theme.colorScheme; SnackBarThemeData snackBarTheme = theme.snackBarTheme; bool isThemeDark = theme.brightness == Brightness.dark; Brightness brightness = isThemeDark ? Brightness.light : Brightness.dark; Color themeBackgroundColor = isThemeDark ? colorScheme.onSurface : Color.alphaBlend(colorScheme.onSurface.withOpacity(0.80f), colorScheme.surface); ThemeData inverseTheme = new ThemeData( brightness: brightness, backgroundColor: themeBackgroundColor, colorScheme: new ColorScheme( primary: colorScheme.onPrimary, primaryVariant: colorScheme.onPrimary, secondary: isThemeDark ? colorScheme.primaryVariant : colorScheme.secondary, secondaryVariant: colorScheme.onSecondary, surface: colorScheme.onSurface, background: themeBackgroundColor, error: colorScheme.onError, onPrimary: colorScheme.primary, onSecondary: colorScheme.secondary, onSurface: colorScheme.surface, onBackground: colorScheme.background, onError: colorScheme.error, brightness: brightness ), snackBarTheme: snackBarTheme ); TextStyle contentTextStyle = snackBarTheme.contentTextStyle ?? inverseTheme.textTheme.subtitle1; SnackBarBehavior snackBarBehavior = widget.behavior ?? snackBarTheme.behavior ?? SnackBarBehavior.fix; bool isFloatingSnackBar = snackBarBehavior == SnackBarBehavior.floating; float snackBarPadding = isFloatingSnackBar ? 16.0f : 24.0f; CurvedAnimation heightAnimation = new CurvedAnimation(parent: widget.animation, curve: SnackBarUtils._snackBarHeightCurve); CurvedAnimation fadeInAnimation = new CurvedAnimation(parent: widget.animation, curve: SnackBarUtils._snackBarFadeInCurve); CurvedAnimation fadeOutAnimation = new CurvedAnimation( parent: widget.animation, curve: SnackBarUtils._snackBarFadeOutCurve, reverseCurve: new Threshold(0.0f) ); var childrenList = new List <Widget>() { new SizedBox(width: snackBarPadding), new Expanded( child: new Container( padding: EdgeInsets.symmetric(vertical: SnackBarUtils._singleLineVerticalPadding), child: new DefaultTextStyle( style: contentTextStyle, child: widget.content ) ) ) }; if (widget.action != null) { childrenList.Add(new ButtonTheme( textTheme: ButtonTextTheme.accent, minWidth: 64.0f, padding: EdgeInsets.symmetric(horizontal: snackBarPadding), child: widget.action )); } else { childrenList.Add(new SizedBox(width: snackBarPadding)); } Widget snackBar = new SafeArea( top: false, bottom: !isFloatingSnackBar, child: new Row( crossAxisAlignment: CrossAxisAlignment.center, children: childrenList ) ); float elevation = widget.elevation ?? snackBarTheme.elevation ?? 6.0f; Color backgroundColor = widget.backgroundColor ?? snackBarTheme.backgroundColor ?? inverseTheme.backgroundColor; ShapeBorder shape = widget.shape ?? snackBarTheme.shape ?? (isFloatingSnackBar ? new RoundedRectangleBorder(borderRadius: BorderRadius.circular(4.0f)) : null); snackBar = new Material( shape: shape, elevation: elevation, color: backgroundColor, child: new Theme( data: inverseTheme, child: mediaQueryData.accessibleNavigation ? snackBar : new FadeTransition( opacity: fadeOutAnimation, child: snackBar ) ) ); if (isFloatingSnackBar) { snackBar = new Padding( padding: EdgeInsets.fromLTRB(15.0f, 5.0f, 15.0f, 10.0f), child: snackBar ); } snackBar = new Dismissible( key: Key.key("dismissible"), direction: DismissDirection.down, resizeDuration: null, onDismissed: (DismissDirection? direction) => { Scaffold.of(context).removeCurrentSnackBar(reason: SnackBarClosedReason.swipe); }, child: snackBar ); Widget snackBarTransition = null; if (mediaQueryData.accessibleNavigation) { snackBarTransition = snackBar; } else if (isFloatingSnackBar) { snackBarTransition = new FadeTransition( opacity: fadeInAnimation, child: snackBar ); } else { snackBarTransition = new AnimatedBuilder( animation: heightAnimation, builder: (BuildContext subContext, Widget subChild) => { return(new Align( alignment: AlignmentDirectional.topStart, heightFactor: heightAnimation.value, child: subChild )); }, child: snackBar ); } return(new ClipRect(child: snackBarTransition)); }
public static MarkdownStyleSheet fromTheme(ThemeData theme) { return(new MarkdownStyleSheet( a: new TextStyle(true, Colors.blue), p: theme.textTheme.body1, code: theme.textTheme.body1.copyWith( null, null, Colors.grey.shade200, "monospace", null, theme.textTheme.body1.fontSize * 0.85f, null, null, null, null, null, null, null, null, null, null, null, null, null, null ), h1: theme.textTheme.headline, h2: theme.textTheme.title, h3: theme.textTheme.subhead, h4: theme.textTheme.body2, h5: theme.textTheme.body2, h6: theme.textTheme.body2, em: new TextStyle(fontStyle: FontStyle.italic), strong: new TextStyle(fontWeight: FontWeight.bold), del: new TextStyle(decoration: TextDecoration.lineThrough), blockquote: theme.textTheme.body1, img: theme.textTheme.body1, checkbox: theme.textTheme.body1.copyWith( color: theme.primaryColor ), blockSpacing: 8.0f, listIndent: 24.0f, listBullet: theme.textTheme.body1, tableHead: new TextStyle(fontWeight: FontWeight.w600), tableBody: theme.textTheme.body1, tableHeadAlign: TextAlign.center, tableBorder: TableBorder.all(color: Colors.grey.shade300, width: 0), tableColumnWidth: new FlexColumnWidth(), tableCellsPadding: EdgeInsets.fromLTRB(16, 8, 16, 8), tableCellsDecoration: new BoxDecoration(color: Colors.grey.shade50), blockquotePadding: EdgeInsets.all(8.0f), blockquoteDecoration: new BoxDecoration( color: Colors.blue.shade100, borderRadius: BorderRadius.circular(2.0f) ), codeblockPadding: EdgeInsets.all(8.0f), codeblockDecoration: new BoxDecoration( color: Colors.grey.shade200, borderRadius: BorderRadius.circular(2.0f) ), horizontalRuleDecoration: new BoxDecoration( border: new Border( top: new BorderSide(width: 5.0f, color: Colors.grey.shade300) ) ) )); }
public static Widget SettingHSVColorPicker( BuildContext context, string title, ValueChanged <Color> onColorChanged, Color color = null, string buttonName = "", bool enableAlpha = false, bool showPreviousColor = false ) { if (color == null) { color = Colors.blueAccent; } if (buttonName == "") { buttonName = color.ToHexString(enableAlpha); } return(new Container( padding: EdgeInsets.symmetric(horizontal: 6f), child: new Row( children: new List <Widget> { new Container(child: new Text(title)), new Expanded( child: new Container( padding: EdgeInsets.all(6), alignment: Alignment.bottomRight, child: new RaisedButton( color: color, child: new Text( buttonName, style: new TextStyle( color: Utils.useWhiteForeground(color) ? Colors.white : Colors.black ) //TextStyle ), //Text onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { if (showPreviousColor) { return new AlertDialog( titlePadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0f), shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(25) ), //RoundedRectangleBorder content: new SingleChildScrollView( child: new SlidePicker( pickerColor: color, onColorChanged: onColorChanged, paletteType: PaletteType.hsv, enableAlpha: enableAlpha, displayThumbColor: true, showLabel: false, showIndicator: true, indicatorBorderRadius: BorderRadius.vertical(top: Radius.circular(25)) ) //SlidePicker ) //SingleChildScrollView ); //AlertDialog } else { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new ColorPicker( pickerColor: color, onColorChanged: onColorChanged, colorPickerWidth: 300f, pickerAreaHeightPercent: 0.7f, enableAlpha: enableAlpha, displayThumbColor: true, showLabel: true, paletteType: PaletteType.hsv, pickerAreaBorderRadius: BorderRadius.only( topLeft: Radius.circular(2f), topRight: Radius.circular(2f) ) //BorderRadius ) //ColorPicker ) //SingleChildScrollView ); //AlertDialog } } ); } ) ) //container ), //expanded } //list ) //row )); }
public override void initState() { base.initState(); var channel = widget.channels[widget.selectedChannelId]; m_MuteController = new SwitchController(channel.isMute); m_PinController = new SwitchController(!string.IsNullOrEmpty(channel.stickTime)); m_Quiting = false; m_AmIOwner = widget.members.ContainsKey(channel.id) && widget.members[channel.id].Any(member => member.user.id == Window.currentUserId && member.role == "owner"); m_MuteController.addListener(MuteControllerListener); m_PinController.addListener(PinControllerListener); m_AnimationController = new AnimationController( vsync: this, duration: new TimeSpan(0, 0, 0, 0, milliseconds: 240) ); m_AnimationController.addListener(() => setState()); m_AnimationController.addStatusListener(AnimationStatusListener); _showCopiedTip = false; SchedulerBinding.instance.addPostFrameCallback(value => { if (MediaQuery.of(context).size.width < 750) { m_AnimationController.forward(); } _copiedTipEntry = new OverlayEntry(buildContext => { var left = 0.0f; if (MediaQuery.of(buildContext).size.width >= 750) { left = 375; } return(new Positioned( top: 64 + 40, left: left, right: 0, child: new IgnorePointer( child: new Container( height: 40, alignment: Alignment.center, child: new Row( mainAxisSize: MainAxisSize.min, children: new List <Widget> { new AnimatedOpacity( opacity: _showCopiedTip ? 1 : 0, duration: new TimeSpan(0, 0, 0, 0, 240), curve: Curves.fastOutSlowIn, child: new Container( decoration: new BoxDecoration( borderRadius: BorderRadius.circular(20), color: new Color(0x99000000) ), padding: EdgeInsets.symmetric(horizontal: 24), alignment: Alignment.center, child: new Text( "已复制群聊链接,请前往粘贴分享", style: new TextStyle( fontSize: 16, color: new Color(0xffffffff), fontFamily: "PingFang" ) ) ) ), } ) ) ) )); }); Overlay.of(context).insert(_copiedTipEntry); }); }
Widget _buildFollowButton(bool isTop = false) { if (this.widget.viewModel.isLoggedIn && this.widget.viewModel.currentUserId == this.widget.viewModel.team.id) { return(new Container()); } bool isFollow = false; string followText = "关注"; Color followBgColor = CColors.PrimaryBlue; GestureTapCallback onTap = () => { this.widget.actionModel.startFollowTeam(); this.widget.actionModel.followTeam(arg: this.widget.viewModel.team.id); }; if (this.widget.viewModel.isLoggedIn && this.widget.viewModel.followMap.ContainsKey(key: this.widget.viewModel.team.id)) { isFollow = true; followText = "已关注"; followBgColor = CColors.Transparent; onTap = () => { ActionSheetUtils.showModalActionSheet( new ActionSheet( title: "确定不再关注?", items: new List <ActionSheetItem> { new ActionSheetItem("确定", type: ActionType.normal, () => { this.widget.actionModel.startUnFollowTeam(); this.widget.actionModel.unFollowTeam(arg: this.widget.viewModel.team.id); }), new ActionSheetItem("取消", type: ActionType.cancel) } ) ); }; } Widget buttonChild; bool isEnable; if (this.widget.viewModel.team.followTeamLoading ?? false) { buttonChild = new CustomActivityIndicator( loadingColor: isTop ? LoadingColor.black : LoadingColor.white, size: LoadingSize.small ); isEnable = false; } else { buttonChild = new Text( data: followText, style: isTop ? new TextStyle( fontSize: 14, fontFamily: "Roboto-Medium", color: isFollow ? new Color(0xFF959595) : CColors.PrimaryBlue ) : CTextStyle.PMediumWhite ); isEnable = true; } if (isTop) { return(new CustomButton( padding: EdgeInsets.zero, child: new Container( width: 60, height: 28, alignment: Alignment.center, decoration: new BoxDecoration( color: CColors.Transparent, borderRadius: BorderRadius.circular(14), border: isFollow ? Border.all(color: CColors.Disable2) : Border.all(color: CColors.PrimaryBlue) ), child: buttonChild ), onPressed: () => { if (!isEnable) { return; } if (this.widget.viewModel.isLoggedIn) { onTap(); } else { this.widget.actionModel.pushToLogin(); } } )); } return(new CustomButton( padding: EdgeInsets.zero, child: new Container( width: 100, height: 32, alignment: Alignment.center, decoration: new BoxDecoration( color: followBgColor, borderRadius: BorderRadius.all(4), border: isFollow ? Border.all(CColors.White) : null ), child: buttonChild ), onPressed: () => { if (!isEnable) { return; } if (this.widget.viewModel.isLoggedIn) { onTap(); } else { this.widget.actionModel.pushToLogin(); } } )); }
Widget _buildNavigationBar() { Widget titleWidget; if (this._isHaveTitle) { var name = ""; if (this.widget.viewModel.type == LeaderBoardType.collection) { if (this.widget.viewModel.favoriteTagDict.isNotEmpty() && this.widget.viewModel.rankData != null && this.widget.viewModel.favoriteTagDict.ContainsKey(this.widget.viewModel.rankData.itemId)) { var favoriteTag = this.widget.viewModel.favoriteTagDict[this.widget.viewModel.rankData.itemId]; name = this.widget.viewModel.rankData.resetTitle.isNotEmpty() ? this.widget.viewModel.rankData.resetTitle : favoriteTag?.name; } } else { if (this.widget.viewModel.userDict.isNotEmpty() && this.widget.viewModel.rankData != null && this.widget.viewModel.userDict.ContainsKey(this.widget.viewModel.rankData.itemId)) { var user = this.widget.viewModel.userDict[this.widget.viewModel.rankData.itemId]; name = this.widget.viewModel.rankData.resetTitle.isNotEmpty() ? this.widget.viewModel.rankData.resetTitle : $"{user.fullName}的专栏"; } } titleWidget = new Text( name, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center ); } else { titleWidget = new Container(); } Widget buttonChild; Color buttonColor = CColors.PrimaryBlue; if (this.widget.viewModel.collectLoading) { buttonColor = CColors.Disable2; buttonChild = new CustomActivityIndicator( size: LoadingSize.xSmall ); } else { string buttonText = "收藏"; Color textColor = CColors.PrimaryBlue; if (this._fetchButtonState()) { buttonText = $"已收藏"; buttonColor = CColors.Disable2; textColor = new Color(0xFF959595); } buttonChild = new Text( data: buttonText, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Medium", color: textColor ) ); } var child = this.widget.viewModel.type == LeaderBoardType.column ? this._buildFollowButton() : this.widget.viewModel.isHost ? (Widget) new Container() : new CustomButton( onPressed: this._onPressed, padding: EdgeInsets.zero, child: new Container( width: 60, height: 28, alignment: Alignment.center, decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.circular(14), border: Border.all(color: buttonColor) ), child: buttonChild ) ); Widget rightWidget = new Container(); if (this._isHaveTitle) { rightWidget = new Padding( padding: EdgeInsets.symmetric(horizontal: 16), child: child); } return(new CustomAppBar( () => this.widget.actionModel.mainRouterPop(), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ), rightWidget: rightWidget, backgroundColor: this._isHaveTitle ? CColors.White : CColors.Background, bottomSeparatorColor: this._isHaveTitle ? CColors.Separator2 : CColors.Transparent )); }
public override Widget build(BuildContext context) { return(new Theme( data: new ThemeData( appBarTheme: new AppBarTheme( color: Colors.purple ), cardTheme: new CardTheme( color: Colors.white, elevation: 2.0f ) ), child: new Scaffold( appBar: new AppBar(title: new Text("Custom Inspector")), body: new ListView( children: new List <Widget> { new Card( clipBehavior: Clip.antiAlias, margin: EdgeInsets.all(20.0f), shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0f) ), child: new Container( padding: EdgeInsets.symmetric(vertical: 20f, horizontal: 10f), child: new Column( mainAxisSize: MainAxisSize.min, children: new List <Widget> { new UnityObjectDetector( // When receiving a GameObject, get its transfrom. onRelease: (details) => { this.setState(() => { var gameObj = details.objectReferences[0] as GameObject; if (gameObj) { this.objectRef = gameObj; if (this.objectRef) { this.transformRef = this.objectRef.transform; } } }); }, child: new ListTile( title: new Text( this.objectRef == null ? "Object Name" : this.objectRef.name, style: new TextStyle(fontSize: 28.0f)), subtitle: new Text("Drag an object here", style: new TextStyle(fontSize: 16.0f)), contentPadding: EdgeInsets.symmetric(horizontal: 10f) ) ), new Card( clipBehavior: Clip.antiAlias, shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0f) ), child: new Container( padding: EdgeInsets.symmetric(horizontal: 10.0f), child: new Column( mainAxisSize: MainAxisSize.min, children: new List <Widget> { new Container( padding: EdgeInsets.only(top: 20f), child: new Align( alignment: Alignment.centerLeft, child: new Text("Transform", style: new TextStyle(fontSize: 20.0f)) ) ), this.getCardRow(ETransfrom.Position, this.objectRef != null), this.getCardRow(ETransfrom.Rotation, this.objectRef != null), this.getCardRow(ETransfrom.Scale, this.objectRef != null), new Container(padding: EdgeInsets.only(bottom: 20f)) } ) ) ), } ) ) ) } ) ) )); }
public override Widget build(BuildContext context) { return(new GestureDetector( onTap: () => { mOnClick(); }, child: new Padding( padding: EdgeInsets.all(8), child: new Container( padding: EdgeInsets.all(8), child: new Container( padding: EdgeInsets.all(8), decoration: new BoxDecoration( color: AppConst.Colors[mNote.ColorIndex], border: Border.all(width: 2, color: Colors.black), borderRadius: BorderRadius.circular(8.0f) ), child: new Column( children: new List <Widget>() { new Row( children: new List <Widget>() { new Expanded( child: new Padding( padding: EdgeInsets.all(8.0f), child: new Text(mNote.Title, style: Theme.of(context).textTheme.title ) ) ), new Text(Utils.PriorityText(mNote.Priority), style: new TextStyle(color: Utils.PriorityColor(mNote.Priority))) } ), new Padding( padding: EdgeInsets.all(8.0f), child: new Row( mainAxisAlignment: MainAxisAlignment.start, children: new List <Widget>() { new Expanded( child: new Text( mNote.Description ?? "", style: Theme.of(context).textTheme.subhead ) ) } ) ), new Row( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget>() { new Text(mNote.Date, style: Theme.of(context).textTheme.subtitle ) } ) } ) ) ) ) )); }
public override Widget build(BuildContext context) { if (!_everBuild) { _everBuild = true; widget.OnBuild?.Invoke(); } var sendByMe = widget.Msg.author.id == Window.currentUserId; Widget content = null; var mediaQueryData = MediaQuery.of(context); var maxWidth = mediaQueryData.size.width * 0.7f; if (mediaQueryData.size.width > 750) { maxWidth -= 262.5f; } if (!string.IsNullOrEmpty(widget.Msg.deletedTime)) { content = new Container( padding: EdgeInsets.all(12), constraints: new BoxConstraints( maxWidth: maxWidth ), decoration: new BoxDecoration( color: sendByMe ? new Color(0xffc5e8ff) : new Color(0xfff0f0f0), borderRadius: BorderRadius.circular(10) ), child: new SelectableText( textSpan: new TextSpan( text: "此条消息已被删除", style: DeletedTextStyle ), focusNode: _focusNode, selectionColor: new Color(0xffd8d8d8) ) ); } else if (widget.Msg.content != null && widget.Msg.content.isNotEmpty()) { var contentChildren = new List <Widget> { new SelectableText( textSpan: ParseMessage( widget.Msg.content ?? "", widget.Users, textStyle: widget.Msg.id == null ? SendingTextStyle : null, defaultOnTapUp: OnTapUp ), focusNode: _focusNode, selectionColor: new Color(0xffd8d8d8), onTapUp: OnTapUp ), }; if (!widget.Msg.embeds.isEmpty()) { contentChildren.Add(new Container(height: 6)); contentChildren.Add(new MessageEmbed( message: widget.Msg, onClickUrl: (details, url) => { OnTapUp(details); if (details.kind == PointerDeviceKind.mouse && details.device == InputUtils.MouseLeftKeyDevice) { Launch(url); } })); } content = new GestureDetector( onTapUp: OnTapUp, child: new Container( padding: EdgeInsets.all(12), constraints: new BoxConstraints( maxWidth: maxWidth ), decoration: new BoxDecoration( color: sendByMe ? new Color(0xffc5e8ff) : new Color(0xfff0f0f0), borderRadius: BorderRadius.circular(10) ), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: contentChildren ) ) ); } else if (widget.Msg.attachments.Count > 0) { var attachment = widget.Msg.attachments.first(); var contentType = attachment.contentType; if (contentType == "image/png" || contentType == "image/jpg" || contentType == "image/jpeg" || contentType == "image/gif") { Widget image = null; if (attachment.local) { image = new ImageWithProgress( image: new FileImage( attachment.url ), attachment.progress ); } else { image = new Image( image: ProxiedImage( $"{attachment.url}.200x0x1.jpg", cookie: $"LS={Window.loginSession};" ), fit: BoxFit.cover ); } content = new GestureDetector( onTapUp: OnTapUp, child: new Container( constraints: new BoxConstraints( maxWidth: 282 ), child: new ClipRRect( borderRadius: BorderRadius.circular(5), child: new AspectRatio( aspectRatio: attachment.width == 0 || attachment.height == 0 ? 1 : (float)attachment.width / attachment.height, child: image ) ) ) ); } else { AssetImage image; if (contentType == "application/pdf") { image = new AssetImage("Images/FilePdf@4x"); } else if (contentType.StartsWith("video/")) { image = new AssetImage("Images/FileVideo@4x"); } else { image = new AssetImage("Images/FileGeneral@4x"); } content = new GestureDetector( onTapUp: OnTapUp, child: new Container( padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12), decoration: new BoxDecoration( color: new Color(0xfff0f0f0), borderRadius: BorderRadius.all(10) ), width: 262, child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text( attachment.filename, style: new TextStyle( fontSize: 16, color: new Color(0xff000000), fontFamily: "PingFang" ) ), new Container( margin: EdgeInsets.only(top: 4), child: new Text( ReadableSize(attachment.size), style: new TextStyle( fontSize: 12, color: new Color(0xff797979), fontFamily: "PingFang" ) ) ) } ) ), new Container( margin: EdgeInsets.only(left: 16), width: 42, height: 48, child: new Image( image: image, width: 42, height: 48, fit: BoxFit.cover ) ) } ) ) ); } } else { return(new Container(height: 0, width: 0)); } var decoratedContent = new List <Widget> { content, }; if (_rightClickFocus.hasFocus) { decoratedContent.Add( new Positioned( top: 0, right: 0, bottom: 0, left: 0, child: new Container( decoration: new BoxDecoration( borderRadius: BorderRadius.all(10), color: new Color(0x1a000000) ) ) ) ); } if (_fetchingUrl) { decoratedContent.Add( new Positioned( top: 0, right: 0, bottom: 0, left: 0, child: new Container( decoration: new BoxDecoration( borderRadius: BorderRadius.all(10), color: new Color(0x1a000000) ), alignment: Alignment.center, child: new Loading( size: 24, isWhite: true ) ) ) ); } var children = new List <Widget> { new Container( margin: EdgeInsets.only( left: sendByMe ? 10 : 24, right: sendByMe ? 24 : 10 ), child: new Avatar( widget.Msg.author, size: 40 ) ), new Expanded( child: new Column( crossAxisAlignment: sendByMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: new List <Widget> { new Container( height: 20, alignment: sendByMe?Alignment.centerRight: Alignment.centerLeft, margin: EdgeInsets.only(bottom: 6), child: new Text( widget.Msg.author.fullName, style: new TextStyle( fontSize: 12, fontWeight: FontWeight.w500, color: new Color(0xff797979), fontFamily: "PingFang" ) ) ), new Stack( children: decoratedContent ), } ) ), }; if (sendByMe) { children.Reverse(); } Widget result = new Container( margin: EdgeInsets.symmetric(vertical: 8), child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: children ) ); var resultChildren = new List <Widget> { }; if (widget.IsNew) { resultChildren.Add( new Container( height: 36, alignment: Alignment.center, child: new Row( crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Expanded( child: new Container( margin: EdgeInsets.only(right: 8), height: 1, color: new Color(0xffd8d8d8) ) ), new Container( alignment: Alignment.center, child: new Text( "以下为新消息", style: new TextStyle( fontSize: 12, fontWeight: FontWeight.w500, color: new Color(0xff959595), fontFamily: "PingFang" ) ) ), new Expanded( child: new Container( margin: EdgeInsets.only(left: 8), height: 1, color: new Color(0xffd8d8d8) ) ), } ) ) ); } if (widget.ShowTime) { resultChildren.Add( new Container( height: 36, child: new Center( child: new Text( DateTimeString(widget.CreateTime), style: new TextStyle( fontSize: 12, fontWeight: FontWeight.w500, color: new Color(0xff797979), fontFamily: "PingFang" ) ) ) ) ); } resultChildren.Add(result); return(new Column( children: resultChildren )); }
public override Widget build(BuildContext context) { return(new AlertDialog( shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(10) ), title: new Text(widget.Mode == NotebookEditorMode.CREATION ? L.of(context).CreateNotebook : L.of(context).EditNotebook, style: Theme.of(context).textTheme.title), content: new TextField( onChanged: _ => { setState(() => { }); }, controller: mNameController, style: Theme.of(context).textTheme.body2, decoration: new InputDecoration( hintText: L.of(context).NameOfNotebook ) ), actions: new List <Widget>() { new FlatButton( child: new Text(L.of(context).Delete, style: Theme.of(context) .textTheme .title .copyWith(color: Colors.red) ), onPressed: () => { widget.Dispatcher.dispatch(new DeleteNotebookAction(widget.Notebook)); Navigator.of(context).pop(); } ), !mBtnSaveVisible ? new Container() as Widget : new FlatButton( child: new Text( widget.Mode == NotebookEditorMode.CREATION ? L.of(context).Create : L.of(context).Save, style: Theme.of(context) .textTheme .title .copyWith(color: Colors.purple) ), onPressed: () => { widget.Notebook.Name = mNameController.text; if (widget.Mode == NotebookEditorMode.CREATION) { widget.Dispatcher.dispatch(new AddNotebookAction(widget.Notebook)); } else { widget.Dispatcher.dispatch(new UpdateNotebookAction(widget.Notebook)); } Navigator.pop(context); } ), new FlatButton( child: new Text( L.of(context).Cancel, style: Theme.of(context) .textTheme .title .copyWith(color: Colors.purple) ), onPressed: () => { Navigator.pop(context); } ) } )); }
Widget _buildSelectItem(string title, int index) { Color textColor; float titleFontSize; float lineHeight = this._navBarHeight <= _minNavBarHeight ? 2 : 4; float radius = this._navBarHeight <= _minNavBarHeight ? 0 : 2; Widget lineView; if (index == this._selectedIndex) { textColor = this._navBarHeight <= _minNavBarHeight ? CColors.PrimaryBlue : CColors.TextTitle; titleFontSize = this._titleFontSize; lineView = new Align( alignment: Alignment.bottomCenter, child: new Container( width: 40, height: lineHeight, decoration: new BoxDecoration( color: CColors.PrimaryBlue, borderRadius: BorderRadius.circular(radius: radius) ) ) ); } else { textColor = CColors.TextTitle; titleFontSize = _minTitleFontSize; lineView = new Align( alignment: Alignment.bottomCenter, child: new Container( width: 40, height: lineHeight ) ); } Widget redDot; if (index == 0 && this.widget.viewModel.isLoggedIn && this.widget.viewModel.feedHasNew) { redDot = new Positioned( top: 0, right: 0, child: new Container( width: 8, height: 8, decoration: new BoxDecoration( color: CColors.Error, borderRadius: BorderRadius.circular(4) ) ) ); } else { redDot = new Container(); } return(new CustomButton( onPressed: () => { if (this._selectedIndex != index) { if (index == 0) { if (!this.widget.viewModel.isLoggedIn) { this.widget.actionModel.pushToLogin(); return; } } this.setState(() => this._selectedIndex = index); this._pageController.animateToPage( page: index, TimeSpan.FromMilliseconds(250), curve: Curves.ease ); } }, padding: EdgeInsets.zero, child: new Container( height: this._navBarHeight, child: new Stack( alignment: Alignment.bottomCenter, children: new List <Widget> { new Stack( children: new List <Widget> { new Container( padding: EdgeInsets.only(8, 4, 8, 10), color: CColors.Transparent, child: new Text( data: title, style: new TextStyle( fontSize: titleFontSize, fontFamily: "Roboto-Bold", color: textColor ) ) ), redDot } ), lineView } ) ) )); }
public override Widget build(BuildContext context) { Orientation _orientation = MediaQuery.of(context).orientation; bool _isPortrait = _orientation == Orientation.portrait; Widget _colorList() { var list = new List <Widget>(); if (_isPortrait) { list.Add(new Padding(padding: EdgeInsets.only(top: 7f))); } else { list.Add(new Padding(padding: EdgeInsets.only(left: 7f))); } foreach (var _colors in _colorTypes) { Color _colorType = _colors[0]; list.Add( new GestureDetector( onTap: () => { setState(() => { _currentColor = _colors; }); }, child: new Container( color: new Color(0), padding: (_isPortrait ? EdgeInsets.fromLTRB(0f, 7f, 0f, 7f) : EdgeInsets.fromLTRB(7f, 0f, 7f, 0f)), child: new Align( child: new AnimatedContainer( duration: new TimeSpan(0, 0, 0, 300), width: 25f, height: 25f, decoration: new BoxDecoration( color: _colorType, borderRadius: BorderRadius.circular(60f), //boxShadow: new List<BoxShadow>{ // (_currentColor != _colors ? null : // (_colorType == Theme.of(context).cardColor // ? new BoxShadow(color: Colors.grey[300], blurRadius: 5f) // : new BoxShadow(color: _colorType, blurRadius: 5f) // ) // ) //}, border: (_colorType == Theme.of(context).cardColor ? Border.all(color: Colors.grey[300], width: 1f) : null ) ) //BoxDecoration ) //AnimatedContainer ) //Align ) //Container ) //GestureDetector ); } if (_isPortrait) { list.Add(new Padding(padding: EdgeInsets.only(top: 5f))); } else { list.Add(new Padding(padding: EdgeInsets.only(left: 5f))); } return(new Container( width: (_isPortrait ? (float?)60f : null), height: (_isPortrait ? null : (float?)60f), decoration: new BoxDecoration( border: _isPortrait ? new Border(right: new BorderSide(color: Colors.grey[300], width: 1f)) : new Border(top: new BorderSide(color: Colors.grey[300], width: 1f)) ),//BoxDecoration child: new ListView( scrollDirection: _isPortrait ? Axis.vertical : Axis.horizontal, children: list ) //ListView )); //container }//function _colorList Widget _shadingList() { var list = new List <Widget>(); if (_isPortrait) { list.Add(new Padding(padding: EdgeInsets.only(top: 15f))); } else { list.Add(new Padding(padding: EdgeInsets.only(left: 15f))); } foreach (Color _color in _shadingTypes(_currentColor)) { list.Add( new GestureDetector( onTap: () => { setState(() => { _currentShading = _color; }); widget.onColorChanged(_currentShading); }, child: new Container( color: new Color(0), padding: (_isPortrait ? EdgeInsets.fromLTRB(0f, 7f, 0f, 7f) : EdgeInsets.fromLTRB(7f, 0f, 7f, 0) ), child: new Align( child: new AnimatedContainer( duration: new TimeSpan(0, 0, 0, 300), width: _isPortrait ? 250f : 50f, height: _isPortrait ? 50f : 220f, decoration: new BoxDecoration( color: _color, //boxShadow: new List<BoxShadow>{ // (_currentShading != _color ? null : // (_color == Theme.of(context).cardColor // ? new BoxShadow(color: Colors.grey[300], blurRadius: 5f) // : new BoxShadow(color: _currentShading, blurRadius: 5f) // ) // ) //},//List<BoxShadow> border: (_color == Theme.of(context).cardColor ? Border.all(color: Colors.grey[300], width: 1f) : Border.all(color: Colors.grey[300], width: 1f) ) ),//BoxDecoration child: (_isPortrait && widget.enableLabel ? new Container( color: _color, child: new Align( alignment: Alignment.centerRight, child: new Text( "#" + _color.ToString().Replace("Color(0xFF", "").Replace(")", ""), style: new TextStyle( color: Utils.useWhiteForeground(_color) ? Colors.white : Colors.black, fontWeight: FontWeight.w100 ) //TextStyle ) //Text ) //Align ) : new Container(color: _color) as Widget ) //child ) //AnimatedContainer ) //Align ) //Container ) //GestureDetector ); }//end foreach return(new ListView( scrollDirection: _isPortrait?Axis.vertical: Axis.horizontal, children: list ));//ListView }//_shadingList switch (_orientation) { case Orientation.portrait: return(new SizedBox( height: 500f, width: 300f, child: new Row( children: new List <Widget> { _colorList(), new Expanded( child: new Padding( padding: EdgeInsets.symmetric(horizontal: 12f), child: _shadingList() ) ) } ) )); case Orientation.landscape: return(new SizedBox( width: 500f, height: 300f, child: new Column( children: new List <Widget> { new Expanded( child: new Padding( padding: EdgeInsets.symmetric(vertical: 12f), child: _shadingList() ) //Padding ), //Expanded _colorList() } ) //Column )); //SizedBox default: return(new Container()); } }//build
public override Widget build(BuildContext context) { return(new FittedBox ( fit: BoxFit.contain, child: new Container ( decoration: new BoxDecoration ( color: Colors.white, borderRadius: BorderRadius.circular(8), border: Border.all ( widget.nodeData.isSelected.Value ? Colors.orange : Colors.transparent, widget.nodeData.isSelected.Value ? 4 : 0 ) ), padding: EdgeInsets.fromLTRB(8, 0, 8, 8), alignment: Alignment.topLeft, child: new IntrinsicWidth ( child: new Column ( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new IntrinsicHeight ( child: new Row ( children: new List <Widget> { new Expanded ( child: new Text ( widget.nodeData.title.Value, textAlign: TextAlign.left, style: new TextStyle ( fontSize: 26, fontWeight: FontWeight.w100, fontStyle: FontStyle.italic ) ) ), new Visibility ( visible: !widget.nodeData.isMock.Value, maintainInteractivity: false, child: new PopupMenuButton <NodeMoreMenuItem> ( icon: new Icon ( Icons.more_horiz, size: 18, color: Theme.of(context).indicatorColor ), padding: EdgeInsets.zero, itemBuilder: item => new List <PopupMenuEntry <NodeMoreMenuItem> > { new PopupMenuItem <NodeMoreMenuItem> ( value: NodeMoreMenuItem.Delete, child: new Text("Delete") ) } ) ) } ) ), new Row ( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Expanded ( child: new ClipRRect ( borderRadius: BorderRadius.circular(4), child: new Container ( padding: EdgeInsets.all(4), color: Colors.pink.shade50, child: new Column ( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: widget.nodeData.inDataPorts.Select ( data => new NodePortWidget(data, NodePortDirectionRelativeToNode.In, widget.parentContainerStackKey).withSubscribeNodePosition(widget.nodeData.reactivePosition) as Widget ).ToList() ) ) ) ), new Container(width: 4), new Expanded ( child: new ClipRRect ( borderRadius: BorderRadius.circular(4), child: new Container ( padding: EdgeInsets.all(4), color: Colors.teal.shade50, child: new Column ( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: widget.nodeData.outDataPorts.Select ( data => new NodePortWidget(data, NodePortDirectionRelativeToNode.Out, widget.parentContainerStackKey).withSubscribeNodePosition(widget.nodeData.reactivePosition) as Widget ).ToList() ) ) ) ) } ) } ) ) ) )); }
public override Widget build(BuildContext context) { List <Widget> chips = this._materials.Select <string, Widget>((string name) => { return(new Chip( key: Key.key(name), backgroundColor: this._nameToColor(name), label: new Text(this._capitalize(name)), onDeleted: () => { this.setState(() => { this._removeMaterial(name); }); } )); }).ToList(); List <Widget> inputChips = this._tools.Select <string, Widget>((string name) => { return(new InputChip( key: ValueKey <string> .key(name), avatar: new CircleAvatar( backgroundImage: this._nameToAvatar(name) ), label: new Text(this._capitalize(name)), onDeleted: () => { this.setState(() => { this._removeTool(name); }); })); }).ToList(); List <Widget> choiceChips = this._materials.Select <string, Widget>((string name) => { return(new ChoiceChip( key: ValueKey <string> .key(name), backgroundColor: this._nameToColor(name), label: new Text(this._capitalize(name)), selected: this._selectedMaterial == name, onSelected: (bool value) => { this.setState(() => { this._selectedMaterial = value ? name : ""; }); } )); }).ToList(); List <Widget> filterChips = ChipDemoUtils._defaultTools.Select <string, Widget>((string name) => { return(new FilterChip( key: ValueKey <string> .key(name), label: new Text(this._capitalize(name)), selected: this._tools.Contains(name) ? this._selectedTools.Contains(name) : false, onSelected: !this._tools.Contains(name) ? (ValueChanged <bool>)null : (bool value) => { this.setState(() => { if (!value) { this._selectedTools.Remove(name); } else { this._selectedTools.Add(name); } }); } )); }).ToList(); HashSet <string> allowedActions = new HashSet <string>(new List <string> { }); if (this._selectedMaterial != null && this._selectedMaterial.isNotEmpty()) { foreach (string tool in this._selectedTools) { allowedActions.UnionWith(ChipDemoUtils._toolActions[tool]); } allowedActions = new HashSet <string>( allowedActions.Intersect(ChipDemoUtils._materialActions[this._selectedMaterial])); } List <Widget> actionChips = allowedActions.Select <string, Widget>((string name) => { return(new ActionChip( label: new Text(this._capitalize(name)), onPressed: () => { this.setState(() => { this._selectedAction = name; }); } )); }).ToList(); ThemeData theme = Theme.of(context); List <Widget> tiles = new List <Widget> { new SizedBox(height: 8.0f, width: 0.0f), new _ChipsTile(label: "Available Materials (Chip)", children: chips), new _ChipsTile(label: "Available Tools (InputChip)", children: inputChips), new _ChipsTile(label: "Choose a Material (ChoiceChip)", children: choiceChips), new _ChipsTile(label: "Choose Tools (FilterChip)", children: filterChips), new _ChipsTile(label: "Perform Allowed Action (ActionChip)", children: actionChips), new Divider(), new Padding( padding: EdgeInsets.all(8.0f), child: new Center( child: new Text(this._createResult(), style: theme.textTheme.title ) ) ) }; return(new Scaffold( appBar: new AppBar( title: new Text("Chips"), actions: new List <Widget> { new MaterialDemoDocumentationButton(ChipDemo.routeName), new IconButton( onPressed: () => { this.setState(() => { this._showShapeBorder = !this._showShapeBorder; }); }, icon: new Icon(Icons.vignette) ) } ), body: new ChipTheme( data: this._showShapeBorder ? theme.chipTheme.copyWith( shape: new BeveledRectangleBorder( side: new BorderSide(width: 0.66f, style: BorderStyle.solid, color: Colors.grey), borderRadius: BorderRadius.circular(10.0f) )) : theme.chipTheme, child: new ListView(children: tiles) ), floatingActionButton: new FloatingActionButton( onPressed: () => this.setState(this._reset), child: new Icon(Icons.refresh) ) )); }
public override Widget build(BuildContext context) { Widget buttonChild; Color buttonColor = CColors.PrimaryBlue; if (this.isLoading) { buttonColor = CColors.Disable2; buttonChild = new CustomActivityIndicator( size: LoadingSize.xSmall ); } else { string buttonText = "收藏"; Color textColor = CColors.PrimaryBlue; if (this.isCollected) { buttonText = $"已收藏"; buttonColor = CColors.Disable2; textColor = new Color(0xFF959595); } buttonChild = new Text( data: buttonText, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Medium", color: textColor ) ); } return(new Container( color: CColors.Background, child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Padding( padding: EdgeInsets.all(16), child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Padding( padding: EdgeInsets.only(top: this.leftWidgetTopPadding), child: this.leftWidget ?? new CoverImages( images: this.images, horizontalGap: 8, verticalGap: 0 ) ), new SizedBox(width: 16), new Expanded( child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( margin: EdgeInsets.only(bottom: 4), height: 56, child: new Text(this.title, maxLines: 2, overflow: TextOverflow.ellipsis, style: CTextStyle.H5 )), this.type == LeaderBoardType.column ? this.followButton : this.isHost ? (Widget) new Container() : new CustomButton( onPressed: () => this.ClickButtonCallback(), padding: EdgeInsets.zero, child: new Container( width: 60, height: 28, alignment: Alignment.center, decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.circular(14), border: Border.all(color: buttonColor) ), child: buttonChild ) ) } ) ), new SizedBox(width: 16) } ) ), new SizedBox(height: 4), new Padding( padding: EdgeInsets.only(16, 0, 16), child: new Text( this.subTitle, style: CTextStyle.PSmallBody4 ) ), new SizedBox(height: 16) }) )); }
public override Widget build(BuildContext context) { if (this.game == null) { return(new Container()); } var imageUrl = this.game.attachmentURLs.FirstOrDefault(); return(new GestureDetector( onTap: () => this.onTap?.Invoke(), child: new Container( padding: EdgeInsets.only(16, 16, 16, 0), child: new AspectRatio( aspectRatio: 4f / 3, child: new Container( decoration: new BoxDecoration( CColorUtils.GetSpecificDarkColorFromId(id: this.game.id), new DecorationImage( new CachedNetworkImageProvider(url: imageUrl), fit: BoxFit.cover ), borderRadius: BorderRadius.circular(8) ), child: new Container( margin: EdgeInsets.only(top: 87), decoration: new BoxDecoration( gradient: new LinearGradient( colors: new List <Color> { Color.fromRGBO(0, 0, 0, 0), Color.fromRGBO(0, 0, 0, 0.6f) }, begin: Alignment.topCenter, end: Alignment.bottomCenter ), borderRadius: BorderRadius.circular(8) ), child: new Container( padding: EdgeInsets.only(16, 0, 16, 16), child: new Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text( data: this.game.resetTitle, maxLines: 1, style: CTextStyle.H2White.defaultHeight() ), new SizedBox(height: 8), new Text( data: this.game.resetSubLabel, maxLines: 1, style: CTextStyle.PLargeWhite.defaultHeight() ) } ) ) ) ) ) ) )); }
Widget _buildYearItem(BuildContext context, int index) { ColorScheme colorScheme = Theme.of(context).colorScheme; TextTheme textTheme = Theme.of(context).textTheme; // Backfill the _YearPicker with disabled years if necessary. int offset = _itemCount < minYears ? (int)(1.0f * (minYears - _itemCount) / 2) : 0; int year = widget.firstDate.Year + index - offset; bool isSelected = year == widget.selectedDate.Year; bool isCurrentYear = year == widget.currentDate.Year; bool isDisabled = year <widget.firstDate.Year || year> widget.lastDate.Year; const float decorationHeight = 36.0f; const float decorationWidth = 72.0f; Color textColor; if (isSelected) { textColor = colorScheme.onPrimary; } else if (isDisabled) { textColor = colorScheme.onSurface.withOpacity(0.38f); } else if (isCurrentYear) { textColor = colorScheme.primary; } else { textColor = colorScheme.onSurface.withOpacity(0.87f); } TextStyle itemStyle = textTheme.bodyText1?.apply(color: textColor); BoxDecoration decoration = null; if (isSelected) { decoration = new BoxDecoration( color: colorScheme.primary, borderRadius: BorderRadius.circular(decorationHeight / 2), shape: BoxShape.rectangle ); } else if (isCurrentYear && !isDisabled) { decoration = new BoxDecoration( border: Border.all( color: colorScheme.primary, width: 1 ), borderRadius: BorderRadius.circular(decorationHeight / 2), shape: BoxShape.rectangle ); } Widget yearItem = new Center( child: new Container( decoration: decoration, height: decorationHeight, width: decorationWidth, child: new Center( child: new Text(year.ToString(), style: itemStyle) ) ) ); if (!isDisabled) { yearItem = new InkWell( key: new ValueKey <int>(year), onTap: () => { widget.onChanged( new DateTime( year, widget.initialDate.Month, widget.initialDate.Day ) ); }, child: yearItem ); } return(yearItem); }
public override Widget build(BuildContext context) { var reply = new Container(); if (!this.widget.replyUserName.isEmpty()) { reply = new Container( height: 40, width: MediaQuery.of(context).size.width, padding: EdgeInsets.only(16, right: 16), alignment: Alignment.centerLeft, decoration: new BoxDecoration( CColors.White, border: new Border( bottom: new BorderSide(CColors.Separator) ) ), child: new RichText( text: new TextSpan( "回复 ", CTextStyle.PRegularBody3, new List <TextSpan> { new TextSpan(this.widget.replyUserName, CTextStyle.PMediumBody3 ) } ) ) ); } return(new Container( child: new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Container( color: Color.fromRGBO(0, 0, 0, 0.4f), child: new Container( color: CColors.White, child: new Column( children: new List <Widget> { reply, new Row( children: new List <Widget> { new Expanded( child: new Container( margin: EdgeInsets.only(10, 6.5f, 8, 6.5f), decoration: new BoxDecoration( CColors.Separator2, borderRadius: BorderRadius.circular( (this._inputFieldHeight + 13) / 2) ), child: new Container( padding: this._inputFieldPadding, child: new InputField(this._inputFieldKey, height: this._inputFieldHeight, controller: this._controller, style: this._inputFieldStyle, maxLines: 2, autofocus: true, hintText: "友好的评论是交流的起点…", hintStyle: CTextStyle.PLargeBody4, cursorColor: CColors.PrimaryBlue, textInputAction: TextInputAction.send, onChanged: text => { var isTextEmpty = text.Length > 0; if (this._isPublish != isTextEmpty) { this.setState(() => { this._isPublish = isTextEmpty; }); } this._inputText = text; }, onSubmitted: this._onSubmitted ) ) ) ), new CustomButton( onPressed: () => { if (!this._isPublish) { return; } this._onSubmitted(this._inputText); }, child: new Text( "发布", style: this._isPublish ? CTextStyle.PLargeBlue : CTextStyle.PLargeDisabled ) ), new Container(width: 8) } ) } ), margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom) ) ) } ) )); }
public override Widget build(BuildContext context, SwiperPluginConfig config) { if (config.itemCount > 20) { UnityEngine.Debug.LogWarning( "The itemCount is too big, we suggest use FractionPaginationBuilder instead of DotSwiperPaginationBuilder in this sitituation"); } Color activeColor = this.activeColor; Color color = this.color; if (activeColor == null || color == null) { ThemeData themeData = Theme.of(context); activeColor = this.activeColor ?? themeData.primaryColor; color = this.color ?? themeData.scaffoldBackgroundColor; } if (config.indicatorLayout != PageIndicatorLayout.NONE && config.layout == SwiperLayout.DEFAULT) { return(new PageIndicator( count: config.itemCount, controller: config.pageController, layout: config.indicatorLayout, size: size, activeColor: activeColor, color: color, space: space )); } List <Widget> list = new List <Widget>(); int itemCount = config.itemCount; int activeIndex = config.activeIndex; for (int i = 0; i < itemCount; ++i) { bool active = i == activeIndex; list.Add(new Container( key: Key.key("pagination_" + i), margin: EdgeInsets.all(space), child: new ClipRRect(//TODO:check 换成圆形组件 borderRadius: BorderRadius.circular(10f), child: new Container( color: active ? activeColor : color, width: active ? activeSize : size, height: active ? activeSize : size ) ) )); } if (config.scrollDirection == Axis.vertical) { return(new Column( key: key, mainAxisSize: MainAxisSize.min, children: list )); } else { return(new Row( key: key, mainAxisSize: MainAxisSize.min, children: list )); } }
Widget _buildChatBar(bool showChatWindow) { IconData iconData; Widget bottomWidget; if (showChatWindow) { iconData = Icons.expand_more; bottomWidget = new Container(); } else { iconData = Icons.expand_less; bottomWidget = new Text( "轻点展开聊天", style: CTextStyle.PSmallBody4 ); } return(new GestureDetector( onTap: () => { this._focusNode.unfocus(); if (!showChatWindow) { this._controller.forward(); } else { this._controller.reverse(); } this.widget.actionModel.showChatWindow(!this.widget.viewModel.showChatWindow); }, child: new Container( padding: EdgeInsets.symmetric(horizontal: 16), color: CColors.White, height: showChatWindow ? 44 : 64, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 6), width: 6, height: 6, decoration: new BoxDecoration( CColors.SecondaryPink, borderRadius: BorderRadius.circular(3) ) ), new Text( "直播聊天", style: new TextStyle( height: 1.09f, fontSize: 16, fontFamily: "Roboto-Medium", color: CColors.TextBody ) ) } ), bottomWidget } ), new Icon( iconData, color: CColors.BrownGrey, size: 28 ) } ) ) )); }
public override Widget build(BuildContext context) { return(new CupertinoPageScaffold( navigationBar: new CupertinoNavigationBar( middle: new Text("Segmented Control"), previousPageTitle: "Cupertino" ), child: new DefaultTextStyle( style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(fontSize: 13), child: new SafeArea( child: new Column( children: new List <Widget> { new Padding(padding: EdgeInsets.all(16.0f)), new SizedBox( width: 500.0f, child: new CupertinoSegmentedControl <int>( children: children, onValueChanged: onValueChanged, groupValue: currentSegment ) ), new SizedBox( width: 500, child: new Padding( padding: EdgeInsets.all(16.0f), child: new CupertinoSlidingSegmentedControl <int>( children: children, onValueChanged: onValueChanged, groupValue: currentSegment ) ) ), new Expanded( child: new Padding( padding: EdgeInsets.symmetric( vertical: 32.0f, horizontal: 16.0f ), child: new CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.elevatedlayer, child: new Builder( builder: (BuildContext context1) => { return new Container( padding: EdgeInsets.symmetric( vertical: 64.0f, horizontal: 16.0f ), decoration: new BoxDecoration( color: CupertinoTheme.of(context1).scaffoldBackgroundColor, borderRadius: BorderRadius.circular(3.0f), boxShadow: new List <BoxShadow> { new BoxShadow( offset: new Offset(0.0f, 3.0f), blurRadius: 5.0f, spreadRadius: -1.0f, color: _kKeyUmbraOpacity ), new BoxShadow( offset: new Offset(0.0f, 6.0f), blurRadius: 10.0f, spreadRadius: 0.0f, color: _kKeyPenumbraOpacity ), new BoxShadow( offset: new Offset(0.0f, 1.0f), blurRadius: 18.0f, spreadRadius: 0.0f, color: _kAmbientShadowOpacity ) } ), child: icons[currentSegment] ); } ) ) ) ) } ) ) ) )); }
public override Widget build(BuildContext context) { var screenSize = MediaQuery.of(context).size; var screenWidth = screenSize.width; var screenHeight = screenSize.height; var headerChildren = new List <Widget> { new Expanded( child: new Text( $"{channel?.name ?? string.Empty}", style: new TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: new Color(0xff212121), fontFamily: "PingFang" ) ) ), }; headerChildren.Add( new GestureDetector( onTap: () => { if (screenWidth < 750) { m_AnimationController.reverse(); } else { HomePage.of(this.context).HideChannelInfo(); } }, child: new Icon( IconFont.IconFontClose, color: new Color(0xff979a9e), size: 28 ) ) ); var children = new List <Widget> { }; if (channel == null) { children.Add( new Loading(size: 56) ); } else { children.Add( CreateLobbyIcon( channel.thumbnail, size: 184, radius: 4 ) ); children.Add( new Container( margin: EdgeInsets.only(top: 32), child: new Text( channel.name, style: new TextStyle( color: new Color(0xff000000), fontSize: 24, fontWeight: FontWeight.bold ) ) ) ); children.Add( new Container( margin: EdgeInsets.only(top: 8), child: new Text( $"{channel.memberCount}成员", style: new TextStyle( color: new Color(0xff797979), fontSize: 14 ) ) ) ); var topic = channel.topic; if (!channel.groupId.IsNullOrEmpty() && group != null) { topic = group.description; } children.Add( new Container( margin: EdgeInsets.only(top: 32), child: new Text( topic, style: new TextStyle( color: new Color(0xff000000), fontSize: 14 ) ) ) ); var buttonChildren = new List <Widget>(); if (m_Joining) { buttonChildren.Add( new Text( "加入群聊", style: new TextStyle( color: new Color(0x00000000), fontSize: 18, fontFamily: "PingFang" ) ) ); buttonChildren.Add( new Loading( size: 24 ) ); } else { buttonChildren.Add( new Text( "加入群聊", style: new TextStyle( fontSize: 18, color: new Color(0xff2196f3), fontFamily: "PingFang" ) ) ); } children.Add( new GestureDetector( onTap: () => { if (m_Joining) { return; } setState(() => m_Joining = true); var requestUrl = string.IsNullOrEmpty(channel.groupId) ? $"/api/connectapp/v1/channels/{channel.id}/join" : $"/api/connectapp/v1/groups/{channel.groupId}/join"; Utils.Post <JoinChannelResponse>( requestUrl, "{}" ).Then(response => { using (WindowProvider.of(context).getScope()) { if (mounted) { var state = HomePage.of(context); var responseChannel = response.channel; state.AddChannel(responseChannel); state.Select(responseChannel.id); state.Ack(responseChannel.id); setState(() => m_Joining = false); } } }); }, child: new Container( height: 56, width: 234, margin: EdgeInsets.only(top: 48), decoration: new BoxDecoration( color: new Color(0xffffffff), borderRadius: BorderRadius.circular(6), border: Border.all( color: new Color(0xff2196f3) ) ), alignment: Alignment.center, child: new Stack( alignment: Alignment.center, children: buttonChildren ) ) ) ); } Widget all = new Container( color: new Color(0xffffffff), child: new Scroller( child: new SingleChildScrollView( child: new Column( children: new List <Widget> { new Container( height: 64, decoration: new BoxDecoration( border: new Border( bottom: new BorderSide( color: new Color(0xffd8d8d8) ) ) ), padding: EdgeInsets.symmetric(horizontal: 24), alignment: Alignment.center, child: new Row( crossAxisAlignment: CrossAxisAlignment.center, children: headerChildren ) ), new Container( constraints: new BoxConstraints( minHeight: screenHeight - 64 ), width: screenWidth < 750 ? (float?)null : 450, margin: EdgeInsets.symmetric(horizontal: 24), alignment: Alignment.center, child: new Column( children: children ) ), } ) ) ) ); var stacked = new List <Widget> { all }; all = new Stack( children: stacked ); if (screenWidth < 750) { all = Transform.translate( offset: new Offset(0, (1 - m_AnimationController.value) * screenHeight), child: all ); } return(all); }
/// Creates a [MarkdownStyleSheet] from the [TextStyle]s in the provided [ThemeData]. public static MarkdownStyleSheet fromTheme(ThemeData theme) { return(new MarkdownStyleSheet( a: new TextStyle(true, Colors.blue), p: theme.textTheme.body1, code: new TextStyle( inherit: true, color: Colors.grey.shade700, fontSize: theme.textTheme.body1.fontSize * .85f, fontFamily: "monospace" ), h1: new TextStyle(true, fontSize: 24.0f), h2: new TextStyle(true, fontSize: 20.0f), h3: theme.textTheme.subhead, h4: theme.textTheme.body2, h5: theme.textTheme.body2, h6: theme.textTheme.body2, em: new TextStyle(true, fontStyle: FontStyle.italic), strong: new TextStyle(true, fontWeight: FontWeight.bold), blockquote: theme.textTheme.body1, img: theme.textTheme.body1, blockSpacing: 8, listIndent: 32, blockquotePadding: 8, blockquoteDecoration: new BoxDecoration(null, null, null, BorderRadius.circular(2), null, null, null), codeblockPadding: 8, codeblockDecoration: new BoxDecoration(Colors.grey.shade100, null, null, BorderRadius.circular(2), null, null, null), horizontalRuleDecoration: new BoxDecoration( color: null, image: null, border: new Border( new BorderSide(Colors.grey.shade300, 0.5f) ) //Border ) //BoxDecoration )); }
public override Widget build(BuildContext context) { Widget row = new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => { Navigator.of(context).push(new CupertinoPageRoute( title: this.colorName, builder: (BuildContext _context) => new Tab1ItemPage( color: this.color, colorName: this.colorName, index: this.index ) )); }, child: new SafeArea( top: false, bottom: false, child: new Padding( padding: EdgeInsets.only(left: 16.0f, top: 8.0f, bottom: 8.0f, right: 8.0f), child: new Row( children: new List <Widget> { new Container( height: 60.0f, width: 60.0f, decoration: new BoxDecoration( color: this.color, borderRadius: BorderRadius.circular(8.0f) ) ), new Expanded( child: new Padding( padding: EdgeInsets.symmetric(horizontal: 12.0f), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text(this.colorName), new Padding(padding: EdgeInsets.only(top: 8.0f)), new Text( "Buy this cool color", style: new TextStyle( color: new Color(0xf8E8E93), fontSize: 13.0f, fontWeight: FontWeight.w300 ) ) } ) ) ), new CupertinoButton( padding: EdgeInsets.zero, child: new Icon(CupertinoIcons.plus_circled ), onPressed: () => { } ), new CupertinoButton( padding: EdgeInsets.zero, child: new Icon(CupertinoIcons.share ), onPressed: () => { } ) } ) ) ) ); if (this.lastItem) { return(row); } return(new Column( children: new List <Widget> { row, new Container( height: 1.0f, color: new Color(0xfD9D9D9) ) } )); }
Widget _buildNavigationBar() { var favoriteTag = this.widget.viewModel.favoriteTag; string title; var rightWidget = (Widget) new Container(width: 56); if (favoriteTag == null) { title = ""; } else { if (favoriteTag.type == "default") { title = "默认"; } else { title = favoriteTag.name; } } Widget titleWidget = new Container(); Widget buttonChild; Color buttonColor = CColors.PrimaryBlue; if (this.widget.viewModel.collectLoading) { buttonColor = CColors.Disable2; buttonChild = new CustomActivityIndicator( size: LoadingSize.xSmall ); } else { string buttonText = "收藏"; Color textColor = CColors.PrimaryBlue; if (this.widget.viewModel.isCollect) { buttonText = $"已收藏"; buttonColor = CColors.Disable2; textColor = new Color(0xFF959595); } buttonChild = new Text( data: buttonText, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Medium", color: textColor ) ); } var child = new CustomButton( onPressed: this._onPressed, padding: EdgeInsets.zero, child: new Container( width: 60, height: 28, alignment: Alignment.center, decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.circular(14), border: Border.all(color: buttonColor) ), child: buttonChild ) ); if (this._isHaveTitle) { titleWidget = new Text( data: title, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center ); rightWidget = new Padding( padding: EdgeInsets.symmetric(horizontal: 16), child: child); } if (this.widget.viewModel.favoriteTag.type != "default" && this.widget.viewModel.isLoggedIn && this.widget.viewModel.currentUserId.Equals(this.widget.viewModel.userId) && this.widget.viewModel.type == FavoriteType.my) { rightWidget = new CustomButton( padding: EdgeInsets.symmetric(8, 16), onPressed: () => this.widget.actionModel.pushToEditFavorite(this.widget.viewModel.favoriteTag.id), child: new Text( "编辑", style: CTextStyle.PLargeMediumBlue.merge(new TextStyle(height: 1)) ) ); } if (favoriteTag.type == "default" || (this.widget.viewModel.type == FavoriteType.userDetail && UserInfoManager.isLogin() && this.widget.viewModel.myFavoriteIds.Contains(this.widget.viewModel .favoriteTag.quoteTagId))) { rightWidget = new Padding( padding: EdgeInsets.symmetric(horizontal: 16), child: new Container()); } return(new CustomAppBar( () => this.widget.actionModel.mainRouterPop(), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ), rightWidget: rightWidget, backgroundColor: this._isHaveTitle || this.widget.viewModel.type == FavoriteType.my ? CColors.White : CColors.Background, bottomSeparatorColor: this._isHaveTitle || this.widget.viewModel.type == FavoriteType.my ? CColors.Separator2 : CColors.Transparent )); }
public override Widget build(BuildContext context) { return(new CupertinoPageScaffold( navigationBar: new CupertinoNavigationBar( trailing: new ExitButton() ), child: new SafeArea( top: false, bottom: false, child: new ListView( children: new List <Widget> { new Padding(padding: EdgeInsets.only(top: 16.0f)), new Padding( padding: EdgeInsets.symmetric(horizontal: 16.0f), child: new Row( mainAxisSize: MainAxisSize.max, children: new List <Widget> { new Container( height: 128.0f, width: 128.0f, decoration: new BoxDecoration( color: this.widget.color, borderRadius: BorderRadius.circular(24.0f) ) ), new Padding(padding: EdgeInsets.only(left: 18.0f)), new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: new List <Widget> { new Text(this.widget.colorName, style: new TextStyle(fontSize: 24.0f, fontWeight: FontWeight.bold) ), new Padding(padding: EdgeInsets.only(top: 6.0f)), new Text( "Item number ${widget.index}", style: new TextStyle( color: new Color(0xf8E8E93), fontSize: 16.0f, fontWeight: FontWeight.w100 ) ), new Padding(padding: EdgeInsets.only(top: 20.0f)), new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { CupertinoButton.filled( minSize: 30.0f, padding: EdgeInsets.symmetric(horizontal: 24.0f), borderRadius: BorderRadius.circular(32.0f), child: new Text( "GET", style: new TextStyle( fontSize: 14.0f, fontWeight: FontWeight.w700, letterSpacing: -0.28f ) ), onPressed: () => { } ), CupertinoButton.filled( minSize: 30.0f, padding: EdgeInsets.zero, borderRadius: BorderRadius.circular(32.0f), child: new Icon(CupertinoIcons.ellipsis), onPressed: () => { } ) } ) } ) ) } ) ), new Padding( padding: EdgeInsets.only(left: 16.0f, top: 28.0f, bottom: 8.0f), child: new Text( "USERS ALSO LIKED", style: new TextStyle( color: new Color(0xf646464), letterSpacing: -0.60f, fontSize: 15.0f, fontWeight: FontWeight.w500 ) ) ), new SizedBox( height: 200.0f, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: 10, itemExtent: 160.0f, itemBuilder: (BuildContext _context, int index) => { return new Padding( padding: EdgeInsets.only(left: 16.0f), child: new Container( decoration: new BoxDecoration( borderRadius: BorderRadius.circular(8.0f), color: this.relatedColors[index] ), child: new Center( child: new CupertinoButton( child: new Icon( CupertinoIcons.plus_circled, color: CupertinoColors.white, size: 36.0f ), onPressed: () => { } ) ) ) ); } ) ), } ) ) )); }