protected virtual void inicializarComponente() { _produtoListView = new ListView { HasUnevenRows = true, RowHeight = -1, SeparatorVisibility = SeparatorVisibility.None, ItemTemplate = new DataTemplate(ItemTemplate) }; _produtoListView.SetBinding(ListView.ItemsSourceProperty, new Binding(".")); _produtoListView.ItemTapped += produtoItemTapped; _vazioFrame = new Frame { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Style = Estilo.Current[EstiloProduto.PRODUTO_FRAME], Margin = new Thickness(7, 3), Padding = new Thickness(4, 3), Content = new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 2, Children = { new IconImage { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, IconColor = Estilo.Current.Produto.Label.TextColor, Margin = new Thickness(0, 2), Icon = "fa-warning", IconSize = 18 }, new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, FontSize = 18, Margin = new Thickness(0, 0, 0, 3), TextColor = Estilo.Current.Produto.Label.TextColor, Text = "Desculpe, no momento não temos esse produto em estoque. Agradecemos sua compreensão." } } } }; _totalView = new TotalCarrinhoView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.EndAndExpand, //HeightRequest = 50, ExibeQuantidade = true, ExibeTotal = true }; _carrinhoButton = new Button { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, Style = Estilo.Current[EstiloProduto.PRODUTO_CARRINHO_BOTAO], HeightRequest = 40, Text = "MEU CARRINHO" }; _carrinhoButton.Clicked += (sender, e) => { Navigation.PushAsync(CarrinhoUtils.gerarCarrinhoParaEntrega()); }; _empresaLabel = new Label { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 3), Text = "Smart Tecnologia ®" }; }
private void inicializarComponente() { _ProdutoListView = new ListView { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, RowHeight = -1, SeparatorVisibility = SeparatorVisibility.None, ItemTemplate = new DataTemplate(ItemTemplate) }; _ProdutoListView.SetBinding(ListView.ItemsSourceProperty, new Binding(".")); _totalView = new TotalCarrinhoView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, ExibeQuantidade = true, ExibeTotal = true, QuantidadeTitulo = "Qtde:" }; _empresaLabel = new Label { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 3), Text = "Smart Tecnologia ®" }; _valorMinimoLabel = new Label { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, FontSize = 10, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 3), Text = "0,00" }; _continuarCompraButton = new Button { Style = Estilo.Current[EstiloProduto.PRODUTO_CARRINHO_BOTAO], HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, Text = "Continuar Compras", FontSize = 11, HeightRequest = 40, Margin = new Thickness(4, 3, 4, 0) }; _continuarCompraButton.Clicked += (sender, e) => { var categoriaPage = CategoriaPageFactory.create(); categoriaPage.Title = "Categorias"; Navigation.PushAsync(categoriaPage); }; _finalizarCompraButton = new Button { //HorizontalOptions = LayoutOptions.FillAndExpand, //VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, Text = "Finalizar Compra", FontSize = 11, HeightRequest = 40, //Margin = new Thickness(4, 0, 4, 3), //Style = Estilo.Current[Estilo.BTN_SUCESSO] Style = Estilo.Current[EstiloProduto.PRODUTO_CARRINHO_BOTAO] }; _finalizarCompraButton.Clicked += FinalizarCompraButtonClicked; }
private void inicializarComponente() { _fotoImage = new Image { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 400, HeightRequest = 300, Aspect = Aspect.AspectFit }; _fotoImage.SetBinding(Image.SourceProperty, new Binding("FotoUrl")); _descricaoLabel = new Label { FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("#777777") }; _descricaoLabel.SetBinding(Label.TextProperty, new Binding("Descricao")); _categoriaLabel = new Label { FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("#777777") }; _categoriaLabel.SetBinding(Label.TextProperty, new Binding("Categoria.Nome")); _codigoLabel = new Label { FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("#777777") }; _codigoLabel.SetBinding(Label.TextProperty, new Binding("Codigo")); _moedaValorLabel = new Label { Text = "R$", FontSize = 11, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start }; _moedaValorLabel.SetBinding(Label.TextColorProperty, new Binding("PromocaoCor")); _valorFinalLabel = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.End, FontFamily = Estilo.Current.FontDefaultBold, FontAttributes = FontAttributes.Bold, FontSize = 24 }; _valorFinalLabel.SetBinding(Label.TextProperty, new Binding("ValorFinal", stringFormat: "{0:N2}")); _valorFinalLabel.SetBinding(Label.TextColorProperty, new Binding("PromocaoCor")); _volumeLabel = new Label { FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("#777777") }; _volumeLabel.SetBinding(Label.TextProperty, new Binding("VolumeStr")); _quantidadeLabel = new Label { FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("#777777") }; _quantidadeLabel.SetBinding(Label.TextProperty, new Binding("Quantidade")); _moedaPromocaoLabel = new Label { Text = "R$", FontSize = 11, //TextColor = Estilo.Current.D, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start }; _valorPromocaoLabel = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.End, FontFamily = Estilo.Current.FontDefaultBold, //TextColor = Estilo.Current.DangerColor, FontAttributes = FontAttributes.Bold, FontSize = 24 }; _valorPromocaoLabel.SetBinding(Label.TextProperty, new Binding("Valor", stringFormat: "{0:N2}")); var valorLayout = new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Margin = new Thickness(0, 0, 0, 3), Children = { _moedaPromocaoLabel, _valorPromocaoLabel } }; AbsoluteLayout.SetLayoutBounds(valorLayout, new Rectangle(0, 0, 1, 1)); AbsoluteLayout.SetLayoutFlags(valorLayout, AbsoluteLayoutFlags.All); var linha = new BoxView { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Estilo.Current.DangerColor, HeightRequest = 1, }; AbsoluteLayout.SetLayoutBounds(linha, new Rectangle(0, 0, 1, 1)); AbsoluteLayout.SetLayoutFlags(linha, AbsoluteLayoutFlags.All); _promocaoStack = new AbsoluteLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Children = { valorLayout, linha } }; _promocaoStack.SetBinding(AbsoluteLayout.IsVisibleProperty, new Binding("EmPromocao")); _quantidadeButton = new QuantidadeVControl { Margin = new Thickness(0, 5, 5, 0), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.End, FontFamily = Estilo.Current.FontDefaultBold, HeightRequest = 120 }; _quantidadeButton.SetBinding(QuantidadeHControl.QuantidadeProperty, new Binding("QuantidadeCarrinho")); _quantidadeButton.SetBinding(QuantidadeHControl.ProdutoProperty, new Binding(".")); _destaqueIcon = new IconImage { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Icon = "fa-star", IconColor = Color.FromHex("#ffc500"), IconSize = 24 }; _destaqueIcon.SetBinding(Label.IsVisibleProperty, new Binding("Destaque")); _totalView = new TotalCarrinhoView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.End, ExibeQuantidade = true, ExibeTotal = true }; _empresaLabel = new Label { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 3), Text = "Smart Tecnologia ®" }; }