/** * Create a complex App UI with a different layout setting: * (1) align the icon and button horizontally * (2) fill the space between the icon and button with white-spaces */ Widget createComplexAppUIWithDifferentLayoutSetting() { return(new MaterialApp( home: new Scaffold( appBar: new AppBar( title: new Text("Pick Your Transportation Mode") ), body: new Padding( padding: EdgeInsets.all(16.0f), child: new Card( color: Colors.white, child: new Center( child: new Row( //Column => Row mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, // MainAxisAlignment.center => MainAxisAlignment.spaceBetween children: new List <Widget> { new Icon(Unity.UIWidgets.material.Icons.directions_car, size: 128.0f), new RaisedButton( child: new Text("Next Mode")) } ) ) ) ), floatingActionButton: new FloatingActionButton( backgroundColor: Colors.redAccent, child: new Icon(Unity.UIWidgets.material.Icons.add_alert), onPressed: () => { } ) ) )); }
Widget _buildIndicator(BuildContext context, float headValue, float tailValue, int stepValue, float rotationValue) { float arrowheadScale = this.widget.value == null ? 0.0f : (this.widget.value * 2.0f).Value.clamp(0.0f, 1.0f); return(new Container( width: _indicatorSize, height: _indicatorSize, margin: EdgeInsets.all(4.0f), child: new Material( type: MaterialType.circle, color: this.widget.backgroundColor ?? Theme.of(context).canvasColor, elevation: 2.0f, child: new Padding( padding: EdgeInsets.all(12.0f), child: new CustomPaint( painter: new _RefreshProgressIndicatorPainter( valueColor: this.widget._getValueColor(context), value: null, headValue: headValue, tailValue: tailValue, stepValue: stepValue, rotationValue: rotationValue, strokeWidth: this.widget.strokeWidth, arrowheadScale: arrowheadScale ) ) ) ) )); }
private static Widget ProcessFence(Token token, BuilderContext ctx) { return(new Container( margin: EdgeInsets.only(top: 16), decoration: new BoxDecoration( border: Border.all( color: new Color(0xffe0e0e0) ) ), padding: EdgeInsets.all(16f), child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Expanded( child: new SelectableText( token.content.Trim(), style: FenceTextStyle ) ), new CopyIcon(token.content.Trim()) } ) )); }
private Widget renderErrorWidget() { var list = new List <Widget> { renderUploadingHead(), new Container( color: new Color(0xFFF6F6F6), padding: EdgeInsets.all(40), child: new Column( children: new List <Widget> { renderIcon(Icons.error), renderHighlightedLabel("Something went wrong"), renderNormalLabel(widget.shareState.errorMsg), renderGoBack() }, mainAxisAlignment: MainAxisAlignment.center ), constraints: BoxConstraints.expand().widthConstraints() ) }; return(new Container( color: new Color(0xFFF6F6F6), padding: EdgeInsets.only(top: 10), child: new Column(children: list, mainAxisAlignment: MainAxisAlignment.spaceBetween) )); }
public override Widget build(BuildContext context) => new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new BlurredAppBar(child: new Row( children: new List <Widget> { new SizedBox(width: 8), new RoundedIconButton(icon: Icons.arrow_back, onPressed: ToolEditorUIStatus <ToolEditorUI> .ToolEditorUIKey.currentState.GoHome), new Container(child: new Text(widget.Title, style: Theme.of(context).textTheme.title), margin: EdgeInsets.all(8)), } )), new Expanded( child: new Padding( padding: EdgeInsets.symmetric(horizontal: 8), child: new SingleChildScrollView( child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { } ) ) ) ), } );
public SwiperPagination(Alignment alignment = null, SwiperPlugin builder = null, Key key = null, EdgeInsets margin = null) { this.alignment = alignment ?? Alignment.center; this.key = key; this.margin = margin ?? EdgeInsets.all(10.0f); this.builder = SwiperPagination.dots; }
public override Widget build(BuildContext context) { return(new Card( child: new Padding( padding: EdgeInsets.all(16.0f), child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.start, children: new List <Widget> { new Align( alignment: page.id == "H" ? Alignment.centerLeft : Alignment.centerRight, child: new CircleAvatar(child: new Text(page.id)) ), new SizedBox( width: 144.0f, height: 144.0f, child: Image.file( data.imageAssetPackage + data.imageAsset, fit: BoxFit.contain ) ), new Center( child: new Text( data.title, style: Theme.of(context).textTheme.headline6 ) ) } ) ) )); }
private List <Widget> buildCards() { List <float> elevations = new List <float> { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 8.0f, 16.0f, 24.0f }; return(elevations.Select <float, Widget>((float elevation) => { return new Center( child: new Card( margin: EdgeInsets.all(20.0f), elevation: this._showElevation ? elevation : 0.0f, child: new SizedBox( height: 100.0f, width: 100.0f, child: new Center( child: new Text($"{elevation:F0} pt") ) ) ) ); }).ToList()); }
public override Widget build(BuildContext context) { return(new Scaffold ( primary: false, body: new Container ( padding: EdgeInsets.all(8), child: new Wrap ( spacing: 8, runSpacing: 8, children: types.Select ( type => new InkWell ( child: new NodeWidget(type), onTap: () => { Debug.Log("Selected Type " + type.GetType()); NodeGraphInstanceManager.Instance.GetNewNodeGraphDataInstance(widget.nodeEditorKey).AddNodeWithType(type.GetType()); } ) as Widget ).ToList() ) ), appBar: new AppBar ( title: new Text("Add A Node") ) )); }
public PopupMenuButton( Key key = null, PopupMenuItemBuilder <T> itemBuilder = null, T initialValue = default, PopupMenuItemSelected <T> onSelected = null, PopupMenuCanceled onCanceled = null, string tooltip = null, float elevation = 8.0f, EdgeInsets padding = null, Widget child = null, Icon icon = null, Offset offset = null ) : base(key: key) { offset = offset ?? Offset.zero; D.assert(itemBuilder != null); D.assert(offset != null); D.assert(!(child != null && icon != null)); this.itemBuilder = itemBuilder; this.initialValue = initialValue; this.onSelected = onSelected; this.onCanceled = onCanceled; this.tooltip = tooltip; this.elevation = elevation; this.padding = padding ?? EdgeInsets.all(8.0f); this.child = child; this.icon = icon; this.offset = offset; }
public override Widget build(BuildContext context) { return (new Center( child: new AnimatedContainer( duration: TimeSpan.FromSeconds(1), padding: EdgeInsets.all(50), width: animateWidth, height: 300, decoration: new BoxDecoration( color: new Color(0xFFFFFFFF), border: Border.all(color: Color.fromARGB(255, 0xDF, 0x30, 0x70), width: 5), borderRadius: BorderRadius.all(20) ), child: new Center( child: new GestureDetector( onTap: () => { this.setState(() => { animateWidth = animateWidth + 50; }); }, child: new Container( padding: EdgeInsets.symmetric(20, 20), color: Color.fromARGB(255, 0xDF, 0x30, 0x70), child: new Text("Click Me") ) ) ) ) )); }
public override Widget build(BuildContext context) { return(new Container( decoration: new BoxDecoration( shape: BoxShape.circle, gradient: new LinearGradient( begin: Alignment.topCenter, // FractionalOfset.topCenter, end: Alignment.bottomCenter, // FractionalOfset.bottomCenter, colors: new List <Color> { this.color, Color.fromARGB(this.color.alpha, (this.color.red - 60).clamp(0, 255), (this.color.green - 60).clamp(0, 255), (this.color.blue - 60).clamp(0, 255) ) } ) ), margin: EdgeInsets.only(left: 8.0f, bottom: 8.0f), padding: EdgeInsets.all(12.0f), child: new Text(this.text, style: new TextStyle( color: CupertinoColors.white, fontSize: 13.0f, fontWeight: FontWeight.w500 ) ) )); }
public override Widget build(BuildContext context) { return(new Scaffold( appBar: new AppBar( title: new Text("Modal bottom sheet"), actions: new List <Widget> { new MaterialDemoDocumentationButton(routeName) } ), body: new Center( child: new RaisedButton( child: new Text("SHOW BOTTOM SHEET"), onPressed: () => { BottomSheetUtils.showModalBottomSheet <object>(context: context, builder: (BuildContext _context) => { return new Container( child: new Padding( padding: EdgeInsets.all(32.0f), child: new Text("This is the modal bottom sheet. Tap anywhere to dismiss.", textAlign: TextAlign.center, style: new TextStyle( color: Theme.of(_context).accentColor, fontSize: 24.0f ) ) ) ); }); } ) ) )); }
public override Widget build(BuildContext context) { Profile user = App.UserModel.Profile; List <int> recents = App.UserModel.GetRecents(); return(new Scaffold( appBar: new AppBar(backgroundColor: Colors.black54, title: new Text("Messages")), body: new Column( children: new List <Widget> { new Flexible( child: ListView.seperated( physics: new AlwaysScrollableScrollPhysics(), padding: EdgeInsets.all(8.0f), separatorBuilder: (builcContext, index) => new Divider(height: 1f), itemBuilder: (buildContext, index) => { Profile otherPerson = App.ProfilesModel.GetProfile(recents[index]); List <Message> convo = App.UserModel.GetConversation(otherPersonId: otherPerson.Id); return new ListTile( leading: new AvatarButton(onTap: () => { this.OnProfileTap(context, otherPerson: otherPerson); }, photoURL: otherPerson.PhotoURL), title: new Text(otherPerson.DisplayName), subtitle: new Text(convo[convo.Count - 1].TimeStamp.ToShortDateString()), onTap: () => { this.OnConversationTap(context, otherPerson); }); }, itemCount: recents.Count ) ) } ) )); }
public override Widget build(BuildContext context) => new Listener( onPointerEnter: (x) => setState(() => isPointIn = true), onPointerExit: (x) => setState(() => isPointIn = false), child: new AnimatedContainer( duration: TimeSpan.FromMilliseconds(100), curve: Curves.ease, child: new FlatButton( color: Theme.of(context).primaryColor.withOpacity(0.7f), disabledColor: Theme.of(context).primaryColor.withOpacity(0.2f), disabledTextColor: Theme.of(context).textTheme.button.color.withOpacity(0.4f), textColor: Theme.of(context).textTheme.button.color, padding: EdgeInsets.all(8), child: widget.Child == null ? new Text(widget.Content, style: Theme.of(context).textTheme.button) : widget.Child, onPressed: widget.OnPressed ), margin: EdgeInsets.all(8), decoration: new BoxDecoration( color: Colors.transparent, borderRadius: BorderRadius.circular(radius: 4f), boxShadow: new List <BoxShadow> { new BoxShadow(color: Theme.of(context).backgroundColor.withOpacity(0.3f), blurRadius: isPointIn?8f:4f) } ) ) );
public override Widget build(BuildContext context) { return(new SizedBox( height: 50, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: AppConst.Colors.Length, itemBuilder: (buildContext, index) => new Container( padding: EdgeInsets.all(8), width: 50, height: 50, child: new InkWell( onTap: () => { setState(() => { mSelectedIndex = index; }); widget.OnTap(index); }, child: new ColorCircle( index: index, selected: index == mSelectedIndex ) ) ) ) )); }
Widget _buildFavoriteTitle() { return(new Container( height: 58, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( padding: EdgeInsets.all(16), onPressed: ActionSheetUtils.hiddenModalPopup, child: new Text("取消", style: CTextStyle.PLargeBody5) ), new Text("收藏到", style: CTextStyle.PXLargeMedium), new CustomButton( padding: EdgeInsets.all(16), onPressed: () => { ActionSheetUtils.hiddenModalPopup(); var myFavoriteIds = this.widget.viewModel.myFavoriteIds; if (myFavoriteIds.Count > this._checkIndex) { var tagId = myFavoriteIds[index: this._checkIndex]; this.widget.actionModel.favoriteArticle(arg: tagId); } }, child: new Text("完成", style: CTextStyle.PLargeBlue) ) } ) )); }
public override Widget build(BuildContext context) { if (this.game == null) { return(new Container()); } return(new Container( padding: EdgeInsets.only(16, 0, 16, 25), color: CColors.White, child: new Container( decoration: new BoxDecoration( color: CColors.Separator2, borderRadius: BorderRadius.circular(8) ), padding: EdgeInsets.all(16), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text( "简介", style: CTextStyle.H5.defaultHeight() ), new Padding( padding: EdgeInsets.only(top: 16), child: new Text( this.game.resetDesc ?? "暂无简介", style: CTextStyle.PLargeBody2 ) ) } ) ) )); }
Widget container() { var image = Image.network( "https://tse3.mm.bing.net/th?id=OIP.XOAIpvR1kh-CzISe_Nj9GgHaHs&pid=Api", width: 100, height: 100, repeat: ImageRepeat.repeatX ); var container = new Container( width: 200, height: 200, margin: EdgeInsets.all(30.0f), padding: EdgeInsets.all(15.0f), child: image, decoration: new BoxDecoration( color: CLColors.white, borderRadius: BorderRadius.all(30), gradient: new LinearGradient(colors: new List <Color> { CLColors.blue, CLColors.red, CLColors.green }) ) ); return(container); }
public override Widget build(BuildContext context) { return(new Container( height: 200, padding: EdgeInsets.all(10), decoration: new BoxDecoration( color: new Color(0xFFEF1F7F), border: Border.all(color: Color.fromARGB(255, 0xDF, 0x10, 0x70), width: 5) ), child: new Column( crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new InputField( decoration: new BoxDecoration( color: new Color(0xFFFFFFFF), border: Border.all(color: Color.fromARGB(255, 0xDF, 0x10, 0x70), width: 5), borderRadius: BorderRadius.all(20) ), hintText: "changeName", hintStyle: CTextStyle.PLargeBody5, style: CTextStyle.PLargeBody, autofocus: false, height: 24, cursorColor: CColors.PrimaryBlue, maxLines: 1, onChanged: text => this.widget.actionModel.changeName(text) ), new Text( data: this.widget.viewModel.name ) } ) )); }
Widget createWidget() { return(new Container( height: 200.0f, padding: EdgeInsets.all(10), decoration: new BoxDecoration( color: new Color(0xFF7F7F7F), border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5), borderRadius: BorderRadius.all(2)), child: new Column( children: new List <Widget>() { new StoreConnector <CouterState, string>( converter: (state, dispatch) => $"Count:{state.count}", builder: (context, countText) => new Text(countText, style: new TextStyle( fontSize: 20, fontWeight: FontWeight.w700 )) ), new StoreConnector <CouterState, Action>( converter: (state, dispatch) => () => { dispatch(new CounterIncAction() { amount = 1 }); }, builder: (context, onPress) => new CustomButton( backgroundColor: Color.fromARGB(255, 0, 204, 204), padding: EdgeInsets.all(10), child: new Text("Add", style: new TextStyle( fontSize: 16, color: Color.fromARGB(255, 255, 255, 255) )), onPressed: () => { onPress(); }) ), } ) )); }
public override Widget build(BuildContext context) { return(new Scaffold( appBar: new AppBar( title: new Text("Expansion panels"), actions: new List <Widget> { new MaterialDemoDocumentationButton(ExpansionPanelsDemo.routeName) } ), body: new SingleChildScrollView( child: new SafeArea( top: false, bottom: false, child: new Container( margin: EdgeInsets.all(24.0f), child: new ExpansionPanelList( expansionCallback: (int index, bool isExpanded) => { setState(() => { _demoItems[index].isExpanded = !isExpanded; }); }, children: _demoItems.Select <DemoItem, ExpansionPanel>((DemoItem item) => { return new ExpansionPanel( isExpanded: item.isExpanded, headerBuilder: item.headerBuilder, body: item.build() ); }).ToList() ) ) ) ) )); }
public TextList( List <string> texts, TextStyle style, TextAlign textAlign = TextAlign.center, int?maxLines = null, Axis direction = Axis.vertical, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null) { this.texts = texts; this.style = style; this.textAlign = textAlign; this.maxLines = maxLines; this.direction = direction; this.maxWidth = maxWidth; this.minWidth = minWidth; this.maxHeight = maxHeight; this.minHeight = minHeight; this.padding = padding ?? EdgeInsets.all(10); this.decoration = decoration; }
static Widget _CodeBlock(BuildContext context, string text, List <TextSpan> inlineSpans) { if (text == null) { return(new Container()); } Widget child = new Text( text, style: CTextStyle.PCodeStyle ); if (inlineSpans != null) { child = new RichText( text: new TextSpan( children: inlineSpans ) ); } return(new Container( color: CColors.White, padding: EdgeInsets.only(bottom: 24), child: new Container( color: Color.fromRGBO(110, 198, 255, 0.12f), width: MediaQuery.of(context).size.width, child: new Container( padding: EdgeInsets.all(16), child: child ) ) )); }
void _showBottomSheet() { this.setState(() => { this._showBottomSheetCallback = null; }); this._scaffoldKey.currentState.showBottomSheet((BuildContext subContext) => { ThemeData themeData = Theme.of(subContext); return(new Container( decoration: new BoxDecoration( border: new Border( top: new BorderSide( color: themeData.disabledColor))), child: new Padding( padding: EdgeInsets.all(32.0f), child: new Text("This is a Material persistent bottom sheet. Drag downwards to dismiss it.", textAlign: TextAlign.center, style: new TextStyle( color: themeData.accentColor, fontSize: 16.0f)) ) )); }).closed.Then((object obj) => { if (this.mounted) { this.setState(() => { this._showBottomSheetCallback = this._showBottomSheet; }); } return(new Promise()); }); }
void OnEnable() { this.windowAdapter = new EditorWindowAdapter(this); this.windowAdapter.OnEnable(); this.root = new Container( width: 200, height: 200, margin: EdgeInsets.all(30.0), padding: EdgeInsets.all(15.0), color: Color.fromARGB(255, 244, 190, 85), child: new EditableText( maxLines: 100, selectionControls: MaterialUtils.materialTextSelectionControls, controller: new TextEditingController(this.txt), focusNode: new FocusNode(), style: new TextStyle(), selectionColor: Color.fromARGB(255, 255, 0, 0), cursorColor: Color.fromARGB(255, 0, 0, 0) ) ); this.windowAdapter.attachRootWidget(new WidgetsApp(window: this.windowAdapter, home: this.root, pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => new PageRouteBuilder( settings: settings, pageBuilder: (BuildContext context, Unity.UIWidgets.animation.Animation <double> animation, Unity.UIWidgets.animation.Animation <double> secondaryAnimation) => builder(context) ))); this.titleContent = new GUIContent("EditableTextWidget"); }
public IconButton( Key key = null, float iconSize = 24.0f, EdgeInsets padding = null, Alignment alignment = null, Widget icon = null, Color color = null, Color highlightColor = null, Color splashColor = null, Color disableColor = null, VoidCallback onPressed = null, string tooltip = null) : base(key: key) { D.assert(icon != null); this.iconSize = iconSize; this.padding = padding ?? EdgeInsets.all(8.0f); this.alignment = alignment ?? Alignment.center; this.icon = icon; this.color = color; this.highlightColor = highlightColor; this.splashColor = splashColor; this.disabledColor = disableColor; this.onPressed = onPressed; this.tooltip = tooltip; }
public override Widget build(BuildContext context) { return(new MaterialApp( theme: new ThemeData(primaryColor: Colors.blueGrey), home: new Scaffold( body: new Container( margin: EdgeInsets.all(0), decoration: new BoxDecoration( //image: //添加背景图片 ), child: new Align( alignment: Alignment.center, child: new SizedBox( width: 400, height: 400, child: new Column( //mainAxisAlignment:Unity.UIWidgets.rendering.MainAxisAlignment.center, crossAxisAlignment: Unity.UIWidgets.rendering.CrossAxisAlignment.start, children: new List <Widget>() { new Text( data: "登录", style: new TextStyle(fontSize: 40) ), BuildNameTextField(), BuildPasswordTextField(), BuildLoginButton(context) } ) ) ) ) ) )); }
public override Widget build(BuildContext context) { return(new Scaffold( appBar: new AppBar( title: new Text("Retrieve Text Input") ), body: new Padding( padding: EdgeInsets.all(16.0f), child: new TextField(controller: this.myController) ), floatingActionButton: new FloatingActionButton( // When the user presses the button, show an alert dialog with the // text the user has typed into our text field. onPressed: () => { DialogUtils.showDialog( context: context, builder: (_context) => { return new AlertDialog( // Retrieve the text the user has typed in using our // TextEditingController content: new Text(this.myController.text) ); }); }, tooltip: "Show me the value", child: new Icon(Icons.search) ) )); }
public override Widget build(BuildContext context) { List <Widget> children = _getChildren( widget.orientation, widget.contextMenuLocation ); return(new SafeArea( child: new Padding( padding: EdgeInsets.all(_kPadding), child: new Align( alignment: Alignment.topLeft, child: new GestureDetector( onPanEnd: _onPanEnd, onPanStart: _onPanStart, onPanUpdate: _onPanUpdate, child: new AnimatedBuilder( animation: _moveController, builder: _buildAnimation, child: widget.orientation == Orientation.portrait ? (Widget) new Column( crossAxisAlignment: CrossAxisAlignment.start, children: children ) : new Row( crossAxisAlignment: CrossAxisAlignment.start, children: children ) ) ) ) ) )); }