1. 06 Oct, 2023 1 commit
  2. 20 Sep, 2023 1 commit
    • Greg Spencer's avatar
      Remove 'must be non-null' and 'must not be null' comments from material. (#134991) · a1e49be2
      Greg Spencer authored
      ## Description
      
      This removes all of the comments that are of the form "so-and-so (must not be null|can ?not be null|must be non-null)" from the cases where those values are defines as non-nullable values.
      
      This PR removes them from the material library.
      
      This was done by hand, since it really didn't lend itself to scripting, so it needs to be more than just spot-checked, I think. I was careful to leave any comment that referred to parameters that were nullable, but I may have missed some.
      
      In addition to being no longer relevant after null safety has been made the default, these comments were largely fragile, in that it was easy for them to get out of date, and not be accurate anymore anyhow.
      
      This did create a number of constructor comments which basically say "Creates a [Foo].", but I don't really know how to avoid that in a large scale change, since there's not much you can really say in a lot of cases.  I think we might consider some leniency for constructors to the "Comment must be meaningful" style guidance (which we de facto have already, since there are a bunch of these).
      
      ## Related PRs
      - https://github.com/flutter/flutter/pull/134984
      - https://github.com/flutter/flutter/pull/134992
      - https://github.com/flutter/flutter/pull/134993
      - https://github.com/flutter/flutter/pull/134994
      
      ## Tests
       - Documentation only change.
      a1e49be2
  3. 15 Sep, 2023 1 commit
  4. 30 Aug, 2023 1 commit
    • Taha Tesser's avatar
      Add `cancelButtonStyle` & `confirmButtonStyle` to the `DatePickerThemeData` (#132847) · 1e770c38
      Taha Tesser authored
      fixes [Unable to adjust the color for "Cancel" and "Ok" button in datePicker dialog](https://github.com/flutter/flutter/issues/127739)
      
      ### 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,
              datePickerTheme: DatePickerThemeData(
                cancelButtonStyle: TextButton.styleFrom(
                  shape: const RoundedRectangleBorder(
                    borderRadius: BorderRadius.all(Radius.circular(16)),
                    side: BorderSide(color: Colors.red),
                  ),
                  backgroundColor: Colors.white,
                  foregroundColor: Colors.red,
                  elevation: 3,
                  shadowColor: Colors.red,
                ),
                confirmButtonStyle: TextButton.styleFrom(
                  shape: const RoundedRectangleBorder(
                    borderRadius: BorderRadius.all(Radius.circular(16)),
                  ),
                  backgroundColor: Colors.green[700],
                  foregroundColor: Colors.white,
                  elevation: 3,
                  shadowColor: Colors.green[700],
                ),
              ),
            ),
            home: const Example(),
          );
        }
      }
      
      class Example extends StatelessWidget {
        const Example({super.key});
      
        @override
        Widget build(BuildContext context) {
          return Scaffold(
            body: Center(
              child: DatePickerDialog(
                initialDate: DateTime.now(),
                firstDate: DateTime(2020),
                lastDate: DateTime(2030),
              ),
            ),
          );
        }
      }
      ``` 
      
      </details>
      
      ### Before 
      
      Not possible to customize action buttons from the `DatePickerThemeData`.
      
      ### After 
      
      ![Screenshot 2023-08-18 at 16 42 00](https://github.com/flutter/flutter/assets/48603081/4ec01e93-c661-491d-9253-d687da8b76f3)
      1e770c38
  5. 28 Aug, 2023 1 commit
    • Taha Tesser's avatar
      Fix `DatePickerDialog` & `DateRangePickerDialog` overflow when resized from... · a0943e65
      Taha Tesser authored
      Fix  `DatePickerDialog` & `DateRangePickerDialog` overflow when resized from landscape to portrait (#133327)
      
      fixes [resize window with a `showDateRangePicker` will make RenderFlex overflowed error](https://github.com/flutter/flutter/issues/131989)
      
      ### Description
      - This fixes  `DatePickerDialog` & `DateRangePickerDialog` overflow error when resized from landscape to portrait.
      - Added tests that check these two widgets from landscape to portrait for no overflow errors.
      
      <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 const MaterialApp(
            debugShowCheckedModeBanner: false,
            home: Example(),
          );
        }
      }
      
      class Example extends StatefulWidget {
        const Example({super.key});
      
        @override
        State<Example> createState() => _ExampleState();
      }
      
      class _ExampleState extends State<Example> {
        bool _portait = false;
      
        @override
        Widget build(BuildContext context) {
          return Scaffold(
            appBar: AppBar(
              title: const Text('DatePicker & DateRangePicker'),
            ),
            body: MediaQuery(
              data: MediaQuery.of(context).copyWith(
                size: _portait ? const Size(400, 800) : const Size(800, 400),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  DatePickerDialog(
                    initialDate: DateTime.now(),
                    firstDate: DateTime(2020),
                    lastDate: DateTime(2030),
                    initialEntryMode: DatePickerEntryMode.inputOnly,
                  ),
                  DateRangePickerDialog(
                    currentDate: DateTime.now(),
                    firstDate: DateTime(2020),
                    lastDate: DateTime(2030),
                    initialEntryMode: DatePickerEntryMode.inputOnly,
                  ),
                ],
              ),
            ),
            floatingActionButton: FloatingActionButton(
              onPressed: () {
                setState(() {
                  _portait = !_portait;
                });
              },
              child: const Icon(Icons.refresh),
            ),
          );
        }
      }
      
      ```
      
      </details>
      
      ### Before
      
      https://github.com/flutter/flutter/assets/48603081/81387cbb-cdcf-42bd-b4f8-b7a08317c955
      
      ### After
      
      https://github.com/flutter/flutter/assets/48603081/36d28ea9-cfed-48ad-90f5-0459755e08c0
      a0943e65
  6. 23 Aug, 2023 1 commit
  7. 17 Aug, 2023 1 commit
    • Ian Hickson's avatar
      Allow date pickers to not have selected date (#132343) · d19fb632
      Ian Hickson authored
      This enables our various date picker classes to have a null `initialDate`.
      
      It also fixes the logic of some of the widgets which used to do something when you _changed_ the `initial*` parameters, which is wrong for `initial*` properties (they by definition should only impact the initial state) and wrong for properties in general (behaviour should not change based on whether the widget was built with a new value or not, that violates the reactive design principles).
      
      Fixes https://github.com/flutter/flutter/issues/638.
      d19fb632
  8. 27 Jul, 2023 1 commit
  9. 25 Jul, 2023 2 commits
    • Loïc Sharma's avatar
      Revert "Proposal to add barrier configs for showDatePicker, showTimePicker and... · 300c5d82
      Loïc Sharma authored
      Revert "Proposal to add barrier configs for showDatePicker, showTimePicker and showAboutDialog." (#131278)
      
      Reverts flutter/flutter#130484. /cc @ronnnnn
      
      Example failure: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20framework_tests_libraries/12185/overview
      
      <details>
      <summary>Failure logs...</summary>
      
      ```
      04:51 +5379 ~18: /Volumes/Work/s/w/ir/x/w/flutter/packages/flutter/test/material/about_test.dart: Barrier dismissible Barrier is dismissible with default parameter                                    
      ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
      The following TestFailure was thrown running a test:
      Expected: <1>
        Actual: <2>
      
      When the exception was thrown, this was the stack:
      #4      main.<anonymous closure>.<anonymous closure> (file:///Volumes/Work/s/w/ir/x/w/flutter/packages/flutter/test/material/about_test.dart:776:7)
      <asynchronous suspension>
      #5      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:165:15)
      <asynchronous suspension>
      #6      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1008:5)
      <asynchronous suspension>
      <asynchronous suspension>
      (elided one frame from package:stack_trace)
      
      This was caught by the test expectation on the following line:
        file:///Volumes/Work/s/w/ir/x/w/flutter/packages/flutter/test/material/about_test.dart line 776
      The test description was:
        Barrier is dismissible with default parameter
      ════════════════════════════════════════════════════════════════════════════════════════════════════
      
      04:51 +5379 ~18 -1: /Volumes/Work/s/w/ir/x/w/flutter/packages/flutter/test/material/about_test.dart: Barrier dismissible Barrier is dismissible with default parameter [E]                             
        Test failed. See exception logs above.
        The test description was: Barrier is dismissible with default parameter
        
      To run this test again: /Volumes/Work/s/w/ir/x/w/flutter/bin/cache/dart-sdk/bin/dart test /Volumes/Work/s/w/ir/x/w/flutter/packages/flutter/test/material/about_test.dart -p vm --plain-name 'Barrier dismissible Barrier is dismissible with default parameter'
      ```
      
      </details>
      300c5d82
    • Seiya Kokushi's avatar
      Proposal to add barrier configs for showDatePicker, showTimePicker and showAboutDialog. (#130484) · 9def8f6b
      Seiya Kokushi authored
      ### Overview
      
      Add `barrierDismissible`, `barrierColor` and `barrierLabel` parameters to  `showDatePicker`, `showTimePicker` and `showAboutDialog` which calls `showDialog` internally.
      We can change these parameters with `showDialog` and Dialog widgets (like `DatePickerDialog`, `TimePickerDialog` or `AboutDialog`) directly. But, I think it is prefer to provide interfaces same as `showDialog` to keep application wide unified looks if it is used internally.
      
      Fixes #130971
      9def8f6b
  10. 17 Jul, 2023 1 commit
    • LongCatIsLooong's avatar
      Replaces `textScaleFactor` with `TextScaler` (#128522) · b2e22d35
      LongCatIsLooong authored
      Deprecate `textScaleFactor` in favor of `textScaler`, in preparation for Android 14 [Non-linear font scaling to 200%](https://developer.android.com/about/versions/14/features#non-linear-font-scaling). The `TextScaler` class can be moved to `dart:ui` in the future, if we decide to use the Android platform API or AndroidX to get the scaling curve instead of hard coding the curve in the framework.
      
      I haven't put the Flutter version in the deprecation message so the analyzer checks are failing. Will do so after I finish the migration guide.
      
      **Why `TextScaler.textScaleFactor`**
      The author of a `TextScaler` subclass should provide a fallback `textScaleFactor`. By making `TextScaler` also contain the `textScaleFactor` information it also makes it easier to migrate: if a widget overrides `MediaQueryData.textScaler` in the tree, for unmigrated widgets in the subtree it would also have to override `MediaQueryData.textScaleFactor`, and that makes it difficult to remove `MediaQueryData.textScaleFactor` in the future.
      
      ## A full list of affected APIs in this PR
      
      Deprecated: The method/getter/setter/argument is annotated with a `@Deprecated()` annotation in this PR, and the caller should replace it with `textScaler` instead. Unless otherwise specified there will be a Flutter fix available to help with migration but it's still recommended to migrate case-by-case.
      **Replaced**:  The method this `textScaleFactor` argument belongs to is rarely called directly by user code and is not overridden by any of the registered custom tests, so the argument is directly replaced by `TextScaler`.
      **To Be Deprecated**:  The method/getter/setter/argument can't be deprecated in this PR because a registered customer test depends on it and a Flutter fix isn't available (or the test was run without applying flutter fixes first). This method/getter/setter/argument will be deprecated in a followup PR once the registered test is migrated.
      
      ### `Painting` Library
      
      | Affected API | State of `textScaleFactor` | Comment | 
      | --- | --- | --- |
      | `InlineSpan.build({ double textScaleFactor = 1.0 })` argument | **Replaced** | | 
      | `TextStyle.getParagraphStyle({ double TextScaleFactor = 1.0 })` argument | **Replaced** | |
      | `TextStyle.getTextStyle({ double TextScaleFactor = 1.0 })`  argument| Deprecated | Can't replace: https://github.com/superlistapp/super_editor/blob/c47fd38dca4b7f43611690913b551a1773c563d7/super_editor/lib/src/infrastructure/super_textfield/desktop/desktop_textfield.dart#L1903-L1905|
      | `TextPainter({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | |
      | `TextPainter.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet |
      | `TextPainter.computeWidth({ double TextScaleFactor = 1.0 })` argument | Deprecated | |
      | `TextPainter.computeMaxIntrinsicWidth({ double TextScaleFactor = 1.0 })` argument | Deprecated | |
      
      ### `Rendering` Library
      
      | Affected API | State of `textScaleFactor` | Comment | 
      | --- | --- | --- |
      | `RenderEditable({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | |
      | `RenderEditable.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet |
      | `RenderParagraph({ double TextScaleFactor = 1.0 })` constructor argument | Deprecated | |
      | `RenderParagraph.textScaleFactor` getter and setter | Deprecated | No Flutter Fix, not expressible yet |
      
      ### `Widgets` Library
      
      | Affected API | State of `textScaleFactor` | Comment | 
      | --- | --- | --- |
      | `MediaQueryData({ double TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/test/text_scale_factor_test.dart#LL39C21-L39C35 |
      | `MediaQueryData.textScaleFactor` getter | Deprecated | |
      | `MediaQueryData.copyWith({ double? TextScaleFactor })` argument | Deprecated | |
      | `MediaQuery.maybeTextScaleFactorOf(BuildContext context)` static method | Deprecated | No Flutter Fix, not expressible yet  |
      | `MediaQuery.textScaleFactorOf(BuildContext context)` static method | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/lib/src/_functions_io.dart#L68-L70, No Flutter Fix, not expressible yet |
      | `RichText({ double TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/lib/src/builder.dart#L829-L843 |
      | `RichText.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away|
      | `Text({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/914d120da12fba458c020210727831c31bd71041/packages/rfw/lib/src/flutter/core_widgets.dart#L647 , No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
      | `Text.rich({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | The default constructor has an argument that can't be deprecated right away. No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
      | `Text.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away |
      | `EditableText({ double? TextScaleFactor = 1.0 })` constructor argument | Deprecated | No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
      | `EditableText.textScaleFactor` getter | Deprecated | |
      
      ### `Material` Library
      
      | Affected API | State of `textScaleFactor` | Comment | 
      | --- | --- | --- |
      | `SelectableText({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | https://github.com/flutter/packages/blob/cd7b93532e5cb605a42735e20f1de70fc00adae7/packages/flutter_markdown/lib/src/builder.dart#L829-L843, No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
      | `SelectableText.rich({ double? TextScaleFactor = 1.0 })` constructor argument | **To Be Deprecated** | The default constructor has an argument that can't be deprecated right away. No Flutter Fix because of https://github.com/dart-lang/sdk/issues/52664 |
      | `SelectableText.textScaleFactor` getter | **To Be Deprecated** | A constructor argument can't be deprecated right away |
      
      A lot of material widgets (`Slider`, `RangeSlider`, `TimePicker`, and different types of buttons) also change their layout based on `textScaleFactor`. These need to be handled in a case-by-case fashion and will be migrated in follow-up PRs.
      b2e22d35
  11. 26 May, 2023 1 commit
  12. 23 May, 2023 1 commit
  13. 24 Apr, 2023 1 commit
  14. 01 Apr, 2023 1 commit
  15. 22 Mar, 2023 2 commits
  16. 15 Mar, 2023 1 commit
  17. 03 Mar, 2023 1 commit
  18. 23 Feb, 2023 1 commit
  19. 31 Jan, 2023 1 commit
  20. 24 Jan, 2023 1 commit
  21. 09 Dec, 2022 1 commit
  22. 07 Dec, 2022 1 commit
  23. 15 Nov, 2022 1 commit
  24. 31 Oct, 2022 1 commit
  25. 02 Sep, 2022 1 commit
  26. 22 Aug, 2022 1 commit
  27. 10 Aug, 2022 1 commit
  28. 31 May, 2022 1 commit
  29. 25 May, 2022 1 commit
  30. 27 Apr, 2022 1 commit
  31. 14 Apr, 2022 1 commit
  32. 08 Mar, 2022 2 commits
  33. 22 Feb, 2022 1 commit
  34. 14 Oct, 2021 1 commit
  35. 11 Oct, 2021 1 commit
  36. 08 Oct, 2021 2 commits