mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
* fix(appflowy_flutter): fix cover image overflow #1916 * fix(appflowy_flutter): use OverflowBox to fix #1916 * chore: fix misspelling * fix: prevent the image being overstretched --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
parent
668e1196d1
commit
972ef2149c
1 changed files with 13 additions and 8 deletions
|
@ -194,7 +194,7 @@ class _CoverImageState extends State<_CoverImage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
_buildCoverImage(context),
|
_buildCoverImage(context, widget.editorState),
|
||||||
_buildCoverOverlayButtons(context),
|
_buildCoverOverlayButtons(context),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -251,7 +251,7 @@ class _CoverImageState extends State<_CoverImage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCoverImage(BuildContext context) {
|
Widget _buildCoverImage(BuildContext context, EditorState editorState) {
|
||||||
final screenSize = MediaQuery.of(context).size;
|
final screenSize = MediaQuery.of(context).size;
|
||||||
const height = 200.0;
|
const height = 200.0;
|
||||||
final Widget coverImage;
|
final Widget coverImage;
|
||||||
|
@ -281,13 +281,18 @@ class _CoverImageState extends State<_CoverImage> {
|
||||||
coverImage = const SizedBox(); // just an empty sizebox
|
coverImage = const SizedBox(); // just an empty sizebox
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return UnconstrainedBox(
|
//OverflowBox needs to be wraped by a widget with constraints(or from its parent) first,otherwise it will occur an erorr
|
||||||
|
return SizedBox(
|
||||||
|
height: height,
|
||||||
|
child: OverflowBox(
|
||||||
|
maxWidth: screenSize.width,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.only(bottom: 10),
|
padding: const EdgeInsets.only(bottom: 10),
|
||||||
height: height,
|
height: double.infinity,
|
||||||
width: screenSize.width,
|
width: double.infinity,
|
||||||
child: coverImage,
|
child: coverImage,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue