flutter/dev
Taha Tesser 7abb083ae2
Add ability to override NavigationDestination.label padding for NavigationBar (#158260)
Fixes [Long NavigationBar tab titles can't be padded from the sides of the screen](https://github.com/flutter/flutter/issues/158130)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
          navigationBarTheme: const NavigationBarThemeData(
        labelTextStyle:
            WidgetStatePropertyAll(TextStyle(overflow: TextOverflow.ellipsis)),
        labelPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
      )),
      home: Scaffold(
        body: Center(
          child: Text(
            'Custom NavigationBar label padding',
            style: Theme.of(context).textTheme.titleMedium,
          ),
        ),
        bottomNavigationBar: NavigationBar(
          destinations: const [
            NavigationDestination(
              icon: Icon(Icons.favorite_rounded),
              label: 'Long Label Text',
            ),
            NavigationDestination(
              // icon: SizedBox.shrink(),
              icon: Icon(Icons.favorite_rounded),
              label: 'Long Label Text',
            ),
            NavigationDestination(
              icon: Icon(Icons.favorite_rounded),
              label: 'Long Label Text',
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>

### Default `NavigationDestination.label` padding  with long label

<img width="458" alt="Screenshot 2024-11-06 at 14 30 52" src="https://github.com/user-attachments/assets/637e5e66-e05f-49fa-a4ae-72083b6ff884">

### Custom `NavigationDestination.label` padding with long label

<img width="458" alt="Screenshot 2024-11-06 at 14 32 02" src="https://github.com/user-attachments/assets/23ebf715-30d3-433c-92cd-c8f0fdb1571b">
2024-11-08 14:19:18 +00:00
..
a11y_assessments Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
automated_tests Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
benchmarks Fix use of deprecated buildDir in Android templates/tests/examples (#157560) 2024-11-06 21:34:23 +00:00
bots Roll pub packages (#158337) 2024-11-07 20:15:01 +00:00
conductor Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
customer_testing Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
devicelab Roll pub packages (#158337) 2024-11-07 20:15:01 +00:00
docs Update API docs footer (#150347) 2024-06-17 19:39:12 +02:00
forbidden_from_release_tests Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
integration_tests Fix use of deprecated buildDir in Android templates/tests/examples (#157560) 2024-11-06 21:34:23 +00:00
manual_tests Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
missing_dependency_tests Enable private field promotion for dev (#134480) 2023-09-12 18:29:00 +00:00
snippets Roll pub packages (#158281) 2024-11-06 19:37:09 +00:00
tools Add ability to override NavigationDestination.label padding for NavigationBar (#158260) 2024-11-08 14:19:18 +00:00
tracing_tests Fix use of deprecated buildDir in Android templates/tests/examples (#157560) 2024-11-06 21:34:23 +00:00
analysis_options.yaml Enable more lints (#91642) 2021-10-14 22:03:03 -07:00
README.md Migrate to .ci.yaml (#82960) 2021-05-19 20:09:46 -07:00

This directory contains tools and resources that the Flutter team uses during the development of the framework. The tools in this directory should not be necessary for developing Flutter applications, though of course, they may be interesting if you are curious.

The tests in this directory are run in the framework_tests_misc-* shards.