Skip to content

Conversation

@TahaTesser
Copy link
Member

fixes resize window with a showDateRangePicker will make RenderFlex overflowed error

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.
Detailsexpand to view the code sample
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),
      ),
    );
  }
}

Before

before.mov

After

after.mov

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 25, 2023
@TahaTesser TahaTesser requested a review from HansMuller August 25, 2023 15:10
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 28, 2023
@auto-submit auto-submit bot merged commit a0943e6 into flutter:master Aug 28, 2023
@TahaTesser TahaTesser deleted the fix_date_picker_input_overflow branch August 28, 2023 20:59
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 29, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 29, 2023
flutter/flutter@ec387a4...6c95737

2023-08-29 [email protected] Roll Flutter Engine from d84763e04496 to 65438c7bb46a (1 revision) (flutter/flutter#133563)
2023-08-29 [email protected] Roll Flutter Engine from 0625049b5ee3 to d84763e04496 (6 revisions) (flutter/flutter#133559)
2023-08-29 [email protected] Roll Flutter Engine from c2ec683c4ea8 to 0625049b5ee3 (2 revisions) (flutter/flutter#133538)
2023-08-29 [email protected] Roll Flutter Engine from 3d1faae1bc2f to c2ec683c4ea8 (4 revisions) (flutter/flutter#133535)
2023-08-29 [email protected] Roll Flutter Engine from c7c61ff9732c to 3d1faae1bc2f (1 revision) (flutter/flutter#133530)
2023-08-29 [email protected] Fix bug in setPreferredOrientations example (flutter/flutter#133503)
2023-08-29 [email protected] Roll Flutter Engine from 9778c2cb1d51 to c7c61ff9732c (2 revisions) (flutter/flutter#133527)
2023-08-29 [email protected] Roll Flutter Engine from ffda7e3cfc7f to 9778c2cb1d51 (1 revision) (flutter/flutter#133526)
2023-08-29 [email protected] Roll Flutter Engine from 1e821961e96a to ffda7e3cfc7f (2 revisions) (flutter/flutter#133523)
2023-08-29 [email protected] Roll Flutter Engine from 45e2b41e5ae5 to 1e821961e96a (2 revisions) (flutter/flutter#133520)
2023-08-29 [email protected] Roll Flutter Engine from bd2132a0814f to 45e2b41e5ae5 (2 revisions) (flutter/flutter#133518)
2023-08-29 [email protected] add missing forwards of local-engine-host in benchmark runners (flutter/flutter#133517)
2023-08-28 [email protected] Roll Flutter Engine from a7a4c1c70bad to bd2132a0814f (3 revisions) (flutter/flutter#133516)
2023-08-28 [email protected] FocusNode and FocusManager should dispatch creation in constructor. (flutter/flutter#133490)
2023-08-28 [email protected] Use flutter pub get instead of dart pub get in create_api_docs.dart (flutter/flutter#133493)
2023-08-28 [email protected] PlatformRouteInformationProvider should dispatch creation in constructor. (flutter/flutter#133492)
2023-08-28 [email protected] Roll Flutter Engine from 91522a188bda to a7a4c1c70bad (11 revisions) (flutter/flutter#133508)
2023-08-28 [email protected] Revert "Remove `ImageProvider.load`, `DecoderCallback` and `PaintingBâ�¦ (flutter/flutter#133482)
2023-08-28 [email protected] Fix context menu button color on Android when textButtonTheme is set (flutter/flutter#133271)
2023-08-28 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.4 to 2.21.5 (flutter/flutter#133504)
2023-08-28 [email protected] Fix  `DatePickerDialog` & `DateRangePickerDialog` overflow when resized from landscape to portrait (flutter/flutter#133327)
2023-08-28 [email protected] Empty commit to re-trigger tests (flutter/flutter#133495)
2023-08-28 [email protected] Revert "PlatformRouteInformationProvider  should dispatch creation in constructor." (flutter/flutter#133479)
2023-08-28 [email protected] Revert "FocusNode and FocusManager should dispatch creation in constructor." (flutter/flutter#133474)

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 [email protected],[email protected] 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.

resize window with a showDateRangePicker will make RenderFlex overflowed error

2 participants