-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
- Create a Flutter app with Material 3 enabled (default).
- Add an
AlertDialogto the app without specifyingtitleTextStyleandcontentTextStyle. - Observe the style applied to the title text and the content text.
- The
TextStyleapplied to the title text isTextTheme.headlineSmallofThemeData.textTheme - The
TextStyleapplied to the content text isTextTheme.bodyMediumofThemeData.textTheme
- The
Current Documentation
The current documentation for the properties AlertDialog.titelTextStyle and AlertDialog.contentTextStyle from alert_dialog.dart:
/// Style for the text in the [title] of this [AlertDialog].
///
/// If null, [DialogTheme.titleTextStyle] is used. If that's null, defaults to
/// [TextTheme.titleLarge] of [ThemeData.textTheme].
final TextStyle? titleTextStyle;
/// Style for the text in the [content] of this [AlertDialog].
///
/// If null, [DialogTheme.contentTextStyle] is used. If that's null, defaults
/// to [TextTheme.titleMedium] of [ThemeData.textTheme].
final TextStyle? contentTextStyle;Expected results
- The documentation of
AlertDialog.titleTextStyleshould clearly state that with Material 3 (useMaterial3: true), the defaulttitleTextStyleofAlertDialogfall back toTextTheme.headlineSmalland not toTextTheme.titleLarge. - The documentation of
AlertDialog.contentTextStyleshould clearly state that with Material 3 (useMaterial3: true), the defaultcontentTextStyleofAlertDialogfall back toTextTheme.bodyMediumand not toTextTheme.titleMedium.
Actual results
- The current documentation incorrectly suggests that
AlertDialog.titleTextStyledefaults toTextTheme.titleLarge, causing confusion when styling dialogs in Material 3 apps. - The current documentation incorrectly suggests that
AlertDialog.contentTextStyledefaults toTextTheme.titleMedium, causing confusion when styling dialogs in Material 3 apps.
Code sample
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 MaterialApp(
title: 'Flutter Documentation Issue Example',
theme: ThemeData(
textTheme: const TextTheme(
// Text style used for the title of the [AlertDialog] according to
// [AlertDialog.titleTextStyle] DOCUMENTATION.
titleLarge: TextStyle(color: Colors.green),
// Text style ACTUALLY USED for the title of the [AlertDialog] when
// Material 3 is in use.
headlineSmall: TextStyle(color: Colors.red),
// Text style used for the content of the [AlertDialog] according to
// [AlertDialog.contentTextStyle] DOCUMENTATION.
titleMedium: TextStyle(color: Colors.green),
// Text style ACTUALLY USED for the content of the [AlertDialog]
// when Material 3 is in use.
bodyMedium: TextStyle(color: Colors.red),
),
useMaterial3: true,
),
home: const AlertDialog(
title: Text(
'Title - should be green according to [AlertDialog.titleTextStyle] '
'documentation',
),
content: Text(
'Content - should be green according to '
'[AlertDialog.contentTextStyle] documentation.',
),
),
);
}
}
Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.19.2, on Microsoft Windows [version 10.0.22631.3155], locale fr-FR)
• Flutter version 3.19.2 on channel stable at C:\Users\nenup\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7482962148 (3 days ago), 2024-02-27 16:51:22 -0500
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\nenup\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.8.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.8.34330.188
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2023.1)
• Android Studio at C:\Program Files\Android\Android Studio
• 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.7+0-b2043.56-10550314)
[√] VS Code (version 1.87.0)
• VS Code at C:\Users\nenup\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.82.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [version 10.0.22631.3155]
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.71
• Edge (web) • edge • web-javascript • Microsoft Edge 122.0.2365.52
[√] Network resources
• All expected network resources are available.
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team