-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading State for camera overlay capture #1918
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,6 +197,7 @@ class CameraState extends EWidgetState<Camera> with WidgetsBindingObserver { | |
bool isRecording = false; | ||
bool hasPermission = false; | ||
bool isLoading = true; | ||
bool isCropping = false; | ||
int currentModeIndex = 0; | ||
|
||
List<CameraMode> modes = []; | ||
|
@@ -510,6 +511,17 @@ class CameraState extends EWidgetState<Camera> with WidgetsBindingObserver { | |
child: widget.overlayWidget!, | ||
), | ||
), | ||
if (isCropping) | ||
Container( | ||
color: Colors.black.withOpacity(0.7), // Black background | ||
width: MediaQuery.of(context).size.width, // Full screen width | ||
height: MediaQuery.of(context).size.height, // Full screen height | ||
child: Center( | ||
child: CircularProgressIndicator( | ||
color: Colors.white, // Optional: Change the color of the progress indicator | ||
), | ||
), | ||
), | ||
imagePreviewButton(), | ||
Align( | ||
alignment: Alignment.bottomCenter, | ||
|
@@ -1027,10 +1039,17 @@ class CameraState extends EWidgetState<Camera> with WidgetsBindingObserver { | |
} | ||
} else { | ||
if (widget._controller.captureOverlay) { | ||
setState(() { | ||
isCropping = true; | ||
}); | ||
try { | ||
file = await takeOverlayCapture(); | ||
} on Exception catch (e) { | ||
print(e); | ||
} finally { | ||
setState(() { | ||
isCropping = false; | ||
}); | ||
Comment on lines
+1042
to
+1052
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. based on the video in PR, this is taking too much time, is there a way to optimize this? maybe doing a something in background, please checkout why its taking that much time, we can push this for now, but there should be way to optimize take There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually there's image encoding decoding going on there and also file reading too |
||
} | ||
} else { | ||
file = await takePicture(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we allow user to build his own loading indicator? if loading widget is not defined we can use this as default, but user should have the option to define his own widget for customization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can have custom widget.