switch tools to grid layout cells

This commit is contained in:
Kyle Spearrin 2016-12-19 08:32:32 -05:00
parent 83985965f2
commit 936f65ecc9
2 changed files with 21 additions and 27 deletions

View file

@ -113,6 +113,11 @@ namespace Bit.App.Pages
Text = labelText Text = labelText
}; };
if(Device.OS == TargetPlatform.Android)
{
label.TextColor = Color.Black;
}
var detail = new Label var detail = new Label
{ {
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
@ -121,41 +126,30 @@ namespace Bit.App.Pages
Text = detailText Text = detailText
}; };
if(Device.OS == TargetPlatform.Android)
{
label.TextColor = Color.Black;
}
var labelDetailStackLayout = new StackLayout
{
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Children = { label, detail },
Spacing = 0
};
var image = new Image var image = new Image
{ {
HorizontalOptions = LayoutOptions.Start, Source = imageSource
VerticalOptions = LayoutOptions.FillAndExpand,
Source = imageSource,
Margin = new Thickness(0, 0, 10, 0)
}; };
var containerStackLayout = new StackLayout var grid = new Grid
{ {
Orientation = StackOrientation.Horizontal, ColumnSpacing = 15,
Children = { image, labelDetailStackLayout }, RowSpacing = 0,
Padding = Device.OnPlatform( Padding = new Thickness(15, 25)
iOS: new Thickness(15, 25),
Android: new Thickness(15, 20),
WinPhone: new Thickness(15, 25))
}; };
grid.AdjustPaddingForDevice();
containerStackLayout.AdjustPaddingForDevice(); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(44, GridUnitType.Absolute) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grid.Children.Add(image, 0, 0);
Grid.SetRowSpan(image, 2);
grid.Children.Add(label, 1, 0);
grid.Children.Add(detail, 1, 1);
ShowDisclousure = true; ShowDisclousure = true;
View = containerStackLayout; View = grid;
} }
} }
} }

View file

@ -77,7 +77,7 @@ namespace Bit.App
} }
} }
public static void AdjustPaddingForDevice(this StackLayout view) public static void AdjustPaddingForDevice(this Layout view)
{ {
if(Device.OS == TargetPlatform.Android) if(Device.OS == TargetPlatform.Android)
{ {