I am getting the No material widget found
error when I run the following test, even though I am wrapping it in a MaterialApp. Any pointers to why that is?
void main() {
final mockExam = examMocks[0];
Widget createGridItem() => Provider<ExamInformation>.value(
value: ExamInformation(
examSpecifications: mockExam.examSpecifications,
examImage: mockExam.examImage,
questionList: mockExam.questionList),
child: ExamGridItem(),
);
testWidgets('Exam grid item displays Footer', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: createGridItem()));
final gridItemFooterFinder = find.byType(Footer);
expect(gridItemFooterFinder, findsOneWidget);
});
}
Detailed error log:
The following assertion was thrown building _InkResponseStateWidget(gestures: [tap], mouseCursor:
null, BoxShape.circle, dirty, state: _InkResponseState#3ef96):
No Material widget found.
_InkResponseStateWidget 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:
_InkResponseStateWidget
The ancestors of this widget were:
...
InkResponse
Positioned
Stack
GridTile
Consumer<ExamInformation>
...