5 Comments
User's avatar
Manish's avatar

i think this can help you =>

List<T> findWidgets<T extends Widget>() => collectAllElementsFrom(

Widgets Binding.instance.renderViewElement, skipOffstage: false)

.map((e) => e.widget) .whereType<T>()

.tolist();

Expand full comment
Dane Mackier's avatar

That looks like it could help.

Expand full comment
Manish's avatar

i don't think position offset will remain same , as we will Scroll it will change its y coordinate (if vertical) => I/flutter ( 9989): [Tuple4<Widget>: Widget: TextFormField, Size: Size(258.0, 24.0), Position: Offset(51.0, -865.7),WidgetType: WidgetType.input, Tuple4<Widget>: Widget: TextFormField, Size: Size(258.0, 24.0), Position: Offset(51.0, -790.7),WidgetType: WidgetType.input, Tuple4<Widget>: Widget: TextFormField, Size: Size(258.0, 24.0), Position: Offset(51.0, 412.5),WidgetType: WidgetType.input]

2

I/flutter ( 9989): [Tuple4<Widget>: Widget: TextFormField, Size: Size(258.0, 24.0), Position: Offset(51.0, -865.5),WidgetType: WidgetType.input, Tuple4<Widget>: Widget: TextFormField, Size: Size(258.0, 24.0), Position: Offset(51.0, -790.5),WidgetType: WidgetType.input, Tuple4<Widget>: Widget: TextFormField, Size: Size(258.0, 24.0), Position: Offset(51.0, 412.5),WidgetType: WidgetType.input]

Expand full comment
Dane Mackier's avatar

I can't comment on any of those things, but the bounty has been claimed.

I'll simply add override rules.

.i.e. TextField will be taken for a widget at the same place as an input and a scroll etc.

I just needed the scan and printing out of widgets, that's the base part and I can wrap up the rest of the functionality myself.

Expand full comment