Skip to content

TimePickerThemeData action buttons styles aren't working #132760

@komakur

Description

@komakur

Steps to reproduce

  1. Create custom ThemeData with useMaterial3: true,
  2. Provide timePickerTheme, changing confirmButtonStyle or\and cancelButtonStyle
  3. Provide created theme to the app and put TimePickerDialog in Scaffold.body

There was an issue #94927 however it was closed long time ago. The answer @TahaTesser gave, didn't help, as it changed the ButtonStyles for both - confirmButton and cancelButton. I think that those props must be removed (if they truly doesn't work) or if there is a solution to this it must be somewhere in docs

Expected results

The confirmButtonStyle and cancelButtonStyle of TimePickerThemeData should have been changed

Actual results

Nothing has changed. I think if those properties are in TimerPickerThemeData and we can provide our ButtonStyles to it, it should change.

Code sample

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

const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark(useMaterial3: true).copyWith(
        scaffoldBackgroundColor: darkBlue,
        timePickerTheme: TimePickerThemeData(
          backgroundColor: Colors.blue,
          confirmButtonStyle: ButtonStyle(
            backgroundColor:
                MaterialStateColor.resolveWith((states) => Colors.grey),
            foregroundColor:
                MaterialStateColor.resolveWith((states) => Colors.red),
          ),
        ),
      ),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: TimePickerDialog(
            initialTime: TimeOfDay.fromDateTime(
              DateTime.now(),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

image

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-x64, locale en-UA)
    • Flutter version 3.10.6 on channel stable at /Users/me/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (5 weeks ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/me/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/me/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

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

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • 48896B42-4960-4EB8-9A92-B04AB52D8E18 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)        • macos                                • darwin-x64     • macOS 13.5 22G74 darwin-x64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 115.0.5790.170

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: date/time pickerDate or time picker widgetsf: material designflutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions