fix: Some story layout bugs

This commit is contained in:
Krille Fear 2022-04-03 10:22:19 +02:00
parent a72b54d9ad
commit 43dd52836a

View File

@ -213,7 +213,11 @@ class StoryView extends StatelessWidget {
return Container(); return Container();
} }
controller.loadingModeOff(); controller.loadingModeOff();
return Center( return Container(
constraints: const BoxConstraints.expand(),
alignment: controller.storyThemeData.fit == BoxFit.cover
? null
: Alignment.center,
child: Image.memory( child: Image.memory(
matrixFile.bytes, matrixFile.bytes,
fit: controller.storyThemeData.fit, fit: controller.storyThemeData.fit,
@ -221,56 +225,55 @@ class StoryView extends StatelessWidget {
); );
}, },
), ),
GestureDetector( SafeArea(
onTapDown: controller.hold, child: GestureDetector(
onTapUp: controller.unhold, onTapDown: controller.hold,
onTapCancel: controller.unhold, onTapUp: controller.unhold,
onVerticalDragStart: controller.hold, onTapCancel: controller.unhold,
onVerticalDragEnd: controller.unhold, onVerticalDragStart: controller.hold,
onHorizontalDragStart: controller.hold, onVerticalDragEnd: controller.unhold,
onHorizontalDragEnd: controller.unhold, onHorizontalDragStart: controller.hold,
child: AnimatedContainer( onHorizontalDragEnd: controller.unhold,
duration: const Duration(milliseconds: 200), child: AnimatedContainer(
padding: const EdgeInsets.symmetric( duration: const Duration(milliseconds: 200),
horizontal: 8.0, padding: const EdgeInsets.all(16.0),
vertical: 64, decoration: BoxDecoration(
), gradient: event.messageType == MessageTypes.Text
decoration: BoxDecoration( ? LinearGradient(
gradient: event.messageType == MessageTypes.Text colors: [
? LinearGradient( backgroundColorDark,
colors: [ backgroundColor,
backgroundColorDark, ],
backgroundColor, begin: Alignment.topCenter,
], end: Alignment.bottomCenter,
begin: Alignment.topCenter, )
end: Alignment.bottomCenter, : null,
)
: null,
),
alignment: Alignment(
controller.storyThemeData.alignmentX.toDouble() / 100,
controller.storyThemeData.alignmentY.toDouble() / 100,
),
child: LinkText(
text: controller.loadingMode
? L10n.of(context)!.loadingPleaseWait
: event.content.tryGet<String>('body') ?? '',
textAlign: TextAlign.center,
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
linkStyle: TextStyle(
fontSize: 24,
color: Colors.blue.shade50,
decoration: TextDecoration.underline,
shadows: event.messageType == MessageTypes.Text
? null
: textShadows,
), ),
textStyle: TextStyle( alignment: Alignment(
fontSize: 24, controller.storyThemeData.alignmentX.toDouble() / 100,
color: Colors.white, controller.storyThemeData.alignmentY.toDouble() / 100,
shadows: event.messageType == MessageTypes.Text ),
? null child: LinkText(
: textShadows, text: controller.loadingMode
? L10n.of(context)!.loadingPleaseWait
: event.content.tryGet<String>('body') ?? '',
textAlign: TextAlign.center,
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
linkStyle: TextStyle(
fontSize: 24,
color: Colors.blue.shade50,
decoration: TextDecoration.underline,
shadows: event.messageType == MessageTypes.Text
? null
: textShadows,
),
textStyle: TextStyle(
fontSize: 24,
color: Colors.white,
shadows: event.messageType == MessageTypes.Text
? null
: textShadows,
),
), ),
), ),
), ),