Skip to content

Remove unnecessary helper method that returns a widget #99712

@albertodev01

Description

@albertodev01

The Scaffold implementation uses a function to return a Widget here which is both:

  • Not needed, because the function is used only once (in the build method) and nowhere else
  • Using functions to return widgets is a bad practice as stated by the official docs here, here and here.

This

child: _wrapBottomSheet(
  BottomSheet(
    ...
  ),
),

should become

child: Semantics(
  container: true,
  onDismiss: close,
  child:  NotificationListener<DraggableScrollableNotification>(
    onNotification: extentChanged,
    child: BottomSheet(
      ...
    ),
  ),
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions