simc / auto_size_text

Flutter widget that automatically resizes text to fit perfectly within its bounds.
https://pub.dev/packages/auto_size_text
MIT License
2.06k stars 241 forks source link

Exception "The getter 'itemHeights' was called on null" when using AutoSizeText with DropdownButton #52

Open migalv opened 4 years ago

migalv commented 4 years ago

Create an app with the following constraints:

  1. Have a DropdownButton where the DropdownMenuItems have as a child a AutoSizeText
  2. Add a Textfield somewhere

Steps to reproduce:

  1. Click on the Dropdown
  2. Click on the TextField

Exception:

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following NoSuchMethodError was thrown during performLayout():
The getter 'itemHeights' was called on null.
Receiver: null
Tried calling: itemHeights

The relevant error-causing widget was: 
  MaterialApp file:///D:/Projects/AndroidStudioProjects/chaldea/lib/main.dart:20:12
When the exception was thrown, this was the stack: 
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1      _DropdownButtonState._handleTap.<anonymous closure> (package:flutter/src/material/dropdown.dart:1146:26)
#2      _RenderMenuItem.performLayout (package:flutter/src/material/dropdown.dart:617:5)
#3      RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
#4      RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:206:11)