Skip to content

[adaptive_scaffold] asserts that navigation rail items cannot be less than two items #110902

@a-wallen

Description

@a-wallen

The layout procedure responsible for the left navigation bar should resemble the Drawer APIs. If we set the number of NavigationDestinations on AdaptiveScaffold to some arbitrary number, we must have some comprehensive reason for why we do not allow an empty sidebar or one element in the sidebar.

Give a better error message whenever the rules of the NavigationDestination items are less than the number required.

Steps to Reproduce

Code sample
  1. Clone flutter/packages into the folder of your choice (at the time of writing, AdaptiveScaffold has not been released.
  2. Add adaptive_scaffold to the flutter project:
dependencies
    adaptive_scaffold:
        path: <path_to_the_packages_repo>/packages/adaptive_scaffold/
  1. Add the following tomain.dart
import 'package:flutter/material.dart';
import 'package:adaptive_scaffold/adaptive_scaffold.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: AdaptiveScaffold(
        destinations: [
          NavigationDestination(icon: Icon(Icons.home), label: "ABCDEFGHIJKLMNOP")
        ],
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectp: flutter_adaptive_scaffoldThe flutter_adaptive_scaffold packagepackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions