Skip to content
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

feat: Replace "Save" modal with a toast notification (#474) #540

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions lib/widgets/overlay_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ class OverlayWidgetTemplate {
OverlayEntry? _overlay;
BuildContext context;
OverlayState? _overlayState;

OverlayWidgetTemplate({required this.context}) {
_overlayState = Overlay.of(context);
}

void show({required Widget widget}) {
void show({required Widget widget, Alignment alignment = Alignment.topRight, EdgeInsets? margin}) {
if (_overlay == null) {
_overlay = OverlayEntry(
// replace with your own layout
builder: (context) => ColoredBox(
color: kColorBlack.withOpacity(kOverlayBackgroundOpacity),
child: widget),
builder: (context) => Positioned(
top: margin?.top ?? 20,
right: margin?.right ?? 20,
child: Material(
color: Colors.transparent, // Ensure transparent background for the overlay
child: widget,
),
),
);
_overlayState!.insert(_overlay!);
}
Expand Down Expand Up @@ -46,8 +51,8 @@ class SavingOverlay extends StatelessWidget {
children: [
Lottie.asset(
saveCompleted ? kAssetSavedLottie : kAssetSavingLottie,
width: 100,
height: 100),
width: 40,
height: 40),
kHSpacer20,
Text(
saveCompleted ? kLabelSaved : kLabelSaving,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const kPs0o6 = EdgeInsets.only(
);
const kPh60 = EdgeInsets.symmetric(horizontal: 60);
const kPh60v60 = EdgeInsets.symmetric(vertical: 60, horizontal: 60);
const kPh40v40 = EdgeInsets.symmetric(vertical: 40, horizontal: 40);
const kPt24l4 = EdgeInsets.only(
top: 24,
left: 4.0,
Expand Down
Loading