Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_cross_axis_baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_cross_axis_center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_cross_axis_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_cross_axis_fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_cross_axis_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_main_axis_center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_main_axis_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_main_axis_spaceAround.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_main_axis_spaceBetween.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_main_axis_spaceEvenly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_col_main_axis_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_cross_axis_baseline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_cross_axis_center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_cross_axis_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_cross_axis_fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_cross_axis_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_main_axis_center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_main_axis_end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_main_axis_spaceAround.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_main_axis_spaceBetween.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_main_axis_spaceEvenly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions masonry/screenshots/stack_row_main_axis_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions masonry/src/widgets/flex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ use crate::properties::{Background, BorderColor, BorderWidth, CornerRadius, Padd
use crate::theme::DEFAULT_GAP;
use crate::util::{debug_panic, fill, include_screenshot, stroke};

/// A container with either horizontal or vertical layout.
/// A flexible container with either horizontal or vertical layout.
///
/// This widget is the foundation of most layouts, and is highly configurable.
///
/// That said, if you don't need children with a size based on available space or spacers,
/// you can use the simpler [`Stack`](crate::widgets::Stack) instead.
///
#[doc = include_screenshot!("flex_col_main_axis_spaceAround.png", "Flex column with multiple labels.")]
pub struct Flex {
direction: Axis,
Expand Down Expand Up @@ -530,7 +533,11 @@ fn new_flex_child(params: FlexParams, child: WidgetPod<dyn Widget>) -> Child {
}
}

fn get_spacing(alignment: MainAxisAlignment, extra: f64, child_count: usize) -> (f64, f64) {
pub(crate) fn get_spacing(
alignment: MainAxisAlignment,
extra: f64,
child_count: usize,
) -> (f64, f64) {
let space_before;
let space_between;
match alignment {
Expand Down
2 changes: 2 additions & 0 deletions masonry/src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod scroll_bar;
mod sized_box;
mod spinner;
mod split;
mod stack;
mod text_area;
mod text_input;
mod variable_label;
Expand All @@ -42,6 +43,7 @@ pub use self::scroll_bar::ScrollBar;
pub use self::sized_box::SizedBox;
pub use self::spinner::Spinner;
pub use self::split::{Split, ceil_length};
pub use self::stack::Stack;
pub use self::text_area::{InsertNewline, TextAction, TextArea};
pub use self::text_input::TextInput;
pub use self::variable_label::VariableLabel;
Expand Down
Loading
Loading