Skip to content

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Aug 23, 2023

fixes PopupMenuItem with a ListTile doesn't use the correct text style.

Description

This fixes an issue text style issue for PopupMenuItem with a ListTile (for an elaborate popup menu)

https://api.flutter.dev/flutter/material/PopupMenuItem-class.html

expand to view the code sample
import 'package:flutter/material.dart';

/// Flutter code sample for [PopupMenuButton].

// This is the type used by the popup menu below.
enum SampleItem { itemOne, itemTwo, itemThree }

void main() => runApp(const PopupMenuApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        useMaterial3: true,
        textTheme: const TextTheme(
          labelLarge: TextStyle(
            fontStyle: FontStyle.italic,
            fontWeight: FontWeight.bold,
          ),
        ),
      ),
      home: const PopupMenuExample(),
    );
  }
}

class PopupMenuExample extends StatefulWidget {
  const PopupMenuExample({super.key});

  @override
  State<PopupMenuExample> createState() => _PopupMenuExampleState();
}

class _PopupMenuExampleState extends State<PopupMenuExample> {
  SampleItem? selectedMenu;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SizedBox(
          width: 300,
          height: 130,
          child: Align(
            alignment: Alignment.topLeft,
            child: PopupMenuButton<SampleItem>(
              initialValue: selectedMenu,
              // Callback that sets the selected popup menu item.
              onSelected: (SampleItem item) {
                setState(() {
                  selectedMenu = item;
                });
              },
              itemBuilder: (BuildContext context) =>
                  <PopupMenuEntry<SampleItem>>[
                const PopupMenuItem<SampleItem>(
                  value: SampleItem.itemOne,
                  child: Text('PopupMenuItem'),
                ),
                const CheckedPopupMenuItem<SampleItem>(
                  checked: true,
                  value: SampleItem.itemTwo,
                  child: Text('CheckedPopupMenuItem'),
                ),
                const PopupMenuItem<SampleItem>(
                  value: SampleItem.itemOne,
                  child: ListTile(
                    leading: Icon(Icons.cloud),
                    title: Text('ListTile'),
                    contentPadding: EdgeInsets.zero,
                    trailing: Icon(Icons.arrow_right_rounded),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Before

Screenshot 2023-08-23 at 14 08 48

After

Screenshot 2023-08-23 at 14 08 32

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Aug 23, 2023
@TahaTesser TahaTesser requested a review from HansMuller August 25, 2023 10:24
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2023
@auto-submit auto-submit bot merged commit ea00521 into flutter:master Aug 25, 2023
@TahaTesser TahaTesser deleted the fix_popup_menu_item_list_tile_text branch August 25, 2023 14:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 25, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 25, 2023
flutter/flutter@deeb811...61d9f55

2023-08-25 43759233+kenzieschmoll@users.noreply.github.com Update flutter packages to pick up latest vm_service (flutter/flutter#133335)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 00f532dcaef4 to 33fca02451ef (1 revision) (flutter/flutter#133337)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from cb58abd77326 to 00f532dcaef4 (3 revisions) (flutter/flutter#133333)
2023-08-25 tessertaha@gmail.com Fix `PopupMenuItem` with a `ListTile` doesn't use the correct style. (flutter/flutter#133141)
2023-08-25 tessertaha@gmail.com Fix `Chip.shape`'s side is not used when provided in Material 3 (flutter/flutter#132941)
2023-08-25 72562119+tgucio@users.noreply.github.com Dispose overlay entries (flutter/flutter#132826)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 0f8962208a44 to cb58abd77326 (3 revisions) (flutter/flutter#133320)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 09e620d26834 to 0f8962208a44 (2 revisions) (flutter/flutter#133309)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9bcefc74b772 to 09e620d26834 (1 revision) (flutter/flutter#133307)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1382d6d79408 to 9bcefc74b772 (2 revisions) (flutter/flutter#133305)
2023-08-25 chingjun@google.com Allow passing verbose log from flutter daemon. (flutter/flutter#132828)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from b8ec4da8866c to 1382d6d79408 (1 revision) (flutter/flutter#133298)
2023-08-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 965501a25d92 to b8ec4da8866c (11 revisions) (flutter/flutter#133296)
2023-08-24 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.3 to 3.6.0 (flutter/flutter#133281)
2023-08-24 ian@hixie.ch Update the tool to know about all our new platforms (flutter/flutter#132423)
2023-08-24 ian@hixie.ch l10n-related documentation improvements (flutter/flutter#133114)
2023-08-24 73116038+whiskeyPeak@users.noreply.github.com Add hover duration for `Inkwell` widget (flutter/flutter#132176)
2023-08-24 yjbanov@google.com [web] benchmark the benchmark harness overhead (flutter/flutter#132999)
2023-08-24 polinach@google.com Users of ChangeNotifier should dispatch event of object creation in constructor. (flutter/flutter#133210)
2023-08-24 49699333+dependabot[bot]@users.noreply.github.com Bump activesupport from 6.1.7.3 to 6.1.7.6 in /dev/ci/mac (flutter/flutter#133225)
2023-08-24 31859944+LongCatIsLooong@users.noreply.github.com Remove `ImageProvider.load`, `DecoderCallback` and `PaintingBinding.instantiateImageCodec` (flutter/flutter#132679)
2023-08-24 engine-flutter-autoroll@skia.org Roll Flutter Engine from aa98a9d2e86f to 965501a25d92 (24 revisions) (flutter/flutter#133272)
2023-08-24 andrewrkolos@gmail.com handle exceptions raised while searching for configured android studio (flutter/flutter#133180)
2023-08-24 christopherfujino@gmail.com Fix mac tool_integration_tests with Xcode 15 (flutter/flutter#133217)
2023-08-24 engine-flutter-autoroll@skia.org Roll Packages from 3060b1a to 383bffa (3 revisions) (flutter/flutter#133256)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC rmistry@google.com,stuartmorgan@google.com,ychris@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PopupMenuItem with a ListTile doesn't use the correct text style.

2 participants