flutter/dev
Taha Tesser e1cd7b11f6
Introduce Switch.padding (#149884)
fixes [Switch has some padding that leads to uncentered UI](https://github.com/flutter/flutter/issues/148498)

### 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,
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              ColoredBox(
                color: Colors.amber,
                child: Switch(
                  padding: EdgeInsets.zero,
                  value: true,
                  materialTapTargetSize: MaterialTapTargetSize.padded,
                  onChanged: (bool value) {},
                ),
              ),
              const SizedBox(height: 16),
              ColoredBox(
                color: Colors.amber,
                child: Switch(
                  value: true,
                  materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                  onChanged: (bool value) {},
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>

### Default Switch size

<img width="476" alt="Screenshot 2024-07-11 at 13 25 05" src="https://github.com/flutter/flutter/assets/48603081/f9f3f6c6-443d-4bd5-81d4-5e314554b032">

### Update Switch size using the new `Switch.padding` to address  [Switch has some padding that leads to uncentered UI](https://github.com/flutter/flutter/issues/148498)

<img width="476" alt="Screenshot 2024-07-11 at 13 24 40" src="https://github.com/flutter/flutter/assets/48603081/aea0717b-e852-4b8d-b703-c8c4999d4863">
2024-07-16 20:25:09 +00:00
..
a11y_assessments Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
automated_tests Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
benchmarks Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
bots Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
conductor Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
customer_testing Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
devicelab Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
docs Update API docs footer (#150347) 2024-06-17 19:39:12 +02:00
forbidden_from_release_tests Roll pub packages (#150070) 2024-06-12 05:40:31 +00:00
integration_tests Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
manual_tests Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
missing_dependency_tests Enable private field promotion for dev (#134480) 2023-09-12 18:29:00 +00:00
snippets Roll pub packages (#151816) 2024-07-16 12:34:24 +00:00
tools Introduce Switch.padding (#149884) 2024-07-16 20:25:09 +00:00
tracing_tests Roll pub packages (#151816) 2024-07-16 12:34:24 +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.