1. 29 Aug, 2023 3 commits
  2. 28 Aug, 2023 13 commits
  3. 26 Aug, 2023 1 commit
  4. 25 Aug, 2023 6 commits
    • Chinmoy's avatar
      Adds callback onWillAcceptWithDetails in DragTarget. (#131545) · 347f7bac
      Chinmoy authored
      This PR adds onWillAcceptWithDetails callback to DragTarget to get information about offset.
      
      Fixes: #131378 
      
      This PR is subject to changes based on #131542
      347f7bac
    • Kate Lovett's avatar
    • gmilou's avatar
    • Taha Tesser's avatar
      Fix `PopupMenuItem` with a `ListTile` doesn't use the correct style. (#133141) · ea005219
      Taha Tesser authored
      fixes [`PopupMenuItem` with a `ListTile`  doesn't use the correct text style.](https://github.com/flutter/flutter/issues/133138)
      
      ### 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
      
      <details> 
      <summary>expand to view the code sample</summary> 
      
      ```dart
      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),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
          );
        }
      }
      ``` 
      
      </details>
      
      ### Before
      
      ![Screenshot 2023-08-23 at 14 08 48](https://github.com/flutter/flutter/assets/48603081/434ac95e-2981-4ab5-9843-939b39d771a2)
      
      ### After
      
      ![Screenshot 2023-08-23 at 14 08 32](https://github.com/flutter/flutter/assets/48603081/f6aba7e0-3d03-454f-8e0b-c031492f3f2d)
      ea005219
    • Taha Tesser's avatar
      Fix `Chip.shape`'s side is not used when provided in Material 3 (#132941) · 612117a6
      Taha Tesser authored
      fixes [Chip border side color not working in Material3](https://github.com/flutter/flutter/issues/132922)
      
      ### 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(
            theme: ThemeData(
              useMaterial3: true,
              chipTheme: const ChipThemeData(
                  // shape: RoundedRectangleBorder(
                  //   side: BorderSide(color: Colors.amber),
                  //   borderRadius: BorderRadius.all(Radius.circular(12)),
                  // ),
                  // side: BorderSide(color: Colors.red),
                  ),
            ),
            home: const Example(),
          );
        }
      }
      
      class Example extends StatelessWidget {
        const Example({super.key});
      
        @override
        Widget build(BuildContext context) {
          return const Scaffold(
            body: Center(
              child: RawChip(
                shape: RoundedRectangleBorder(
                  side: BorderSide(color: Colors.amber),
                  borderRadius: BorderRadius.all(Radius.circular(12)),
                ),
                // side: BorderSide(color: Colors.red),
                label: Text('Chip'),
              ),
            ),
          );
        }
      }
      
      ``` 
      
      </details>
      
      ---
      
      ### Before
      
      When `RawChip.shape` is provided with a `BorderSide`.
      
      ```dart
            body: Center(
              child: RawChip(
                shape: RoundedRectangleBorder(
                  side: BorderSide(color: Colors.amber),
                  borderRadius: BorderRadius.all(Radius.circular(12)),
                ),
                label: Text('Chip'),
              ),
            ),
      ```
      
      ![Screenshot 2023-08-24 at 17 54 54](https://github.com/flutter/flutter/assets/48603081/89e2c9b5-44c2-432e-97ff-8bb95b0d0fb1)
      
      When `RawChip.shape` is provided with a `BorderSide` and also `RawChip.side` is provided. The  `RawChip.side` overrides the shape's side.
      
      ```dart
            body: Center(
              child: RawChip(
                shape: RoundedRectangleBorder(
                  side: BorderSide(color: Colors.amber),
                  borderRadius: BorderRadius.all(Radius.circular(12)),
                ),
                side: BorderSide(color: Colors.red),
                label: Text('Chip'),
              ),
            ),
      ```
      
      ![Screenshot 2023-08-24 at 17 55 37](https://github.com/flutter/flutter/assets/48603081/938803cc-d514-464b-b06b-e4841b9ad040)
      
      ---
      
      ### After
      
      When `RawChip.shape` is provided with a `BorderSide`.
      
      ```dart
            body: Center(
              child: RawChip(
                shape: RoundedRectangleBorder(
                  side: BorderSide(color: Colors.amber),
                  borderRadius: BorderRadius.all(Radius.circular(12)),
                ),
                label: Text('Chip'),
              ),
            ),
      ```
      
      ![Screenshot 2023-08-24 at 17 51 29](https://github.com/flutter/flutter/assets/48603081/d6fcaaa9-8f5d-4180-ad14-062dd459ec45)
      
      When `RawChip.shape` is provided with a `BorderSide` and also `RawChip.side` is provided. The  `RawChip.side` overrides the shape's side.
      
      ```dart
            body: Center(
              child: RawChip(
                shape: RoundedRectangleBorder(
                  side: BorderSide(color: Colors.amber),
                  borderRadius: BorderRadius.all(Radius.circular(12)),
                ),
                side: BorderSide(color: Colors.red),
                label: Text('Chip'),
              ),
            ),
      ```
      
      ![Screenshot 2023-08-24 at 17 52 31](https://github.com/flutter/flutter/assets/48603081/3fa46341-43f0-4fe7-a922-f1d8ba34028c)
      
      ---
      612117a6
    • Tomasz Gucio's avatar
      Dispose overlay entries (#132826) · 5c17a37b
      Tomasz Gucio authored
      5c17a37b
  5. 24 Aug, 2023 5 commits
  6. 23 Aug, 2023 5 commits
  7. 22 Aug, 2023 4 commits
    • Taha Tesser's avatar
      Update default menu text styles for Material 3 (#131930) · 1bc79169
      Taha Tesser authored
      Related https://github.com/flutter/flutter/issues/131676
      
      ## Description
      
      #### Fix default input text style for `DropdownMenu`
      
      ![dropdown_input](https://github.com/flutter/flutter/assets/48603081/301f8243-155a-4b8f-84a8-5e6b7bebb3bc)
      
      ### Fix default text style for  `MenuAnchor`'s menu items (which `DropdownMenu` uses for menu items)
      
      ![dropdown_item](https://github.com/flutter/flutter/assets/48603081/6b5be81a-72fc-4705-a577-074c7a4cad8f)
      
      ###  Default  `DropdownMenu` Input text style 
      
      ![Screenshot 2023-08-04 at 16 48 28](https://github.com/flutter/flutter/assets/48603081/bcd9da98-e74d-491e-ae64-6268ae0b3893)
      
      ### Default `DropdownMenu` menu item text style
      
      ![Screenshot 2023-08-04 at 16 50 19](https://github.com/flutter/flutter/assets/48603081/9592ca43-2854-45b5-8648-203ab65d9745)
      
      ### Default `MenuAnchor` menu item text style
      
      ![Screenshot 2023-08-04 at 14 34 28](https://github.com/flutter/flutter/assets/48603081/e87e1073-05f8-4dc7-a435-d864e9cce6ab)
      
      ### Code sample
      
      <details> 
      <summary>expand to view the code sample</summary> 
      
      ```dart
      import 'package:flutter/material.dart';
      
      /// Flutter code sample for [DropdownMenu]s. The first dropdown menu has an outlined border.
      
      void main() => runApp(const DropdownMenuExample());
      
      class DropdownMenuExample extends StatefulWidget {
        const DropdownMenuExample({super.key});
      
        @override
        State<DropdownMenuExample> createState() => _DropdownMenuExampleState();
      }
      
      class _DropdownMenuExampleState extends State<DropdownMenuExample> {
        final TextEditingController colorController = TextEditingController();
        final TextEditingController iconController = TextEditingController();
        ColorLabel? selectedColor;
        IconLabel? selectedIcon;
      
        @override
        Widget build(BuildContext context) {
          final List<DropdownMenuEntry<ColorLabel>> colorEntries =
              <DropdownMenuEntry<ColorLabel>>[];
          for (final ColorLabel color in ColorLabel.values) {
            colorEntries.add(
              DropdownMenuEntry<ColorLabel>(
                  value: color, label: color.label, enabled: color.label != 'Grey'),
            );
          }
      
          final List<DropdownMenuEntry<IconLabel>> iconEntries =
              <DropdownMenuEntry<IconLabel>>[];
          for (final IconLabel icon in IconLabel.values) {
            iconEntries
                .add(DropdownMenuEntry<IconLabel>(value: icon, label: icon.label));
          }
      
          return MaterialApp(
            theme: ThemeData(
              useMaterial3: true,
              colorSchemeSeed: Colors.green,
              // textTheme: const TextTheme(
              //   bodyLarge: TextStyle(
              //     fontWeight: FontWeight.bold,
              //     fontStyle: FontStyle.italic,
              //     decoration: TextDecoration.underline,
              //   ),
              // ),
            ),
            home: Scaffold(
              body: SafeArea(
                child: Column(
                  children: <Widget>[
                    const Text('DropdownMenus'),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 20),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          DropdownMenu<ColorLabel>(
                            controller: colorController,
                            label: const Text('Color'),
                            dropdownMenuEntries: colorEntries,
                            onSelected: (ColorLabel? color) {
                              setState(() {
                                selectedColor = color;
                              });
                            },
                          ),
                          const SizedBox(width: 20),
                          DropdownMenu<IconLabel>(
                            controller: iconController,
                            enableFilter: true,
                            leadingIcon: const Icon(Icons.search),
                            label: const Text('Icon'),
                            dropdownMenuEntries: iconEntries,
                            inputDecorationTheme: const InputDecorationTheme(
                              filled: true,
                              contentPadding: EdgeInsets.symmetric(vertical: 5.0),
                            ),
                            onSelected: (IconLabel? icon) {
                              setState(() {
                                selectedIcon = icon;
                              });
                            },
                          ),
                        ],
                      ),
                    ),
                    const Text('Plain TextFields'),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 20),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          SizedBox(
                            width: 150,
                            child: TextField(
                                controller: TextEditingController(text: 'Blue'),
                                decoration: const InputDecoration(
                                  suffixIcon: Icon(Icons.arrow_drop_down),
                                  labelText: 'Color',
                                  border: OutlineInputBorder(),
                                )),
                          ),
                          const SizedBox(width: 20),
                          SizedBox(
                            width: 150,
                            child: TextField(
                                controller: TextEditingController(text: 'Smile'),
                                decoration: const InputDecoration(
                                  prefixIcon: Icon(Icons.search),
                                  suffixIcon: Icon(Icons.arrow_drop_down),
                                  filled: true,
                                  labelText: 'Icon',
                                )),
                          ),
                        ],
                      ),
                    ),
                    if (selectedColor != null && selectedIcon != null)
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          Text(
                              'You selected a ${selectedColor?.label} ${selectedIcon?.label}'),
                          Padding(
                            padding: const EdgeInsets.symmetric(horizontal: 5),
                            child: Icon(
                              selectedIcon?.icon,
                              color: selectedColor?.color,
                            ),
                          )
                        ],
                      )
                    else
                      const Text('Please select a color and an icon.')
                  ],
                ),
              ),
            ),
          );
        }
      }
      
      enum ColorLabel {
        blue('Blue', Colors.blue),
        pink('Pink', Colors.pink),
        green('Green', Colors.green),
        yellow('Yellow', Colors.yellow),
        grey('Grey', Colors.grey);
      
        const ColorLabel(this.label, this.color);
        final String label;
        final Color color;
      }
      
      enum IconLabel {
        smile('Smile', Icons.sentiment_satisfied_outlined),
        cloud(
          'Cloud',
          Icons.cloud_outlined,
        ),
        brush('Brush', Icons.brush_outlined),
        heart('Heart', Icons.favorite);
      
        const IconLabel(this.label, this.icon);
        final String label;
        final IconData icon;
      }
      
      ``` 
      	
      </details>
      1bc79169
    • Taha Tesser's avatar
      Fix `FlexibleSpaceBar.title` doesn't respect the leading widget (#132573) · db89df51
      Taha Tesser authored
      fixes [Long `FlexibleSpaceBar.title` doesn't respect the leading widget 
      ](https://github.com/flutter/flutter/issues/132030)
      
      ### Description
      
      - This adds `FlexibleSpaceBarSettings.hasLeading` for the `FlexibleSpaceBar`'s title to respect the leading widget.
      - Use the new `FlexibleSpaceBarSettings.hasLeading` property in the  `SliverAppBar` for its `FlexibleSpaceBar`.
      
      ### 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(
              useMaterial3: true,
              brightness: Brightness.dark,
            ),
            home: const Example(),
          );
        }
      }
      
      class Example extends StatelessWidget {
        const Example({super.key});
      
        @override
        Widget build(BuildContext context) {
          return Scaffold(
            body: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                const Text('TargetPlatform.Android'),
                Theme(
                  data: Theme.of(context).copyWith(
                    platform: TargetPlatform.android,
                  ),
                  child: Container(
                    height: 250,
                    padding: const EdgeInsets.all(8),
                    decoration: BoxDecoration(
                      border: Border.all(
                        color: Colors.amber,
                        width: 4,
                      ),
                    ),
                    child: const AppBarLeading(
                      showLeading: true,
                      showTitle: false,
                    ),
                  ),
                ),
                const Text('TargetPlatform.iOS'),
                Theme(
                  data: Theme.of(context).copyWith(
                    platform: TargetPlatform.iOS,
                  ),
                  child: Container(
                    height: 250,
                    padding: const EdgeInsets.all(8),
                    decoration: BoxDecoration(
                      border: Border.all(
                        color: Colors.amber,
                        width: 2,
                      ),
                    ),
                    child: const AppBarLeading(
                      showLeading: true,
                      showTitle: false,
                    ),
                  ),
                ),
              ],
            ),
          );
        }
      }
      
      class AppBarLeading extends StatelessWidget {
        const AppBarLeading({
          super.key,
          required this.showLeading,
          required this.showTitle,
        });
      
        final bool showLeading;
        final bool showTitle;
      
        @override
        Widget build(BuildContext context) {
          return Scaffold(
            drawer: const Drawer(),
            body: CustomScrollView(
              slivers: [
                SliverAppBar(
                  automaticallyImplyLeading: showLeading,
                  iconTheme: const IconThemeData(
                    color: Colors.amber,
                  ),
                  title: showTitle ? const Text('AppBar') : null,
                  flexibleSpace: FlexibleSpaceBar(
                    title: Text('Title ' * 15),
                    // centerTitle: true,
                  ),
                  toolbarHeight: showTitle ? 170 : 100,
                ),
              ],
            ),
          );
        }
      }
      ``` 
      	
      </details>
      
      ### Before 
      
      ![Screenshot 2023-08-15 at 18 11 34](https://github.com/flutter/flutter/assets/48603081/4b798998-8549-43aa-b564-933ea14f494c)
      
      ### After
      
      ![Screenshot 2023-08-15 at 18 11 45](https://github.com/flutter/flutter/assets/48603081/b085a33a-db7d-40d4-8a12-ee37197b5bd4)
      db89df51
    • Justin McCandless's avatar
      Fix memory leak in Form (#132987) · 0278671b
      Justin McCandless authored
      Diposes some restorable variables that weren't disposed before.
      0278671b
    • Kate Lovett's avatar
      Fix visual overflow for SliverMainAxisGroup (#132989) · a5b06f15
      Kate Lovett authored
      Fixes https://github.com/flutter/flutter/issues/132788
      
      The SliverGeometry was not set properly for SliverMainAxisGroup. Omitting hasVisualOverflow affected the Viewport's choice to apply a clip, leading to the sliver being rendered outside of the bounds of the viewport.
      a5b06f15
  8. 21 Aug, 2023 2 commits
  9. 18 Aug, 2023 1 commit