-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: API breakBackwards-incompatible API changesBackwards-incompatible API changesc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: googleVarious Google teamsVarious Google teamsf: 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.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Description
Help us understand the severity of this issue
- causing severe production issues e.g. malfunctions or data loss
- blocking next binary release
- blocking a client feature launch within a quarter
- nice-to-have but does not block a launch within the next quarter
Steps to reproduce
Not a bug, more like a request for GPay. GPay is doing an app-wide migration to conform to the latest guidelines in go/m3-tone-based-surfaces. However, on auditing, we realised that AppBar() will always use surfaceTint color.
From the code it seems like the default behavior would be applying a tint over background color itself.
Is there any way we can handle the color logic internally within AppBar and allow user to pass in surfaceTint / elevated color if they wish, rather than having to override surfaceTint for all callsites to conform to M3 tonal colors?
Expected results
The recommended guideline is to show surfaceContainer.
- Note: If we override surfaceTint color to transparent, we would get surfaceContainer.
Actual results
- Currently, when we are under scrolledUnderElevation, the color seems to be surface2 (surface + surfaceTint with opacity 0.08) without overriding surfaceTint color on AppBarTheme.
Code sample
import 'package:flutter/material.dart';
void main() => runApp(const AppBarApp());
class AppBarApp extends StatelessWidget {
const AppBarApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: AppBarExample(),
);
}
}
class AppBarExample extends StatelessWidget {
const AppBarExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Override appBarTheme with transparent. If we remove this, we will realise
// that color is not surfaceContainer.
surfaceTintColor: Colors.transparent,
title: const Text('AppBar Demo'),
),
body: SingleChildScrollView(
child: Container(
// On scroll should see the two colors are the same.
color: Theme.of(context).colorScheme.surfaceContainer,
child: Column(
children: [
for (int i = 0; i < 100; i++)
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Item $i'),
)
],
),
),
),
);
}
}
Screenshots or Video
Logs
Flutter Doctor output
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: API breakBackwards-incompatible API changesBackwards-incompatible API changesc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: googleVarious Google teamsVarious Google teamsf: 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.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue