mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-13 01:10:31 -07:00
fix: Hide subtitles with empty text (#242)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
48b1e4a6fb
commit
3ca3d72b9c
1 changed files with 35 additions and 32 deletions
|
|
@ -209,43 +209,46 @@ class SubtitleText extends ConsumerWidget {
|
||||||
// Ensure the text doesn't go off-screen
|
// Ensure the text doesn't go off-screen
|
||||||
position = position.clamp(0, availableHeight - textHeight);
|
position = position.clamp(0, availableHeight - textHeight);
|
||||||
|
|
||||||
return IgnorePointer(
|
return Visibility(
|
||||||
child: Stack(
|
visible: text.isEmpty ? false : true,
|
||||||
alignment: Alignment.bottomCenter,
|
child: IgnorePointer(
|
||||||
children: [
|
child: Stack(
|
||||||
Positioned(
|
alignment: Alignment.bottomCenter,
|
||||||
bottom: position,
|
children: [
|
||||||
child: Container(
|
Positioned(
|
||||||
constraints: BoxConstraints(maxWidth: constraints.maxWidth, maxHeight: constraints.maxHeight),
|
bottom: position,
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
color: subModel.backGroundColor,
|
constraints: BoxConstraints(maxWidth: constraints.maxWidth, maxHeight: constraints.maxHeight),
|
||||||
borderRadius: BorderRadius.circular(16),
|
decoration: BoxDecoration(
|
||||||
),
|
color: subModel.backGroundColor,
|
||||||
child: Padding(
|
borderRadius: BorderRadius.circular(16),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
),
|
||||||
child: Text(
|
child: Padding(
|
||||||
text,
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
style: subModel.backGroundStyle.copyWith(fontSize: textScale),
|
child: Text(
|
||||||
textAlign: TextAlign.center,
|
text,
|
||||||
|
style: subModel.backGroundStyle.copyWith(fontSize: textScale),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
Positioned(
|
bottom: position,
|
||||||
bottom: position,
|
child: Container(
|
||||||
child: Container(
|
constraints: BoxConstraints(maxWidth: constraints.maxWidth, maxHeight: constraints.maxHeight),
|
||||||
constraints: BoxConstraints(maxWidth: constraints.maxWidth, maxHeight: constraints.maxHeight),
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
child: Text(
|
||||||
child: Text(
|
text,
|
||||||
text,
|
style: subModel.style.copyWith(fontSize: textScale),
|
||||||
style: subModel.style.copyWith(fontSize: textScale),
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue