Skip to content

FAB jumps when scaffolds have different geometry #45

@MatrixDev

Description

@MatrixDev

I have two screens with each having a different ScaffoldPrelayoutGeometry. This causes FAB to jump sporadically when switching screens.

This is caused by the static/shared/global ExpandableFab.location, which stores scaffold geometry in its field:

@immutable
class ExpandableFab extends StatefulWidget {
  /// The location of the ExpandableFab on the screen.
  static final FloatingActionButtonLocation location = _ExpandableFabLocation();

  // ...
}

class _ExpandableFabLocation extends StandardFabLocation {
  final ValueNotifier<ScaffoldPrelayoutGeometry?> scaffoldGeometry =
      ValueNotifier(null);

  // ...
}

Because scaffoldGeometry is a field in a static instance and updated by different scaffolds, this causes multiple FABs fighting for last-one-wins scaffold geometry, which causes constant jumping during animation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions