Skip to content

resize window with a showDateRangePicker will make RenderFlex overflowed error #131989

@cruvie

Description

@cruvie

Is there an existing issue for this?

Steps to reproduce

  1. run the code on macos
  2. click the input field
  3. click edit button
  4. resize window

Expected results

work fine

Actual results

RenderFlex overflowed error

Code sample

Code sample
import 'package:flutter/material.dart';

main() async {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final primaryColor = Colors.teal;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          useMaterial3: true,
          datePickerTheme: DatePickerThemeData(
            surfaceTintColor: primaryColor,
            weekdayStyle: TextStyle(color: primaryColor),
            todayForegroundColor:
                MaterialStateProperty.all<Color>(primaryColor),
            // rangePickerBackgroundColor: primaryColor,
            rangeSelectionBackgroundColor: primaryColor.withOpacity(0.3),
            // rangePickerSurfaceTintColor: primaryColor,
          )),
      home: const One(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
      //开始-结束时间
      margin: const EdgeInsets.fromLTRB(20, 20, 20, 0),
      child: TextFormField(
        // controller: timeRangeController,
        decoration: const InputDecoration(
          labelText: '开始-结束时间',
          icon: Icon(Icons.date_range_outlined),
        ),
        readOnly: true,
        onTap: () {
          showDateRangePicker(
            context: context,
            firstDate: DateTime.now(),
            lastDate: DateTime.now().add(const Duration(days: 365)),
          ).then((DateTimeRange? val) {});
        },
      ),
    ));
  }
}

Screenshots or Video

Screenshots / Video demonstration
2023-08-05.22.42.42.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.5 22G74 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.10.0 on channel stable at /Users/cruvie/Documents/DevelopmentEnvironment/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 84a1e904f4 (3 个月前), 2023-05-09 07:41:44 -0700
    • Engine revision d44b5a94c9
    • Dart version 3.0.0
    • DevTools version 2.23.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/cruvie/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 75.0.4
    • Dart plugin version 232.8660.129

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/cruvie/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.8660.185/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.80.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.70.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.5 22G74 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopa: error messageError messages from the Flutter frameworkf: date/time pickerDate or time picker widgetsf: material designflutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13fyi-linuxFor the attention of the Linux platform teamfyi-macosFor the attention of macOS platform teamfyi-windowsFor the attention of the Windows platform teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions