question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BottomAppBar] Eager padding setting

See original GitHub issue

Description: After updates to newest versions throughout Google’s portfolio I’m encountering issue which regards consuming insets. Since the widget applies padding to itself to counteract the window’s navigation and status areas’ size taken on the screen it does so in a very weird way.

If I’m consuming the insets, the padding is implicitly set to 0 by the widget - initialPadding being 0 (incorrectly) to which is added 0 as remainder of the consumed insets (correctly). When I’m not consuming any insets, the padding is set to 192 by the widget - initialPadding being 96 (incorrectly) to which is added 96 as remainder of consumed insets (correctly).

I’d speculate that this issue is partly caused by upstream libraries (such as core or appcompat) which might’ve altered the logic behind the OnApplyWindowInsetsListener and its respective callers.

Expected behavior: The BAB respects the initial padding set by other sources and peeks the remainder of systemWindowInsets and adds it to current padding if explicitly called for.

Source code:

    <style name="ThemeFoundation" parent="Theme.MaterialComponents.NoActionBar">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">true</item>
    </style>

* any BAB in activity’s root layout is having this issue, so omitted for brevity

Android API version: 28,29 - possibly any other as well

Material Library version: 1.1.0-alpha10

Device: Emulator, OnePlus 6T

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
craftingmodcommented, Sep 13, 2019

That listener modifes padding at their own but I misread your topic, sorry

1reaction
craftingmodcommented, Sep 13, 2019

Have you tried this code to cancel applywindowinsets? (bottomBar to your BottomAppBarLayout)

    ViewUtils.doOnApplyWindowInsets(bottomBar, object : ViewUtils.OnApplyWindowInsetsListener {
      override fun onApplyWindowInsets(view: View?, insets: WindowInsetsCompat?, initialPadding: ViewUtils.RelativePadding?): WindowInsetsCompat {
        return insets!!
      }
    })

Maybe simirar issue with me #564

Read more comments on GitHub >

github_iconTop Results From Across the Web

android BottomAppBar have extra left padding - Stack Overflow
I am using BottomAppBar in my app but it have a extra left padding. how to remove this padding? my xml code is:...
Read more >
Class BottomAppBar | Package Manager UI website
BottomAppBar (Key, Color, Nullable<Single>, NotchedShape, Clip, Single, Widget) · Declaration · Parameters ...
Read more >
flutter/flutter - Gitter
... EdgeInsets.all(8.0),// This is to adjust the padding around the appbar ... Hi, I'm very eager to learn about flutter since it support...
Read more >
Exploring the v28 Android Design Support Library Additions
app:additionalPaddingLeftForIcon — Defines the padding to be applied to the left of the icon in use from the app:icon attribute.
Read more >
remove back button in appbar flutter Code Example - Code Grepper
appBar : AppBar( title: Text('AppBar'), automaticallyImplyLeading: false, // remove back button in appbar. ) ... whatever by Eager Emu on Jan 30 2021...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found