Repository navigation
ListTile with tileColor behaves strange in sliver with animation #83124
Copy link
Copy link
Closed
Labels
frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
When ListTile with specified tileColor is used inside slivers, it behaves strange during an animation apply.
Steps to Reproduce
Use the following code example and tap on Toggle button to hide and then show the list tile.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatefulWidget {
@override
_MyWidgetState createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
bool _show = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Tile example')),
body: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: AnimatedSwitcher(
duration: Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) =>
SizeTransition(
sizeFactor: animation,
axisAlignment: 1,
child: child,
),
child: _show ? ListTile(
tileColor: Colors.yellow,
title: Text('Titlte'),
) : SizedBox.shrink(),
),
),
SliverToBoxAdapter(
child: ElevatedButton(
child: Text('toggle'),
onPressed: () {
setState(() {
_show = !_show;
});
},
),
),
],
),
);
}
}Expected results: ListTile should remain color after it opened
Actual results: Color is missing
First noticed Flutter 2.2
Logs
[✓] Flutter (Channel stable, 2.2.0, on macOS 11.3 20E232 darwin-x64, locale ru-UA)
• Flutter version 2.2.0 at /Users/tatsu/flutter
• Framework revision b22742018b (7 days ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Type
Projects
- StatusShow more project fieldsDone (PR merged)
Activity
AbhishekDoshi26 commentedon May 23, 2021
Reproducible.
xu-baolin commentedon May 24, 2021
Relation issues, #73315 #59963
xu-baolin commentedon Jun 16, 2021
@TatsuUkraine Hi, here is a workaround:
TatsuUkraine commentedon Jun 20, 2021
Thanks, it may solve the problem. Will let you know when I try it. Another workaround that I'm using now is a ColoredBox around the ListTile. Could you explain how Material widget solves the problem?
TahaTesser commentedon Jul 13, 2022
This is fixed by #105760
github-actions commentedon Jul 27, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.