DebugRainbows – Xamarin.Forms

Olá, se você já desenvolve aplicações Xamarin.Forms a algum tempo, provavelmente  em algum momento se deparou com a seguinte situação: Você possui diversos componentes em sua Page e um deles está se sobressaindo o outro. Ou então o posicionamento não está do modo esperado.

Muitas vezes a primeira forma de tentar identificar o problema, é simplesmente mudar o BackgroundColor de seus componentes, para que assim você consiga identificar a posição exata de cada um deles.

Pensando nisso, criaram um plugin chamado Xamarin.Forms.DebugRainbows, ele basicamente faz essa troca de BackgroundColor para você poder debugar a sua aplicação.

 

ADICIONANDO O NUGET PACKAGE

Instale o plugin em seu projeto compartilhado.

Screen Shot 2019-05-19 at 21.11.37

 

 

Xaml

Adicione a referência para o plugin e também atribua true para DebugRainbow.IsDebug.

<?xml version="1.0" encoding="utf-8"?>
<ContentPage Rainbows:DebugRainbow.IsDebug="true"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:CrudDemo"
xmlns:Rainbows="clr-namespace:Xamarin.Forms.DebugRainbows;assembly=Xamarin.Forms.DebugRainbows"
x:Class="CrudDemo.Views.MainPage"
Title="Demo">
<ScrollView>
<StackLayout Margin="15">
<Label HorizontalTextAlignment="Center" Text="Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, Lorem ipsum dolor sit amet.., comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham." />
<StackLayout Orientation="Horizontal">
<Label VerticalTextAlignment="Center" Text="Accepted"/>
<Switch/>
</StackLayout>
<Label HorizontalTextAlignment="Center" Text="Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, Lorem ipsum dolor sit amet.., comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham." />
<StackLayout Orientation="Horizontal">
<Label VerticalTextAlignment="Center" Text="Accepted"/>
<Switch/>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage>

view raw
MainPage.xaml
hosted with ❤ by GitHub

 

 

Resultado

ezgif.com-gif-maker

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair /  Alterar )

Foto do Google

Você está comentando utilizando sua conta Google. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

Conectando a %s