Skip to content

[FEATURE] Add drawer attribute to AdaptiveScaffold #36

@ahmedghaly15

Description

@ahmedghaly15

Feature Description

Add a drawer attribute to the AdaptiveScaffold widget, allowing developers to easily attach a navigation drawer (e.g., Drawer or NavigationDrawer) that adapts to different platforms and layouts.

Problem Statement

Currently, the AdaptiveScaffold widget does not provide a built-in way to include a drawer for navigation. Developers who want to use a drawer must manually handle it using conditional logic or platform checks, which defeats the purpose of having an adaptive layout system.
This limitation makes it difficult to maintain consistent navigation behavior across mobile, tablet, and desktop devices.

Proposed Solution

Introduce a drawer property to AdaptiveScaffold, similar to the one available in Flutter’s native Scaffold.
This property can accept a widget (e.g., Drawer or NavigationDrawer) and automatically display it when appropriate for the platform or screen size.
For example:

  • On mobile, the drawer would slide in from the side (standard Material drawer behavior).
  • On tablet or desktop, the drawer could optionally stay pinned or behave like a sidebar.

Platform Considerations

  • iOS 26+: Drawer behaves similarly to CupertinoScaffold patterns — could slide in with Cupertino-style animation if needed.
  • iOS <26: Default to Material drawer behavior for consistency.
  • Android: Use Material Drawer with adaptive layout support.

Code Example

// Example usage
AdaptiveScaffold(
  appBar: AdaptiveAppBar(title: Text('Home')),
  body: Center(child: Text('Hello Adaptive World')),
  drawer: AdaptiveDrawer(
    child: ListView(
      children: [
        DrawerHeader(child: Text('Menu')),
        ListTile(title: Text('Home')),
        ListTile(title: Text('Settings')),
      ],
    ),
  ),
);

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions