1 year ago
#377071
user2892437
Flutter - How to get height of multi-line Text widget?
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,
),
)
flutter
sliverappbar
0 Answers
Your Answer