Skip to content

Commit 0d08eb6

Browse files
Copilothaavamoa
andcommitted
Align Toolbar with M3 Bottom App Bar specs (80dp height, vertical centering)
Co-authored-by: haavamoa <2527084+haavamoa@users.noreply.github.com>
1 parent 89d1d89 commit 0d08eb6

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/library/DIPS.Mobile.UI/Components/Toolbar/Android/ToolbarHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ protected override LinearLayout CreatePlatformView()
2929
border.SetBackgroundColor(Resources.Colors.Colors.GetColor(ColorName.color_border_default).ToPlatform());
3030
outer.AddView(border, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, borderPx));
3131

32-
// Buttons row
32+
// Buttons row: fills remaining space, centers buttons vertically (M3 spec: icons vertically centered in 80dp bar)
3333
m_buttonsLayout = new LinearLayout(Context)
3434
{
3535
Orientation = Orientation.Horizontal,
36+
Gravity = GravityFlags.CenterVertical,
3637
};
37-
outer.AddView(m_buttonsLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));
38+
outer.AddView(m_buttonsLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
3839

3940
return outer;
4041
}

src/library/DIPS.Mobile.UI/Components/Toolbar/Toolbar.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@ namespace DIPS.Mobile.UI.Components.Toolbar;
55
/// </summary>
66
/// <remarks>
77
/// iOS: https://developer.apple.com/design/human-interface-guidelines/toolbars
8-
/// Android: https://m3.material.io/components/toolbars/overview
8+
/// Android: https://m3.material.io/components/toolbars/overview (Bottom App Bar, height 80dp)
99
/// </remarks>
1010
[ContentProperty(nameof(Buttons))]
1111
public partial class Toolbar : View
1212
{
13+
public Toolbar()
14+
{
15+
// M3 Bottom App Bar spec: height = 80dp
16+
HeightRequest = Sizes.GetSize(SizeName.size_20);
17+
}
18+
19+
private void OnButtonsChanged()
20+
{
21+
Handler?.UpdateValue(nameof(Buttons));
22+
}
23+
1324
protected override void OnBindingContextChanged()
1425
{
1526
base.OnBindingContextChanged();

0 commit comments

Comments
 (0)