Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listView error on material widget #122

Closed
fredgrott opened this issue Jan 14, 2020 · 7 comments
Closed

listView error on material widget #122

fredgrott opened this issue Jan 14, 2020 · 7 comments

Comments

@fredgrott
Copy link
Contributor

got an error impl the example code

error report:

The following assertion was thrown building ListTile(dirty):
No Material widget found.

ListTile 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: ListTile
dirty
The ancestors of this widget were:
: ListView
scrollDirection: vertical
primary: using primary controller
AlwaysScrollableScrollPhysics
dependencies: [PrimaryScrollController, MediaQuery]
: PlatformScaffold
dependencies: [_LocalizationsScope-[GlobalKey#2bb0a], MediaQuery, _InheritedTheme]
: ListViewPage
: PlatformApp
dependencies: [_InheritedTheme]
: PlatformProvider
state: _PlatformProviderState#acc7a
: App
state: _AppState#ab947
: Main
...
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_page.dart:47:22
When the exception was thrown, this was the stack:
#0 debugCheckHasMaterial. (package:flutter/src/material/debug.dart:28:7)
#1 debugCheckHasMaterial (package:flutter/src/material/debug.dart:50:4)
#2 ListTile.build (package:flutter/src/material/list_tile.dart:834:12)
#3 StatelessElement.build (package:flutter/src/widgets/framework.dart:4291:28)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (2) Exception caught by rendering library ═════════════════════════════════════════════════
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_page.dart:47:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (3) Exception caught by rendering library ═════════════════════════════════════════════════
_RenderInkFeatures object was given an infinite size during layout.
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_page.dart:47:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (4) Exception caught by rendering library ═════════════════════════════════════════════════
RenderPhysicalModel object was given an infinite size during layout.
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_page.dart:47:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (5) Exception caught by rendering library ═════════════════════════════════════════════════
RenderRepaintBoundary object was given an infinite size during layout.
The relevant error-causing widget was:
ListView file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_page.dart:44:13
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (6) Exception caught by rendering library ═════════════════════════════════════════════════
RenderIndexedSemantics object was given an infinite size during layout.
The relevant error-causing widget was:
ListView file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_page.dart:44:13
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (7) Exception caught by widgets library ═══════════════════════════════════════════════════
No Material widget found.
The ancestors of this widget were:
: ListView
scrollDirection: vertical
primary: using primary controller
AlwaysScrollableScrollPhysics
dependencies: [PrimaryScrollController, MediaQuery]
: PlatformScaffold
dependencies: [_LocalizationsScope-[GlobalKey#2bb0a], MediaQuery, _InheritedTheme]
: ListViewHeaderPage
: PlatformApp
dependencies: [_InheritedTheme]
: PlatformProvider
state: _PlatformProviderState#acc7a
: App
state: _AppState#ab947
: Main
...
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_header_page.dart:55:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (8) Exception caught by rendering library ═════════════════════════════════════════════════
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_header_page.dart:55:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (9) Exception caught by rendering library ═════════════════════════════════════════════════
_RenderInkFeatures object was given an infinite size during layout.
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_header_page.dart:55:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (10) Exception caught by rendering library ════════════════════════════════════════════════
RenderPhysicalModel object was given an infinite size during layout.
The relevant error-causing widget was:
ListTile file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_header_page.dart:55:22
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (11) Exception caught by rendering library ════════════════════════════════════════════════
RenderRepaintBoundary object was given an infinite size during layout.
The relevant error-causing widget was:
ListView file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_header_page.dart:52:13
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (12) Exception caught by rendering library ════════════════════════════════════════════════
RenderIndexedSemantics object was given an infinite size during layout.
The relevant error-causing widget was:
ListView file:///C:/Users/fgrott/ForkProjects/flutter_boilerplate_app/lib/list_view_header_page.dart:52:13

Looks like I need to track down ListTile and see what is going on will add more when I find more later..well wait it occurred on ios look so that might be a clue :)

@fredgrott
Copy link
Contributor Author

okay yup its listtile as it requires material app widget ..sop for my example I need to crib a new listTile for cupertino and cal it in my impl example form this projects code example

@fredgrott
Copy link
Contributor Author

I know a quick fix would be just to use a blank material widget as a container which than supposedly render correctly on ios..any ideas which one?

@fredgrott
Copy link
Contributor Author

okay looks like I can do parent object material scaffold and than pass listview-listTile combo as the child this way I would have a Material widget ancestor to listTile to render correctly on ios so exampel code has to change to something similar

@fredgrott
Copy link
Contributor Author

code in listviepagehaeader should be changed to

``body: Scaffold(
body: ListView(
children: _words
.map(
(w) => ListTile(
title: Text(w),
),
)
.toList(),
),
)

and that should fix the code example for the ios platform

@fredgrott
Copy link
Contributor Author

the followup error for the list-view-page_header is now above near the parent of the ui tree in how localizations are passed..evidently CupertinoApp needs the Material one and Cupertino and web ones passed I think..this only relates to the example code only form the version 0-.31.

@aqwert
Copy link
Collaborator

aqwert commented Jan 14, 2020

As of 0.31.0 The Material widget was removed from the cupertino side as it was breaking some things related to dark mode. If you want to support Material widgets on ios such as ListTile you can add iosUsesMaterialWidgets to the PlatformProvider configuration

PlatformProvider(
    settings: PlatformSettingsData(iosUsesMaterialWidgets : true),
    builder: (_) => ...
)

Other option is to wrap all Material widgets with the Material widget.

Material(child: ListTile())

@fredgrott
Copy link
Contributor Author

Error disappeared with update and wil lkeep that added setting in mind thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants