mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
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  |
||
|---|---|---|
| .. | ||
| action_chip_template.dart | ||
| app_bar_template.dart | ||
| badge_template.dart | ||
| banner_template.dart | ||
| bottom_app_bar_template.dart | ||
| bottom_sheet_template.dart | ||
| button_template.dart | ||
| card_template.dart | ||
| checkbox_template.dart | ||
| chip_template.dart | ||
| color_scheme_template.dart | ||
| date_picker_template.dart | ||
| dialog_template.dart | ||
| divider_template.dart | ||
| drawer_template.dart | ||
| expansion_tile_template.dart | ||
| fab_template.dart | ||
| filter_chip_template.dart | ||
| icon_button_template.dart | ||
| input_chip_template.dart | ||
| input_decorator_template.dart | ||
| list_tile_template.dart | ||
| menu_template.dart | ||
| motion_template.dart | ||
| navigation_bar_template.dart | ||
| navigation_drawer_template.dart | ||
| navigation_rail_template.dart | ||
| popup_menu_template.dart | ||
| progress_indicator_template.dart | ||
| radio_template.dart | ||
| search_bar_template.dart | ||
| search_view_template.dart | ||
| segmented_button_template.dart | ||
| slider_template.dart | ||
| snackbar_template.dart | ||
| surface_tint.dart | ||
| switch_template.dart | ||
| tabs_template.dart | ||
| template.dart | ||
| text_field_template.dart | ||
| time_picker_template.dart | ||
| token_logger.dart | ||
| typography_template.dart | ||