Package 

Class SizeKt

    • Method Summary

      Modifier and Type Method Description
      final static Modifier statusBarsHeight(Modifier $self, Dp additional) Declare the height of the content to match the height of the status bars exactly.
      final static Modifier navigationBarsHeight(Modifier $self, Dp additional) Declare the preferred height of the content to match the height of the navigation bars when present at the bottom of the screen.
      final static Modifier navigationBarsWidth(Modifier $self, HorizontalSide side, Dp additional) Declare the preferred width of the content to match the width of the navigation bars, on the given side.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • statusBarsHeight

         final static Modifier statusBarsHeight(Modifier $self, Dp additional)

        Declare the height of the content to match the height of the status bars exactly.

        This is very handy when used with Spacer to push content below the status bars:

        Column {
            Spacer(Modifier.statusBarHeight())
        
            // Content to be drawn below status bars (y-axis)
        }

        It's also useful when used to draw a scrim which matches the status bars:

        Spacer(
            Modifier.statusBarHeight()
                .fillMaxWidth()
                .drawBackground(MaterialTheme.colors.background.copy(alpha = 0.3f)
        )

        Internally this matches the behavior of the Modifier.height modifier.

        Parameters:
        additional - Any additional height to add to the status bars size.
      • navigationBarsHeight

         final static Modifier navigationBarsHeight(Modifier $self, Dp additional)

        Declare the preferred height of the content to match the height of the navigation bars when present at the bottom of the screen.

        This is very handy when used with Spacer to push content below the navigation bars:

        Column {
            // Content to be drawn above status bars (y-axis)
            Spacer(Modifier.navigationBarHeight())
        }

        It's also useful when used to draw a scrim which matches the navigation bars:

        Spacer(
            Modifier.navigationBarHeight()
                .fillMaxWidth()
                .drawBackground(MaterialTheme.colors.background.copy(alpha = 0.3f)
        )

        Internally this matches the behavior of the Modifier.height modifier.

        Parameters:
        additional - Any additional height to add to the status bars size.
      • navigationBarsWidth

         final static Modifier navigationBarsWidth(Modifier $self, HorizontalSide side, Dp additional)

        Declare the preferred width of the content to match the width of the navigation bars, on the given side.

        This is very handy when used with Spacer to push content inside from any vertical navigation bars (typically when the device is in landscape):

        Row {
            Spacer(Modifier.navigationBarWidth(HorizontalSide.Left))
        
            // Content to be inside the navigation bars (x-axis)
        
            Spacer(Modifier.navigationBarWidth(HorizontalSide.Right))
        }

        It's also useful when used to draw a scrim which matches the navigation bars:

        Spacer(
            Modifier.navigationBarWidth(HorizontalSide.Left)
                .fillMaxHeight()
                .drawBackground(MaterialTheme.colors.background.copy(alpha = 0.3f)
        )

        Internally this matches the behavior of the Modifier.height modifier.

        Parameters:
        side - The navigation bar side to use as the source for the width.
        additional - Any additional width to add to the status bars size.