Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c51ee117
Unverified
Commit
c51ee117
authored
Jul 09, 2021
by
Hans Muller
Committed by
GitHub
Jul 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "troubleshooting" section to the AppBar API doc (#86188)
parent
46817f4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+44
-0
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
c51ee117
...
...
@@ -154,6 +154,50 @@ class _PreferredAppBarSize extends Size {
/// ```
/// {@end-tool}
///
/// ## Troubleshooting
///
/// ### Why don't my TextButton actions appear?
///
/// If the app bar's [actions] contains [TextButton]s, they will not
/// be visible if their foreground (text) color is the same as the
/// the app bar's background color.
///
/// The default app bar [backgroundColor] is the overall theme's
/// [ColorScheme.primary] if the overall theme's brightness is
/// [Brightness.light]. Unfortunately this is the same as the default
/// [ButtonStyle.foregroundColor] for [TextButton] for light themes.
/// In this case a preferable text button foreground color is
/// [ColorScheme.onPrimary], a color that contrasts nicely with
/// [ColorScheme.primary]. to remedy the problem, override
/// [TextButton.style]:
///
/// {@tool dartpad --template=stateless_widget_material}
///
/// ```dart
/// Widget build(BuildContext context) {
/// final ButtonStyle style = TextButton.styleFrom(
/// primary: Theme.of(context).colorScheme.onPrimary
/// );
/// return Scaffold(
/// appBar: AppBar(
/// actions: <Widget>[
/// TextButton(
/// style: style,
/// onPressed: () {},
/// child: const Text('Action 1'),
/// ),
/// TextButton(
/// style: style,
/// onPressed: () {},
/// child: const Text('Action 2'),
/// )
/// ],
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [Scaffold], which displays the [AppBar] in its [Scaffold.appBar] slot.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment