Hotfix center identity creator loading

This commit is contained in:
DatDang
2024-08-22 16:44:42 +07:00
committed by Dat H. Pham
parent 688f90875c
commit 150b4607d5
2 changed files with 131 additions and 141 deletions
@@ -42,15 +42,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController>
@override
Widget build(BuildContext context) {
Widget bodyCreatorView = NotificationListener<ScrollNotification>(
onNotification: (scrollInfo) {
if (scrollInfo is ScrollEndNotification &&
scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent) {
controller.clearFocusEditor(context);
}
return false;
},
child: SingleChildScrollView(
Widget bodyCreatorView = SingleChildScrollView(
controller: controller.scrollController,
physics: const ClampingScrollPhysics(),
child: Padding(
@@ -122,6 +114,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController>
LayoutBuilder(
builder: (context, constraintsEditor) {
return Stack(
alignment: Alignment.center,
children: [
Container(
decoration: BoxDecoration(
@@ -152,6 +145,11 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController>
)
),
);
}),
Obx(() {
bool isInserting = controller.publicAssetController?.isUploading.isTrue == true
|| controller.isCompressingInlineImage.isTrue;
return InsertImageLoadingIndicator(isInserting: isInserting);
})
],
);
@@ -162,10 +160,20 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController>
_buildActionButtonMobile(context)
]),
),
),
);
if (PlatformInfo.isWeb) {
bodyCreatorView = NotificationListener<ScrollNotification>(
onNotification: (scrollInfo) {
if (scrollInfo is ScrollEndNotification &&
scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent) {
controller.clearFocusEditor(context);
}
return false;
},
child: bodyCreatorView,
);
return PointerInterceptor(
child: GestureDetector(
onTap: () => controller.clearFocusEditor(context),
@@ -464,34 +472,16 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController>
),
]
),
Stack(
children: [
_buildHtmlEditorWeb(
context,
controller.contentHtmlEditor,
maxWidth),
Obx(() {
bool isInserting = controller.publicAssetController?.isUploading.isTrue == true
|| controller.isCompressingInlineImage.isTrue;
return InsertImageLoadingIndicator(isInserting: isInserting);
})
]
),
],
);
} else {
return Stack(
children: [
_buildHtmlEditor(
return _buildHtmlEditor(
context,
initialContent: controller.contentHtmlEditor),
Obx(() {
bool isInserting = controller.publicAssetController?.isUploading.isTrue == true
|| controller.isCompressingInlineImage.isTrue;
return InsertImageLoadingIndicator(isInserting: isInserting);
})
]
);
initialContent: controller.contentHtmlEditor);
}
}
@@ -15,7 +15,7 @@ class InsertImageLoadingIndicator extends StatelessWidget {
Widget build(BuildContext context) {
if (isInserting) {
return const Align(
alignment: Alignment.topCenter,
alignment: Alignment.center,
child: CircularProgressIndicator(
color: AppColor.primaryColor
)