Skip to content

dayShape resolve from theme's dayShape is missing in _DayItem used in DateRangePicker #181500

@komakur

Description

@komakur

Passing dayShape to DatePickerThemeData of Theme has no effect for DateRangePicker. Moreover, even today day is also not affected.

_DayItem should have almost the same styling as _Day: they are semantically the same components:

_Day of date picker:

Image

_DayItem of date range picker after changes:

Image Image

So, by copying date picker _Day the issue easily resolved 🙂

Results:

After Before
Image Image
Reproducible code

void main() {
  runApp(
    MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomeScreen(),
      theme: ThemeData.dark(useMaterial3: true).copyWith(
        dialogTheme: const DialogThemeData(
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero),
        ),

        datePickerTheme: DatePickerThemeData(
          rangePickerShape: RoundedRectangleBorder(
            borderRadius: BorderRadius.zero,
          ),

          dayShape: WidgetStatePropertyAll<OutlinedBorder>(
            RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
          ),
          shape: RoundedRectangleBorder(borderRadius: .zero),
        ),
      ),
    ),
  );
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Calendar examples')),
      body: Align(
        child: Column(
          spacing: 6,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () {
                showDateRangePicker(
                  context: context,
                  firstDate: DateTime(2020),
                  lastDate: DateTime(2030),
                  selectableDayPredicate:
                      (day, selectedStartDay, selectedEndDay) {
                        return true;
                      },
                  builder: (context, child) {
                    return Center(
                      child: ConstrainedBox(
                        constraints: const BoxConstraints(
                          maxWidth: 400.0,
                          maxHeight: 600.0,
                        ),
                        child: child,
                      ),
                    );
                  },
                );
              },
              child: Text('Open date range picker'),
            ),
            ElevatedButton(
              onPressed: () {
                showDatePicker(
                  context: context,
                  firstDate: DateTime(2020),
                  lastDate: DateTime(2030),
                  builder: (context, child) {
                    return Center(
                      child: ConstrainedBox(
                        constraints: BoxConstraints(
                          maxWidth: 400.0,
                          maxHeight: 600.0,
                        ),
                        child: child,
                      ),
                    );
                  },
                );
              },
              child: Text('Open date picker'),
            ),
          ],
        ),
      ),
    );
  }
}

Flutter doctor

• Flutter version 3.38.3 on channel stable at /Users/me/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 19074d12f7 (10 weeks ago), 2025-11-20 17:53:13 -0500
    • Engine revision 13e658725d
    • Dart version 3.10.1
    • DevTools version 2.51.1
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions