fix: don't put positioned widget in non-stack parent (#3649)

This commit is contained in:
ggurdin 2025-08-07 10:15:09 -04:00 committed by GitHub
parent 3ca759229b
commit 0ac33f96fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -73,119 +73,111 @@ class ActivityPinnedMessageState extends State<ActivityPinnedMessage> {
final theme = Theme.of(context);
final isColumnMode = FluffyThemes.isColumnMode(context);
return Positioned(
top: 0,
left: 0,
right: 0,
bottom: _showDropdown ? 0 : null,
child: Column(
children: [
AnimatedContainer(
duration: FluffyThemes.animationDuration,
decoration: BoxDecoration(
color: _showDropdown
? theme.colorScheme.surfaceContainerHighest
: theme.colorScheme.surface,
),
child: ChatAppBarListTile(
title: "🎯 ${room.activityPlan!.learningObjective}",
leading: const SizedBox(width: 18.0),
trailing: Padding(
padding: const EdgeInsets.only(right: 12.0),
child: ElevatedButton(
onPressed:
_showDropdown ? null : () => _setShowDropdown(true),
style: ElevatedButton.styleFrom(
minimumSize: Size.zero,
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 4.0,
),
backgroundColor: AppConfig.yellowDark,
foregroundColor: theme.colorScheme.surface,
disabledBackgroundColor:
AppConfig.yellowDark.withAlpha(100),
disabledForegroundColor:
theme.colorScheme.surface.withAlpha(100),
return Column(
children: [
AnimatedContainer(
duration: FluffyThemes.animationDuration,
decoration: BoxDecoration(
color: _showDropdown
? theme.colorScheme.surfaceContainerHighest
: theme.colorScheme.surface,
),
child: ChatAppBarListTile(
title: "🎯 ${room.activityPlan!.learningObjective}",
leading: const SizedBox(width: 18.0),
trailing: Padding(
padding: const EdgeInsets.only(right: 12.0),
child: ElevatedButton(
onPressed: _showDropdown ? null : () => _setShowDropdown(true),
style: ElevatedButton.styleFrom(
minimumSize: Size.zero,
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 4.0,
),
child: Text(
L10n.of(context).endActivityTitle,
style: const TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w900,
),
backgroundColor: AppConfig.yellowDark,
foregroundColor: theme.colorScheme.surface,
disabledBackgroundColor: AppConfig.yellowDark.withAlpha(100),
disabledForegroundColor:
theme.colorScheme.surface.withAlpha(100),
),
child: Text(
L10n.of(context).endActivityTitle,
style: const TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w900,
),
),
),
onTap: _scrollToActivity,
),
onTap: _scrollToActivity,
),
AnimatedSize(
duration: FluffyThemes.animationDuration,
curve: Curves.easeInOut,
child: ClipRect(
child: _showDropdown
? Container(
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHighest,
),
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 16.0,
),
child: Column(
spacing: 12.0,
mainAxisSize: MainAxisSize.min,
children: [
Text(
L10n.of(context).endActivityDesc,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: isColumnMode ? 16.0 : 12.0,
),
),
AnimatedSize(
duration: FluffyThemes.animationDuration,
curve: Curves.easeInOut,
child: ClipRect(
child: _showDropdown
? Container(
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHighest,
),
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 16.0,
),
child: Column(
spacing: 12.0,
mainAxisSize: MainAxisSize.min,
children: [
Text(
L10n.of(context).endActivityDesc,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: isColumnMode ? 16.0 : 12.0,
),
CachedNetworkImage(
imageUrl:
"${AppConfig.assetsBaseURL}/${ActivitySuggestionsConstants.endActivityAssetPath}",
width: isColumnMode ? 240.0 : 120.0,
),
ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 8.0,
),
foregroundColor: theme.colorScheme.onSecondary,
backgroundColor: theme.colorScheme.secondary,
),
CachedNetworkImage(
imageUrl:
"${AppConfig.assetsBaseURL}/${ActivitySuggestionsConstants.endActivityAssetPath}",
width: isColumnMode ? 240.0 : 120.0,
),
ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 8.0,
),
onPressed: _finishActivity,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
L10n.of(context).endActivityTitle,
style: TextStyle(
fontSize: isColumnMode ? 16.0 : 12.0,
),
foregroundColor: theme.colorScheme.onSecondary,
backgroundColor: theme.colorScheme.secondary,
),
onPressed: _finishActivity,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
L10n.of(context).endActivityTitle,
style: TextStyle(
fontSize: isColumnMode ? 16.0 : 12.0,
),
],
),
),
],
),
],
),
)
: const SizedBox.shrink(),
),
],
),
)
: const SizedBox.shrink(),
),
),
if (_showDropdown)
Expanded(
child: GestureDetector(
onTap: () => _setShowDropdown(false),
child: Container(color: Colors.black.withAlpha(100)),
),
),
if (_showDropdown)
Expanded(
child: GestureDetector(
onTap: () => _setShowDropdown(false),
child: Container(color: Colors.black.withAlpha(100)),
),
),
],
),
],
);
}
}