fluttercommunity / fluttercommunity/chewie

CenterPlay Button causing error

Open
#578 2 comments 1 reaction 0 assignees View on GitHub
awaiting feedback
Dominant language
Dart
Stars
2.1k
Forks
1.1k
Avg merge
6d 8h
Merged PRs (30d)
6

Description

Widget causing error
```
@override
Widget build(BuildContext context) {
return Container(
color: Colors.transparent,
child: Center(
child: AnimatedOpacity(
opacity: show ? 1.0 : 0.0,
duration: const Duration(milliseconds: 300),
child: Container(
decoration: BoxDecoration(
color: backgroundColor,
shape: BoxShape.circle,
),
child: Padding(
padding: const EdgeInsets.all(12.0),
// Always set the iconSize on the IconButton, not on the Icon itself:
// https://github.com/flutter/flutter/issues/52980
child: IconButton(
iconSize: 32,
icon: isFinished
? Icon(Icons.replay, color: iconColor)
: AnimatedPlayPause(
color: iconColor,
playing: isPlaying,
),
onPressed: onPressed,
),
),
),
),
),
);
}
}

```

Error Caused

```
The following assertion was thrown building IconButton(Icon, padding: EdgeInsets.all(8.0), dirty):
No Material widget found.
IconButton widgets require a Material widget ancestor.
In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
material library, that material is represented by the Material widget. It is the Material widget
that renders ink splashes, for instance. Because of this, many material library widgets require that
there be a Material widget in the tree above them.
To introduce a Material widget, you can either directly include one, or use a widget that contains
Material itself, such as a Card, Dialog, Drawer, or Scaffold.
The specific widget that could not find a Material ancestor was:
IconButton
The ancestors of this widget were:
...
Padding
DecoratedBox
Container
FadeTransition
AnimatedOpacity
...

The relevant error-causing widget was:
IconButton
IconButton:file:///C:/Users/91797/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/chewie-1.2.2/lib/src/center_play_button.dart:38:22

```

chewie is working fine in my app just this exception is thrown

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.