1. 30 Nov, 2023 1 commit
    • Tirth's avatar
      Write Tests for API Examples of `cupertino_text_field.0`, `data_table.0`,... · c10787bc
      Tirth authored
      Write Tests for API Examples of `cupertino_text_field.0`, `data_table.0`, `icon_button.2` & `ink_well.0` (#139258)
      
      Write Tests for API Examples of `cupertino_text_field.0`, `data_table.0`, `icon_button.2` & `ink_well.0`
      
      Note: test for `cupertino_text_field.0` was already there but it was named `cupertino_text_field.0.dart`. I renamed it to `cupertino_text_field.0_test.dart`.
      
      Part of #130459
      c10787bc
  2. 28 Nov, 2023 1 commit
    • Tirth's avatar
      Write Tests for API Examples of `snack_bar.0`, `elevated_button.0`,... · a49ee534
      Tirth authored
      Write Tests for API Examples of `snack_bar.0`, `elevated_button.0`, `stepper.0`, `radio.0`, `filled_button.0`, `outlined_button.0` & `card.0` (#138987)
      
      Write Tests for API Examples of `snack_bar.0`, `elevated_button.0`, `stepper.0`, `radio.0`, `filled_button.0`, `outlined_button.0` & `card.0`
      
      Part of #130459
      a49ee534
  3. 27 Nov, 2023 1 commit
  4. 20 Nov, 2023 1 commit
  5. 17 Nov, 2023 1 commit
    • auto-submit[bot]'s avatar
      Reverts "Introduce `AnimationStyle`" (#138628) · 0135a331
      auto-submit[bot] authored
      Reverts flutter/flutter#137945
      Initiated by: HansMuller
      This change reverts the following previous change:
      Original Description:
      This PR introduces `AnimationStyle`, it is used to override default animation curves and durations in several widgets.
      
      fixes  [Add the ability to customize MaterialApp theme animation duration](https://github.com/flutter/flutter/issues/78372)
      fixes [Allow customization of showMenu transition animation curves and duration](https://github.com/flutter/flutter/issues/135638)
      
      Here is an example where popup menu curve and transition duration is overriden:
      
      ```dart
                popUpAnimationStyle: AnimationStyle(
                  curve: Easing.emphasizedAccelerate,
                  duration: Durations.medium4,
                ),
      ```
      
      Set `AnimationStyle.noAnimation` to disable animation.
      ```dart
          return MaterialApp(
            themeAnimationStyle: AnimationStyle.noAnimation,
      ```
      0135a331
  6. 16 Nov, 2023 1 commit
    • Taha Tesser's avatar
      Introduce `AnimationStyle` (#137945) · 19e284f8
      Taha Tesser authored
      This PR introduces `AnimationStyle`, it is used to override default animation curves and durations in several widgets.
      
      fixes  [Add the ability to customize MaterialApp theme animation duration](https://github.com/flutter/flutter/issues/78372)
      fixes [Allow customization of showMenu transition animation curves and duration](https://github.com/flutter/flutter/issues/135638)
      
      Here is an example where popup menu curve and transition duration is overriden:
      
      ```dart
                popUpAnimationStyle: AnimationStyle(
                  curve: Easing.emphasizedAccelerate,
                  duration: Durations.medium4,
                ),
      ```
      
      Set `AnimationStyle.noAnimation` to disable animation.
      ```dart
          return MaterialApp(
            themeAnimationStyle: AnimationStyle.noAnimation,
      ```
      19e284f8
  7. 07 Nov, 2023 1 commit
    • Qun Cheng's avatar
      Adaptive `Switch` (#130425) · ed70f4e2
      Qun Cheng authored
      Currently, `Switch.factory` delegates to `CupertinoSwitch` when platform
      is iOS or macOS. This PR is to:
      * have the factory configure the Material `Switch` for the expected look
      and feel.
      * introduce `Adaptation` class to customize themes for the adaptive
      components.
      ed70f4e2
  8. 01 Nov, 2023 1 commit
    • Qun Cheng's avatar
      Add `Card.filled` and `Card.outlined` factory methods (#136229) · 4a0f261b
      Qun Cheng authored
      Fixes #119401
      
      This PR is to:
      * add `Card.filled` and `Card.outlined` factory methods so that we can use tokens for these two types of cards to generate default theme instead of providing hard-corded values in example.
      * update card.2.dart example.
      * add test file for card.2.dart example.
      * fix some mismatch caused by editing the auto-generated defaults by hand in navigation_bar.dart and navigation_drawer.dart.
      4a0f261b
  9. 18 Oct, 2023 1 commit
  10. 28 Sep, 2023 1 commit
    • Renzo Olivares's avatar
      Implement SelectionArea single click/tap gestures (#132682) · 21ad7122
      Renzo Olivares authored
      This change collapses the selection at the clicked/tapped location on single click down for desktop platforms, and on single click/tap up for mobile platforms to match native.
      
      This is a change from how `SelectionArea` previously worked. Before this change a single click down would clear the selection. From observing a native browser it looks like when tapping on static text the selection is not cleared but collapsed. A user can still attain the selection from static text using the `window.getSelection` API.
      
      https://jsfiddle.net/juepasn3/11/ You can try this demo out here to observe this behavior yourself. When clicking on static text the selection will change.
      
      This change also allows `Paragraph.selections` to return selections that are collapsed. This for testing purposes to confirm where the selection has been collapsed.
      
      Partially fixes: #129583
      21ad7122
  11. 18 Sep, 2023 1 commit
  12. 11 Sep, 2023 1 commit
  13. 08 Sep, 2023 1 commit
  14. 01 Sep, 2023 1 commit
    • Andrea Cioni's avatar
      Add an example for `InputChip` generated by user input (#130645) · 400702d1
      Andrea Cioni authored
      New example for `InputChip` that demonstrate how to create/delete them based on user text inputs.
      
      The sample application shows a custom text area where user can enter text. After the user has typed and hits _Enter_ the text will be replaced with an `InputChip` that contains that text. Is it possible to continue typing and add more chips in this way. All of them will be placed in a scrollable horizontal row. Also is it possible to have suggestion displayed below the text input field in case the typed text match some of the available suggestions.
      
      Issue I'm trying to solve:
      
      - https://github.com/flutter/flutter/issues/128247
      
      **Code structure:**
      
      The example app is composed of 2 main components that find places inside `MainScreen`:
      
       - `ChipsInput`
       - `ListView`
      
      `ChipsInput` emulates a `TextField` where you can enter text. This text field accepts also a list of values of generic type T (`Topping` in my example), that gets rendered as `InputChip` inside the text field, before the text inserted by the user. This widgets is basically an `InputDecorator` widget that implements `TextInputClient` to get `TextEditingValue` events from the user keyboard. At the end of the input field there is another component, the `TextCursor`, that is displayed just when the user give the focus to the field and emulates the carrets that `TextField` has.
      
      There are also some available callbacks that the user can use to capture events in the `ChipsInput` field like: `onChanged`, `onChipTapped`, `onSubmitted` and `onTextChanged`. This last callback is used to build a list of suggestion that will be placed just below the `ChipsInput` field inside the `ListView`.
      400702d1
  15. 30 Aug, 2023 1 commit
  16. 29 Aug, 2023 2 commits
  17. 22 Aug, 2023 1 commit
    • 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
  18. 21 Aug, 2023 1 commit
  19. 15 Aug, 2023 1 commit
    • Ian Hickson's avatar
      PaginatedDataTable improvements (#131374) · ccdf8264
      Ian Hickson authored
      - slightly improved assert message when row cell counts don't match column count.
      - more breadcrumbs in API documentation. more documentation in general.
      - added more documentation for the direction of the "ascending" arrow.
      - two samples for PaginatedDataTable.
      - make PaginatedDataTable support hot reloading across changes to the number of columns.
      - introduce matrix3MoreOrLessEquals. An earlier version of this PR used it in tests, but eventually it was not needed. The function seems useful to keep though.
      ccdf8264
  20. 14 Aug, 2023 1 commit
  21. 10 Aug, 2023 1 commit
  22. 20 Jul, 2023 2 commits
  23. 17 Jul, 2023 1 commit
  24. 11 Jul, 2023 1 commit
  25. 07 Jun, 2023 1 commit
    • Greg Spencer's avatar
      Disable context menu (#128365) · 36f73cf6
      Greg Spencer authored
      ## Description
      
      Changes the context menu example for `MenuAnchor` so that it uses right-click, or (on macOS and iOS only) ctrl-left-click, for the context menu. Also disables the browser context menu on web platforms.
      
      ## Tests
       - Updated test to reflect new triggers.
      36f73cf6
  26. 06 Jun, 2023 1 commit
  27. 02 Jun, 2023 1 commit
    • Hans Muller's avatar
      Updated TabBar and ToggleButtons examples (#128088) · 4464d09d
      Hans Muller authored
      Updated the ToggleButtons example and test to M3.
      
      Updated the nested tabs test to avoid warnings like:
      ```
      Warning: A call to tap() with finder "exactly one widget with type "Tab" which is an ancestor of text "Explore": Tab(text: "Explore", icon: Icon)" derived an Offset (Offset(666.7, 92.0)) that would not hit test on the specified widget.
      ```
      4464d09d
  28. 01 Jun, 2023 4 commits
  29. 27 May, 2023 1 commit
  30. 25 May, 2023 1 commit
  31. 24 May, 2023 1 commit
  32. 22 May, 2023 1 commit
  33. 17 May, 2023 1 commit
  34. 05 May, 2023 2 commits