示例#1
0
 Widget titleInput()
 {
     return(new Row(
                children: new List <Widget>(
                    )
     {
         new SizedBox(width: 100, child: new Text("Title")),
         new Flexible(child: new Container(
                          decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
                          padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
                          child: new EditableText(maxLines: 1,
                                                  controller: this.titleController,
                                                  selectionControls: MaterialUtils.materialTextSelectionControls,
                                                  backgroundCursorColor: Colors.transparent,
                                                  autofocus: true,
                                                  focusNode: new FocusNode(),
                                                  style: new TextStyle(
                                                      fontSize: 18,
                                                      height: 1.5f,
                                                      color: new Color(0xFF1389FD)
                                                      ),
                                                  selectionColor: Color.fromARGB(255, 255, 0, 0),
                                                  cursorColor: Color.fromARGB(255, 0, 0, 0))
                          )),
     }
                ));
 }
        public override Widget build(BuildContext context)
        {
            ClipRRect child = new ClipRRect
                              (
                borderRadius: BorderRadius.circular(scrollBarSize / 2),
                child: new Container(padding: EdgeInsets.fromLTRB(2, 2, 2, 2), color: Theme.of(context).indicatorColor)
                              );
            float width = widget.direction == NodeEditorScrollBarDirection.X
                ? widget.scrollViewSize.x * Math.Min(widget.scrollViewSize.x / widget.scrollContentSize.x, 1)
                : scrollBarSize;
            float height = widget.direction == NodeEditorScrollBarDirection.X
                ? scrollBarSize
                : widget.scrollViewSize.y * Math.Min(widget.scrollViewSize.y / widget.scrollContentSize.y, 1);

            return(widget.direction == NodeEditorScrollBarDirection.X ?
                   new Positioned
                   (
                       child: child,
                       width: width,
                       bottom: 2,
                       height: height,
                       left: (widget.scrollViewSize.x - width) * widget.scrollViewOffset.x / (widget.scrollViewSize.x - widget.scrollContentSize.x)
                   ):
                   new Positioned
                   (
                       child: child,
                       width: width,
                       top: (widget.scrollViewSize.y - height) * widget.scrollViewOffset.y / (widget.scrollViewSize.y - widget.scrollContentSize.y),
                       height: height,
                       right: 2
                   ));
        }
示例#3
0
 public AlertDialog(
     Key key                    = null,
     Widget title               = null,
     EdgeInsets titlePadding    = null,
     TextStyle titleTextStyle   = null,
     Widget content             = null,
     EdgeInsets contentPadding  = null,
     TextStyle contentTextStyle = null,
     List <Widget> actions      = null,
     Color backgroundColor      = null,
     float?elevation            = null,
     ShapeBorder shape          = null
     ) : base(key: key)
 {
     this.title            = title;
     this.titlePadding     = titlePadding;
     this.titleTextStyle   = titleTextStyle;
     this.content          = content;
     this.contentPadding   = contentPadding ?? EdgeInsets.fromLTRB(24.0f, 20.0f, 24.0f, 24.0f);
     this.contentTextStyle = contentTextStyle;
     this.actions          = actions;
     this.backgroundColor  = backgroundColor;
     this.elevation        = elevation;
     this.shape            = shape;
 }
示例#4
0
        Widget _buildContentLecturerList()
        {
            var hosts = this.eventObj.hosts;

            if (hosts == null || hosts.Count == 0)
            {
                return(new Container());
            }

            var hostItems = new List <Widget>();

            hostItems.Add(new Container(
                              margin: EdgeInsets.symmetric(horizontal: 16, vertical: 40),
                              height: 1,
                              color: CColors.Separator2
                              ));
            hostItems.Add(new Padding(
                              padding: EdgeInsets.fromLTRB(16, 0, 16, 24),
                              child: new Text(
                                  "讲师",
                                  style: CTextStyle.H4
                                  )
                              ));
            hosts.ForEach(host => { hostItems.Add(_buildLecture(host)); });
            return(new Column(
                       crossAxisAlignment: CrossAxisAlignment.start,
                       children: hostItems
                       ));
        }
示例#5
0
 Widget descInput()
 {
     return(new Container(
                margin: EdgeInsets.fromLTRB(0, 10, 0, 10),
                child: new Row(
                    children: new List <Widget>(
                        )
     {
         new SizedBox(width: 100, child: new Text("Description")),
         new Flexible(child: new Container(
                          height: 200,
                          decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
                          padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
                          child: new EditableText(maxLines: 200,
                                                  controller: this.descController,
                                                  selectionControls: MaterialUtils.materialTextSelectionControls,
                                                  focusNode: new FocusNode(),
                                                  style: new TextStyle(
                                                      fontSize: 18,
                                                      height: 1.5f,
                                                      color: new Color(0xFF1389FD)
                                                      ),
                                                  selectionColor: Color.fromARGB(255, 255, 0, 0),
                                                  cursorColor: Color.fromARGB(255, 0, 0, 0))
                          )),
     }
                    )));
 }
示例#6
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: new List <Widget>
     {
         new Container(
             width: 300,
             decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
             padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
             child: new EditableText(maxLines: 1,
                                     controller: this.controller,
                                     onSubmitted: (text) => { _addItem(); },
                                     selectionControls: MaterialUtils.materialTextSelectionControls,
                                     autofocus: true,
                                     focusNode: new FocusNode(),
                                     style: new TextStyle(
                                         fontSize: 18,
                                         height: 1.5f,
                                         color: new Color(0xFF1389FD)
                                         ),
                                     selectionColor: Color.fromARGB(255, 255, 0, 0),
                                     cursorColor: Color.fromARGB(255, 0, 0, 0))
             ),
         new RaisedButton(
             color: Color.fromARGB(255, 0, 204, 204),
             padding: EdgeInsets.all(10),
             child: new Text("Add", style: new TextStyle(
                                 fontSize: 20, color: Color.fromARGB(255, 255, 255, 255), fontWeight: FontWeight.w700
                                 )), onPressed: _addItem)
     }
                    )));
 }
示例#7
0
 public static void createView(CustomToastItem toastItem)
 {
     _overlayState = Overlay.of(context: toastItem.context);
     _overlayEntry = new OverlayEntry(
         _context => new CustomToastWidget(
             gravity: toastItem.gravity,
             new Container(
                 width: MediaQuery.of(context: _context).size.width,
                 alignment: Alignment.center,
                 child: new Container(
                     decoration: new BoxDecoration(
                         color: toastItem.backgroundColor,
                         borderRadius: BorderRadius.circular(radius: toastItem.radius)
                         ),
                     margin: EdgeInsets.symmetric(horizontal: 20),
                     padding: EdgeInsets.fromLTRB(16, 10, 16, 10),
                     child: new Text(
                         data: toastItem.message,
                         style: CTextStyle.PLargeTitle.copyWith(color: toastItem.textColor)
                         )
                     )
                 )
             )
         );
     _isVisible = true;
     _overlayState.insert(entry: _overlayEntry);
     _timer = Window.instance.run((TimeSpan)toastItem.duration, callback: dismiss);
 }
示例#8
0
        public EdgeInsetsGeometry getPadding(MaterialButton button)
        {
            if (button.padding != null)
            {
                return(button.padding);
            }

            if (button is MaterialButtonWithIconMixin)
            {
                return(EdgeInsets.fromLTRB(12.0f, 0.0f, 16.0f, 0.0f));
            }

            if (_padding != null)
            {
                return(_padding);
            }

            switch (getTextTheme(button))
            {
            case ButtonTextTheme.normal:
            case ButtonTextTheme.accent:
                return(EdgeInsets.symmetric(horizontal: 16.0f));

            case ButtonTextTheme.primary:
                return(EdgeInsets.symmetric(horizontal: 24.0f));
            }

            D.assert(false);
            return(EdgeInsets.zero);
        }
 public override Widget build(BuildContext context)
 {
     return(new ShrinePage(
                scaffoldKey: this.scaffoldKey,
                products: this.widget.products,
                shoppingCart: this.widget.shoppingCart,
                floatingActionButton: new FloatingActionButton(
                    onPressed: () => {
         this.updateOrder(inCart: true);
         int n = this.currentOrder.quantity;
         string item = this.currentOrder.product.name;
         string message = n == 1 ? $"is one {item} item" : $"are {n} {item} items";
         this.showSnackBarMessage(
             $"There {message} in the shopping cart."
             );
     },
                    backgroundColor: new Color(0xFF16F0F0),
                    tooltip: "Add to cart",
                    child: new Icon(
                        Icons.add_shopping_cart,
                        color: Colors.black
                        )
                    ),
                body: new CustomScrollView(
                    slivers: new List <Widget> {
         new SliverToBoxAdapter(
             child: new _HeadingShrineOrder(
                 product: this.widget.order.product,
                 quantity: this.currentOrder.quantity,
                 quantityChanged: (int value) => { this.updateOrder(quantity: value); }
                 )
             ),
         new SliverSafeArea(
             top: false,
             minimum: EdgeInsets.fromLTRB(8.0f, 32.0f, 8.0f, 8.0f),
             sliver: new SliverGrid(
                 gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent(
                     maxCrossAxisExtent: 248.0f,
                     mainAxisSpacing: 8.0f,
                     crossAxisSpacing: 8.0f
                     ),
                 layoutDelegate: new SliverChildListDelegate(
                     this.widget.products
                     .FindAll((Product product) => product != this.widget.order.product)
                     .Select <Product, Widget>((Product product) => {
             return new Card(
                 elevation: 1.0f,
                 child: Image.asset(
                     product.imageAsset,
                     fit: BoxFit.contain
                     )
                 );
         }).ToList()
                     )
                 )
             )
     }
                    )
                ));
 }
示例#10
0
        public override Widget build(BuildContext context)
        {
            // D.assert(debugCheckHasMaterialLocalizations(context));

            ThemeData   theme       = Theme.of(context);
            DialogTheme dialogTheme = DialogTheme.of(context);

            List <Widget> children = new List <Widget>();

            if (this.title != null)
            {
                children.Add(new Padding(
                                 padding: this.titlePadding ??
                                 EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, this.content == null ? 20.0f : 0.0f),
                                 child: new DefaultTextStyle(
                                     style: this.titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.title,
                                     child: this.title
                                     )
                                 ));
            }

            if (this.content != null)
            {
                children.Add(new Flexible(
                                 child: new Padding(
                                     padding: this.contentPadding,
                                     child: new DefaultTextStyle(
                                         style: this.contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subhead,
                                         child: this.content
                                         )
                                     )
                                 ));
            }

            if (this.actions != null)
            {
                children.Add(ButtonTheme.bar(
                                 child: new ButtonBar(
                                     children: this.actions
                                     )
                                 ));
            }

            Widget dialogChild = new IntrinsicWidth(
                child: new Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: children
                    )
                );

            return(new Dialog(
                       backgroundColor: this.backgroundColor,
                       elevation: this.elevation,
                       shape: this.shape,
                       child: dialogChild
                       ));
        }
示例#11
0
    public override Widget build(BuildContext context)
    {
        Size deviseSize = MediaQuery.of(context).size;

        return(new Theme(
                   data: new ThemeData(),
                   child: new Scaffold(
                       appBar: new AppBar(title: new Text("Test App")),
                       body: new Container(
                           child: new Column(
                               children: new List <Widget> {
            new Column(
                children: new List <Widget> {
                new Container(
                    padding: EdgeInsets.fromLTRB(deviseSize.width * .03f, deviseSize.height * .03f, deviseSize.width * .03f, deviseSize.height * .01f),
                    width: deviseSize.width,
                    color: Colors.black12,
                    child: new Text(
                        "samplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesample"
                        )
                    ),
                new Container(
                    padding: EdgeInsets.fromLTRB(deviseSize.width * .03f, deviseSize.height * .03f, deviseSize.width * .03f, deviseSize.height * .01f),
                    width: deviseSize.width,
                    color: Colors.white,
                    child: new Text(
                        "samplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesample"
                        )
                    ),
            }
                ),
            new Column(
                children: new List <Widget> {
                new Container(
                    padding: EdgeInsets.fromLTRB(deviseSize.width * .03f, deviseSize.height * .03f, deviseSize.width * .03f, deviseSize.height * .01f),
                    width: deviseSize.width,
                    color: Colors.black12,
                    child: new Text(
                        "samplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesample"
                        )
                    ),
                new Container(
                    padding: EdgeInsets.fromLTRB(deviseSize.width * .03f, deviseSize.height * .03f, deviseSize.width * .03f, deviseSize.height * .01f),
                    width: deviseSize.width,
                    color: Colors.white,
                    child: new Text(
                        "samplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesamplesample"
                        )
                    ),
            }
                ),
        }
                               )
                           )
                       )
                   ));
    }
示例#12
0
 public override Widget build(BuildContext context)
 {
     return(new Padding(
                padding: EdgeInsets.fromLTRB(4.0f, 4.0f, 4.0f, 12.0f),
                child: new Align(
                    alignment: Alignment.centerLeft,
                    child: new Text(this.title, style: Theme.of(context).textTheme.subtitle1)
                    )
                ));
 }
示例#13
0
        public override Widget build(BuildContext context)
        {
            List <Widget> widgets = _buildColumns(context);

            return(new ListView(
                       scrollDirection: Axis.horizontal,
                       padding: EdgeInsets.fromLTRB(0.0f, 34.0f, 16.0f, 44.0f),
                       children: widgets,
                       physics: new AlwaysScrollableScrollPhysics()
                       ));
        }
 public Widget multiLineText()
 {
     return(new Padding(
                padding: EdgeInsets.fromLTRB(100.0f, 0.0f, 100.0f, 0.0f),
                child: new TextField(
                    keyboardType: TextInputType.multiline,
                    textInputAction: TextInputAction.newline,
                    textAlign: TextAlign.left,
                    textDirection: TextDirection.ltr,
                    minLines: 1,
                    maxLines: 3
                    )
                ));
 }
示例#15
0
 Widget showLogo()
 {
     return(new Hero(
                tag: "hero",
                child: new Padding(
                    padding: EdgeInsets.fromLTRB(0.0f, 70.0f, 0.0f, 0.0f),
                    child: new CircleAvatar(
                        //child: new Image.asset('assets/flutter-icon.png'),
                        child: new Unity.UIWidgets.widgets.Image(image: new AssetImage("unitychan")),
                        backgroundColor: Colors.transparent,
                        radius: 48.0f
                        )
                    )
                ));
 }
示例#16
0
 public SimpleDialog(
     Key key                   = null,
     Widget title              = null,
     EdgeInsets titlePadding   = null,
     List <Widget> children    = null,
     EdgeInsets contentPadding = null,
     ShapeBorder shape         = null
     ) : base(key: key)
 {
     this.title          = title;
     this.titlePadding   = titlePadding ?? EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, 0.0f);
     this.children       = children;
     this.contentPadding = contentPadding ?? EdgeInsets.fromLTRB(0.0f, 12.0f, 0.0f, 16.0f);
     this.shape          = shape;
 }
示例#17
0
 public static MarkdownStyleSheet defaultStyle()
 {
     return(new MarkdownStyleSheet(
                CTextStyle.PXLargeBlue,
                CTextStyle.PXLarge,
                CTextStyle.PCodeStyle,
                CTextStyle.H4,
                CTextStyle.H5,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge.copyWith(fontStyle: FontStyle.italic),
                CTextStyle.PXLarge.copyWith(fontWeight: FontWeight.bold),
                new TextStyle(decoration: TextDecoration.lineThrough),
                CTextStyle.PXLargeBody4,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                8.0f,
                24.0f,
                CTextStyle.PXLarge,
                new TextStyle(fontWeight: FontWeight.w600),
                CTextStyle.PXLarge,
                TextAlign.center,
                TableBorder.all(color: CColors.Grey, width: 0),
                new FlexColumnWidth(),
                EdgeInsets.fromLTRB(16, 8, 16, 8),
                tableCellsDecoration: new BoxDecoration(color: CColors.Grey),
                blockquotePadding: EdgeInsets.all(16.0f),
                blockquoteDecoration: new BoxDecoration(
                    border: new Border(
                        left: new BorderSide(
                            color: CColors.Separator,
                            8
                            ))
                    ),
                codeblockPadding: EdgeInsets.all(30.0f),
                codeblockDecoration: new BoxDecoration(
                    color: Color.fromRGBO(110, 198, 255, 0.12f)
                    ),
                horizontalRuleDecoration: new BoxDecoration(
                    border: new Border(
                        top: new BorderSide(width: 5.0f, color: CColors.Grey)
                        )
                    )));
 }
示例#18
0
 public AlertDialog(
     Key key                   = null,
     Widget title              = null,
     EdgeInsets titlePadding   = null,
     Widget content            = null,
     EdgeInsets contentPadding = null,
     List <Widget> actions     = null,
     ShapeBorder shape         = null
     ) : base(key: key)
 {
     this.title          = title;
     this.titlePadding   = titlePadding;
     this.content        = content;
     this.contentPadding = contentPadding ?? EdgeInsets.fromLTRB(24.0f, 20.0f, 24.0f, 24.0f);
     this.actions        = actions;
     this.shape          = shape;
 }
 public DrawerHeader(
     Key key = null,
     Decoration decoration = null,
     EdgeInsets margin     = null,
     EdgeInsets padding    = null,
     TimeSpan?duration     = null,
     Curve curve           = null,
     Widget child          = null
     ) : base(key: key)
 {
     D.assert(child != null);
     this.decoration = decoration;
     this.margin     = margin ?? EdgeInsets.only(bottom: 8.0f);
     this.padding    = padding ?? EdgeInsets.fromLTRB(16.0f, 16.0f, 16.0f, 8.0f);
     this.duration   = duration ?? new TimeSpan(0, 0, 0, 0, 250);
     this.curve      = curve ?? Curves.fastOutSlowIn;
     this.child      = child;
 }
示例#20
0
 public SimpleDialog(
     Key key                   = null,
     Widget title              = null,
     EdgeInsets titlePadding   = null,
     List <Widget> children    = null,
     EdgeInsets contentPadding = null,
     Color backgroundColor     = null,
     float?elevation           = null,
     ShapeBorder shape         = null
     ) : base(key: key)
 {
     this.title           = title;
     this.titlePadding    = titlePadding ?? EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, 0.0f);
     this.children        = children;
     this.contentPadding  = contentPadding ?? EdgeInsets.fromLTRB(0.0f, 12.0f, 0.0f, 16.0f);
     this.backgroundColor = backgroundColor;
     this.elevation       = elevation;
     this.shape           = shape;
 }
示例#21
0
 Widget showEmailInput()
 {
     return(new Padding(
                padding: EdgeInsets.fromLTRB(0.0f, 100.0f, 0.0f, 0.0f),
                child: new TextFormField(
                    maxLines: 1,
                    keyboardType: TextInputType.emailAddress,
                    autofocus: false,
                    decoration: new InputDecoration(
                        hintText: "Email",
                        icon: new Icon(
                            Icons.mail,
                            color: Colors.grey
                            )
                        ),
                    validator: new FormFieldValidator <string>((value) => value.isEmpty() ? "Email can\'t be empty" : null),
                    onSaved: new FormFieldSetter <string>((value) => _email = value.Trim())
                    )
                ));
 }
示例#22
0
 Widget showPasswordInput()
 {
     return(new Padding(
                padding: EdgeInsets.fromLTRB(0.0f, 15.0f, 0.0f, 0.0f),
                child: new TextFormField(
                    maxLines: 1,
                    obscureText: true,
                    autofocus: false,
                    decoration: new InputDecoration(
                        hintText: "Password",
                        icon: new Icon(
                            Icons.lock_icon,
                            color: Colors.grey
                            )
                        ),
                    validator: (value) => value.isEmpty() ? "Password can\'t be empty" : null,
                    onSaved: (value) => _password = value.Trim()
                    )
                ));
 }
示例#23
0
 Widget showPrimaryButton()
 {
     return(new Padding(
                padding: EdgeInsets.fromLTRB(0.0f, 45.0f, 0.0f, 0.0f),
                child: new SizedBox(
                    height: 40.0f,
                    child: new RaisedButton(
                        elevation: 2.0f, //阴影
                        shape: new RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(20.0f)
                            ),
                        color: Colors.blue,
                        child: new Text(
                            _isLoginForm ? "Login" : "Create account",
                            style: new TextStyle(fontSize: 20.0f, color: Colors.white)
                            ),
                        onPressed: validateAndSubmit
                        )
                    )
                ));
 }
示例#24
0
 public AlertDialog(
     Key key      = null,
     Widget title = null,
     EdgeInsetsGeometry titlePadding = null,
     TextStyle titleTextStyle        = null,
     Widget content = null,
     EdgeInsetsGeometry contentPadding          = null,
     TextStyle contentTextStyle                 = null,
     List <Widget> actions                      = null,
     EdgeInsetsGeometry actionsPadding          = null,
     VerticalDirection actionsOverflowDirection = VerticalDirection.up,
     float actionsOverflowButtonSpacing         = 0,
     EdgeInsetsGeometry buttonPadding           = null,
     Color backgroundColor                      = null,
     float?elevation         = null,
     EdgeInsets insetPadding = null,
     Clip clipBehavior       = Clip.none,
     ShapeBorder shape       = null,
     bool scrollable         = false
     ) : base(key: key)
 {
     this.title                        = title;
     this.titlePadding                 = titlePadding;
     this.titleTextStyle               = titleTextStyle;
     this.content                      = content;
     this.contentPadding               = contentPadding ?? EdgeInsets.fromLTRB(24.0f, 20.0f, 24.0f, 24.0f);
     this.contentTextStyle             = contentTextStyle;
     this.actions                      = actions;
     this.actionsPadding               = actionsPadding ?? EdgeInsets.zero;
     this.actionsOverflowDirection     = actionsOverflowDirection;
     this.actionsOverflowButtonSpacing = actionsOverflowButtonSpacing;
     this.buttonPadding                = buttonPadding;
     this.backgroundColor              = backgroundColor;
     this.elevation                    = elevation;
     this.insetPadding                 = insetPadding ?? material_._defaultInsetPadding;
     this.clipBehavior                 = clipBehavior;
     this.shape                        = shape;
     this.scrollable                   = scrollable;
 }
 Widget buildTabView(_Page page)
 {
     return(new Builder(
                builder: (BuildContext context) => {
         return new Container(
             key: new ValueKey <string>(page.label),
             padding: EdgeInsets.fromLTRB(48.0f, 48.0f, 48.0f, 96.0f),
             child: new Card(
                 child: new Center(
                     child: new Text(page.label,
                                     style: new TextStyle(
                                         color: page.labelColor,
                                         fontSize: 32.0f
                                         ),
                                     textAlign: TextAlign.center
                                     )
                     )
                 )
             );
     }
                ));
 }
示例#26
0
 Widget _buildNickNameInputer()
 {
     return(new Row(
                children: new List <Widget>
     {
         new Flexible(child: new Container(
                          color: new Color(0xffffffff),
                          padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
                          child: new EditableText(maxLines: 1,
                                                  controller: TitleController,
                                                  selectionControls: MaterialUtils.materialTextSelectionControls,
                                                  autofocus: true,
                                                  focusNode: new FocusNode(),
                                                  style: new TextStyle(
                                                      fontSize: 18,
                                                      height: 2.5f,
                                                      color: new Color(0xff000000)
                                                      ),
                                                  selectionColor: Color.fromARGB(255, 255, 0, 0),
                                                  cursorColor: Color.fromARGB(255, 0, 0, 0))
                          )),
     }
                ));
 }
示例#27
0
 public override Widget build(BuildContext context)
 {
     if (MediaQuery.of(context).orientation == Orientation.portrait || widget.portraitOnly)
     {
         return(new Column(
                    children: new List <Widget>
         {
             new SizedBox(
                 width: widget.colorPickerWidth,
                 height: widget.colorPickerWidth * widget.pickerAreaHeightPercent,
                 child: colorPickerArea()
                 ),//SizedBox
             new Padding(
                 padding: EdgeInsets.fromLTRB(15f, 5f, 10f, 5f),
                 child: new Row(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: new List <Widget>
             {
                 new ColorIndicator(currentHsvColor),
                 new Expanded(
                     child: new Column(
                         children: new List <Widget> {
                     new SizedBox(
                         height: 40f,
                         width: widget.colorPickerWidth - 75,
                         child: colorPickerSlider(TrackType.hue)
                         ),
                     new Visibility(
                         visible: widget.enableAlpha,
                         child: new SizedBox(
                             height: 40f,
                             width: widget.colorPickerWidth - 75,
                             child: colorPickerSlider(TrackType.alpha)
                             ) //SizedBox
                         )     //Visibility
                 }
                         )     //Column
                     )         //Expanded
             }
                     )         //Row
                 ),            //Padding
             new Visibility(
                 visible: widget.showLabel,
                 child: new ColorPickerLabel(
                     currentHsvColor,
                     enableAlpha: widget.enableAlpha,
                     textStyle: widget.labelTextStyle
                     )
                 ),
             new SizedBox(height: 20f)
         }              //List
                    )); //Column
     }
     else
     {
         return(new Row(
                    children: new List <Widget>
         {
             new Expanded(
                 child: new SizedBox(
                     width: 300f,
                     height: 200f,
                     child: colorPickerArea()
                     ) //SizedBox
                 ),    //Expanded
             new Column(
                 children: new List <Widget>
             {
                 new Row(
                     children: new List <Widget> {
                     new SizedBox(width: 20f),
                     new ColorIndicator(currentHsvColor),
                     new Column(
                         children: new List <Widget> {
                         new SizedBox(
                             height: 40f,
                             width: 260f,
                             child: colorPickerSlider(TrackType.hue)
                             ),
                         new Visibility(
                             visible: widget.enableAlpha,
                             child: new SizedBox(
                                 height: 40f,
                                 width: 260f,
                                 child: colorPickerSlider(TrackType.alpha)
                                 )
                             )
                     }
                         ),        //Column
                     new SizedBox(width: 10f)
                 }
                     ),    //Row
                 new SizedBox(width: 10f),
                 new Visibility(
                     visible: widget.showLabel,
                     child: new ColorPickerLabel(
                         currentHsvColor,
                         enableAlpha: widget.enableAlpha,
                         textStyle: widget.labelTextStyle
                         ) //ColorPickerLabel
                     )     //Visibility
             }
                 )         //Column
         }
                    ));    //Row
     }
 }
示例#28
0
        public override Widget build(BuildContext context)
        {
            return(new StoreConnector <AppState, AppState>(
                       converter: state => state,
                       builder: (buildContext, model, dispatcher) =>
            {
                return new Scaffold(
                    appBar: new AppBar(
                        centerTitle: true,
                        elevation: 0,
                        leading: new IconButton(
                            icon: new Icon(Icons.arrow_back),
                            onPressed: () => { Navigator.pop(context); }
                            ),
                        title: new Text(widget.CreateMode ? "New Habit" : "Edit Habit"),
                        bottom: new PreferredSize(
                            preferredSize: Size.fromHeight(1),
                            child: new Container(
                                height: 0.5f,
                                color: Colors.white30
                                )
                            ),
                        actions: new List <Widget>()
                {
                    new FlatButton(
                        child: new Text(widget.CreateMode ? "" : "Delete",
                                        style: new TextStyle(color: Colors.red)),
                        onPressed: () =>
                    {
                        DialogUtils.showDialog(
                            context: context,
                            builder: (context1 =>
                        {
                            return new Theme(
                                data: new ThemeData(dialogBackgroundColor: new Color(0xFF333333)),
                                child: new AlertDialog(
                                    contentPadding: EdgeInsets.fromLTRB(24, 24, 24, 0),
                                    content: new Text("Really want to delete this habit?",
                                                      style: new TextStyle(color: Colors.white70)
                                                      ),
                                    actions: new List <Widget>()
                            {
                                new FlatButton(
                                    child: new Text("Yes",
                                                    style: new TextStyle(color: Colors.red)
                                                    ),
                                    onPressed: () =>
                                {
                                    dispatcher.dispatch(
                                        new DeleteHabitAction(widget.Habit));
                                    Navigator.pop(context1);
                                    Navigator.pop(context);
                                }),
                                new FlatButton(
                                    child: new Text("No",
                                                    style: new TextStyle(color: Colors.white70)
                                                    ),
                                    onPressed: () => { Navigator.pop(context1); }),
                            }
                                    )
                                );
                        }));
                    }
                        )
                },
                        backgroundColor: new Color(0xFF212121)
                        ),
                    body: new Container(
                        margin: EdgeInsets.all(15),
                        decoration: new BoxDecoration(),
                        child: new TextField(
                            style: new TextStyle(fontSize: 18, color: Colors.white70),
                            decoration: new InputDecoration(
                                fillColor: new Color(0xFF424242),
                                filled: true,
                                hasFloatingPlaceholder: false,
                                hintText: "New Habit",
                                contentPadding: EdgeInsets.all(6),
                                focusedBorder: new OutlineInputBorder(
                                    borderRadius: BorderRadius.all(Radius.circular(6)),
                                    borderSide: new BorderSide(width: 0, color: new Color(0xFF424242))
                                    )
                                ),
                            controller: new TextEditingController(widget.CreateMode
                                    ? string.Empty
                                    : widget.Habit.Title),
                            onSubmitted: (value =>
                {
                    if (widget.CreateMode)
                    {
                        dispatcher.dispatch(new AddHabitAction(new HabitData(value)));
                    }
                    else
                    {
                        if (value != widget.Habit.Title)
                        {
                            dispatcher.dispatch(new UpdateHabitAction(widget.Habit, value));
                        }
                    }

                    Navigator.pop(context);
                }))
                        )
                    );
            }
                       ));
        }
示例#29
0
        public override Widget build(BuildContext context)
        {
            D.assert(material_.debugCheckHasMaterialLocalizations(context));

            ThemeData   theme       = Theme.of(context);
            DialogTheme dialogTheme = DialogTheme.of(context);

            Widget titleWidget   = null;
            Widget contentWidget = null;
            Widget actionsWidget = null;

            if (title != null)
            {
                titleWidget = new Padding(
                    padding: titlePadding ?? EdgeInsets.fromLTRB(24.0f, 24.0f, 24.0f, content == null ? 20.0f : 0.0f),
                    child: new DefaultTextStyle(
                        style: titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.headline6,
                        child: title
                        )
                    );
            }

            if (content != null)
            {
                contentWidget = new Padding(
                    padding: contentPadding,
                    child: new DefaultTextStyle(
                        style: contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subtitle1,
                        child: content
                        )
                    );
            }

            if (actions != null)
            {
                actionsWidget = new Padding(
                    padding: actionsPadding,
                    child: new ButtonBar(
                        buttonPadding: buttonPadding,
                        overflowDirection: actionsOverflowDirection,
                        overflowButtonSpacing: actionsOverflowButtonSpacing,
                        children: actions
                        )
                    );
            }

            List <Widget> columnChildren;

            if (scrollable)
            {
                var titleList = new List <Widget>();

                if (title != null)
                {
                    titleList.Add(titleWidget);
                }

                if (content != null)
                {
                    titleList.Add(contentWidget);
                }

                columnChildren = new List <Widget>();

                if (title != null || content != null)
                {
                    columnChildren.Add(new Flexible(
                                           child: new SingleChildScrollView(
                                               child: new Column(
                                                   mainAxisSize: MainAxisSize.min,
                                                   crossAxisAlignment: CrossAxisAlignment.stretch,
                                                   children: titleList
                                                   )
                                               )
                                           ));
                }

                if (actions != null)
                {
                    columnChildren.Add(actionsWidget);
                }
            }
            else
            {
                columnChildren = new List <Widget>();
                if (title != null)
                {
                    columnChildren.Add(titleWidget);
                }

                if (content != null)
                {
                    columnChildren.Add(new Flexible(child: contentWidget));
                }

                if (actions != null)
                {
                    columnChildren.Add(actionsWidget);
                }
            }

            Widget dialogChild = new IntrinsicWidth(
                child: new Column(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: columnChildren
                    )
                );

            return(new Dialog(
                       backgroundColor: backgroundColor,
                       elevation: elevation,
                       insetPadding: insetPadding,
                       clipBehavior: clipBehavior,
                       shape: shape,
                       child: dialogChild
                       ));
        }
示例#30
0
            public override Widget build(BuildContext context)
            {
                var card = new Container(
                    margin: EdgeInsets.only(right: 45),
                    child: new Container(
                        child: new Column(
                            children: new List <Widget> {
                    new Container(
                        decoration: new BoxDecoration(
                            color: CLColors.white,
                            borderRadius: BorderRadius.only(topLeft: 3, topRight: 3)
                            ),
                        width: 200,
                        height: 124,
                        child: Image.network(
                            this.imageSrc,
                            fit: BoxFit.fill
                            )
                        ),
                    new Container(
                        color: CLColors.white,
                        width: 200,
                        height: 86,
                        padding: EdgeInsets.fromLTRB(14, 12, 14, 8),
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.baseline,
                            children: new List <Widget> {
                        new Container(
                            height: 18,
                            padding: EdgeInsets.only(top: 3),
                            child:
                            new Text(this.category,
                                     style: new TextStyle(
                                         fontSize: 11,
                                         color: CLColors.text5
                                         )
                                     )
                            ),
                        new Container(
                            height: 20,
                            padding: EdgeInsets.only(top: 2),
                            child:
                            new Text(this.name,
                                     style: new TextStyle(
                                         fontSize: 14,
                                         color: CLColors.text6
                                         )
                                     )
                            ),
                        new Container(
                            height: 22,
                            padding: EdgeInsets.only(top: 4),
                            child: new Row(
                                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                children: new List <Widget> {
                            new Container(
                                child: new Row(
                                    children: new List <Widget> {
                                new Container(
                                    margin: EdgeInsets.only(right: 10),
                                    child: new Text(
                                        "$" + this.price,
                                        style: new TextStyle(
                                            fontSize: 14,
                                            color: CLColors.text7,
                                            decoration: TextDecoration.lineThrough
                                            )
                                        )
                                    ),
                                new Container(
                                    child: new Text(
                                        "$" + this.priceDiscount,
                                        style: new TextStyle(
                                            fontSize: 14,
                                            color: CLColors.text8
                                            )
                                        )
                                    )
                            })
                                ),
                            this.showBadge
                                                            ? new Container(
                                width: 80,
                                height: 18,
                                color: CLColors.black,
                                child: new Row(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    crossAxisAlignment: CrossAxisAlignment.center,
                                    children: new List <Widget> {
                                new Text(
                                    "Plus/Pro",
                                    style: new TextStyle(
                                        fontSize: 11,
                                        color: CLColors.white
                                        )
                                    )
                            }
                                    )
                                )
                                                            : new Container()
                        }
                                )
                            )
                    }
                            )
                        )
                }
                            )
                        )
                    );

                return(card);
            }