1

Is there a canonical way of computing the height of a multi-line Text widget before rendering? Basically, I want to show dynamic text in a SliverAppBar. Unfortunately a height needs to be defined on the flexibleSpace using expandedHeight. This is my working code. Anyway to compute dynamicTextHeight?

               SliverAppBar(
                        // This is the title in the app bar.
                        title: UISubSubHeader(text: model.state.username),
                        actions: _getActions(context),
                        expandedHeight: dynamicTextHeight,
                        pinned: true,
                        forceElevated: innerBoxIsScrolled,
                        flexibleSpace: FlexibleSpaceBar(
                          background: Text(dynamicText),
                        ),
                        bottom: TabBar(
                          indicatorColor: UIColor.dark,
                          labelColor: UIColor.dark,
                          labelStyle: Theme.of(context).textTheme.bodyText1,
                          tabs: getTabs(context),
                          unselectedLabelColor: UIColor.grey,
                          unselectedLabelStyle: Theme.of(context).textTheme.bodyText1,
                        ),
                      )
user2892437
  • 1,111
  • 1
  • 14
  • 22

0 Answers0