示例#1
0
 public override Widget build(BuildContext context)
 {
     return(this.buildItem(
                context,
                ShrineTheme.of(context).featurePriceStyle,
                EdgeInsets.symmetric(horizontal: 24.0f, vertical: 16.0f)
                ));
 }
示例#2
0
        public Widget buildItem(BuildContext context, TextStyle style, EdgeInsets padding)
        {
            BoxDecoration decoration = null;

            if (ShrineHomeUtils._shoppingCart.getOrDefault(this.product) != null)
            {
                decoration = new BoxDecoration(color: ShrineTheme.of(context).priceHighlightColor);
            }

            return(new Container(
                       padding: padding,
                       decoration: decoration,
                       child: new Text(this.product.priceString, style: style)
                       ));
        }
示例#3
0
        public override Widget build(BuildContext context)
        {
            Size        screenSize = MediaQuery.of(context).size;
            ShrineTheme theme      = ShrineTheme.of(context);

            return(new SizedBox(
                       height: screenSize.width > screenSize.height
                    ? (screenSize.height - Constants.kToolbarHeight) * 0.85f
                    : (screenSize.height - Constants.kToolbarHeight) * 0.70f,
                       child: new Container(
                           decoration: new BoxDecoration(
                               color: theme.cardBackgroundColor,
                               border: new Border(bottom: new BorderSide(color: theme.dividerColor))
                               ),
                           child: new CustomMultiChildLayout(
                               layoutDelegate: new _HeadingLayout(),
                               children: new List <Widget> {
                new LayoutId(
                    id: _HeadingLayout.price,
                    child: new _FeaturePriceItem(product: this.product)
                    ),
                new LayoutId(
                    id: _HeadingLayout.image,
                    child: Image.asset(
                        this.product.imageAsset,
                        fit: BoxFit.cover
                        )
                    ),
                new LayoutId(
                    id: _HeadingLayout.title,
                    child: new Text(this.product.featureTitle, style: theme.featureTitleStyle)
                    ),
                new LayoutId(
                    id: _HeadingLayout.description,
                    child: new Text(this.product.featureDescription, style: theme.featureStyle)
                    ),
                new LayoutId(
                    id: _HeadingLayout.vendor,
                    child: new _VendorItem(vendor: this.product.vendor)
                    )
            }
                               )
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            ShrineTheme theme = ShrineTheme.of(context);

            return(new Column(
                       mainAxisSize: MainAxisSize.min,
                       crossAxisAlignment: CrossAxisAlignment.stretch,
                       children: new List <Widget> {
                new Text(this.product.name, style: theme.featureTitleStyle),
                new SizedBox(height: 24.0f),
                new Text(this.product.description, style: theme.featureStyle),
                new SizedBox(height: 16.0f),
                new Padding(
                    padding: EdgeInsets.only(top: 8.0f, bottom: 8.0f, right: 88.0f),
                    child: new DropdownButtonHideUnderline(
                        child: new Container(
                            decoration: new BoxDecoration(
                                border: Border.all(
                                    color: new Color(0xFFD9D9D9)
                                    )
                                ),
                            child: new DropdownButton <string>(
                                items: new List <int> {
                    0, 1, 2, 3, 4, 5
                }.Select <int, DropdownMenuItem <string> >(
                                    (int value) => {
                    return new DropdownMenuItem <string>(
                        value: $"{value}",
                        child: new Padding(
                            padding: EdgeInsets.only(left: 8.0f),
                            child: new Text($"Quantity {value}", style: theme.quantityMenuStyle)
                            )
                        );
                }).ToList(),
                                value: $"{this.quantity}",
                                onChanged: (value) => { this.onChanged(int.Parse(value)); })
                            )
                        )
                    )
            }
                       ));
        }
        public override Widget build(BuildContext context)
        {
            ShrineTheme theme = ShrineTheme.of(context);

            return(new Column(
                       mainAxisSize: MainAxisSize.min,
                       crossAxisAlignment: CrossAxisAlignment.stretch,
                       children: new List <Widget> {
                new SizedBox(
                    height: 24.0f,
                    child: new Align(
                        alignment: Alignment.bottomLeft,
                        child: new Text(this.vendor.name, style: theme.vendorTitleStyle)
                        )
                    ),
                new SizedBox(height: 16.0f),
                new Text(this.vendor.description, style: theme.vendorStyle)
            }
                       ));
        }
示例#6
0
 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)
             )
     }
                    )
                ));
 }
示例#7
0
        public override Widget build(BuildContext context)
        {
            ShrineTheme theme = ShrineTheme.of(context);

            return(new Scaffold(
                       key: this.widget.scaffoldKey,
                       appBar: new AppBar(
                           elevation: this._appBarElevation,
                           backgroundColor: theme.appBarBackgroundColor,
                           iconTheme: Theme.of(context).iconTheme,
                           brightness: Brightness.light,
                           flexibleSpace: new Container(
                               decoration: new BoxDecoration(
                                   border: new Border(
                                       bottom: new BorderSide(color: theme.dividerColor)
                                       )
                                   )
                               ),
                           title: new Text("SHRINE", style: ShrineTheme.of(context).appBarTitleStyle),
                           centerTitle: true,
                           actions: new List <Widget> {
                new IconButton(
                    icon: new Icon(Icons.shopping_cart),
                    tooltip: "Shopping cart",
                    onPressed: this._showShoppingCart
                    ),
                new PopupMenuButton <ShrineAction>(
                    itemBuilder: (BuildContext _) => new List <PopupMenuEntry <ShrineAction> > {
                    new PopupMenuItem <ShrineAction>(
                        value: ShrineAction.sortByPrice,
                        child: new Text("Sort by price")
                        ),
                    new PopupMenuItem <ShrineAction>(
                        value: ShrineAction.sortByProduct,
                        child: new Text("Sort by product")
                        ),
                    new PopupMenuItem <ShrineAction>(
                        value: ShrineAction.emptyCart,
                        child: new Text("Empty shopping cart")
                        )
                },
                    onSelected: (ShrineAction action) => {
                    switch (action)
                    {
                    case ShrineAction.sortByPrice:
                        this.setState(this._sortByPrice);
                        break;

                    case ShrineAction.sortByProduct:
                        this.setState(this._sortByProduct);
                        break;

                    case ShrineAction.emptyCart:
                        this.setState(this._emptyCart);
                        break;
                    }
                }
                    )
            }
                           ),
                       floatingActionButton: this.widget.floatingActionButton,
                       body: new NotificationListener <ScrollNotification>(
                           onNotification: this._handleScrollNotification,
                           child: this.widget.body
                           )
                       ));
        }