HBox GetSnackBarLayout(Container?container, SnackBarOptions arguments) { var snackBarLayout = new HBox(); snackBarLayout.ModifyBg(StateType.Normal, arguments.BackgroundColor.ToGtkColor()); var message = new Gtk.Label(arguments.MessageOptions.Message); message.ModifyFont(new FontDescription { AbsoluteSize = arguments.MessageOptions.Font.FontSize, Family = arguments.MessageOptions.Font.FontFamily }); message.ModifyFg(StateType.Normal, arguments.MessageOptions.Foreground.ToGtkColor()); message.SetPadding((int)arguments.MessageOptions.Padding.Left, (int)arguments.MessageOptions.Padding.Top); snackBarLayout.Add(message); snackBarLayout.SetChildPacking(message, false, false, 0, PackType.Start); foreach (var action in arguments.Actions) { var button = new Gtk.Button { Label = action.Text }; button.ModifyFont(new FontDescription { AbsoluteSize = action.Font.FontSize, Family = action.Font.FontFamily }); button.ModifyBg(StateType.Normal, action.BackgroundColor.ToGtkColor()); button.ModifyFg(StateType.Normal, action.ForegroundColor.ToGtkColor()); button.Clicked += async(sender, e) => { snackBarTimer?.Stop(); if (action.Action != null) { await action.Action(); } arguments.SetResult(true); container?.Remove(snackBarLayout); }; snackBarLayout.Add(button); snackBarLayout.SetChildPacking(button, false, false, 0, PackType.End); } return(snackBarLayout); }