Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SankethBK committed Oct 11, 2024
1 parent a95f0b1 commit 2302988
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/features/notes/presentation/widgets/notes_close_button.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:convert';

import 'package:dairy_app/core/utils/note_helper.dart';
import 'package:dairy_app/features/notes/presentation/bloc/notes/notes_bloc.dart';
import 'package:dairy_app/features/notes/presentation/mixins/note_helper_mixin.dart';
import 'package:dairy_app/features/notes/presentation/widgets/show_notes_close_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class NotesCloseButton extends StatelessWidget {
class NotesCloseButton extends StatelessWidget with NoteHelperMixin {
final Function() onNotesClosed;

const NotesCloseButton({Key? key, required this.onNotesClosed})
Expand Down Expand Up @@ -39,15 +39,15 @@ class NotesCloseButton extends StatelessWidget {

// calculate note hash
String noteBodyWithAssetPathsRemoved =
NoteHelper.replaceAssetPathsByAssetNames(_body);
replaceAssetPathsByAssetNames(_body);

String _hash = NoteHelper.generateHash(state.title! +
String _hash = generateHash(state.title! +
state.createdAt!.millisecondsSinceEpoch.toString() +
noteBodyWithAssetPathsRemoved +
state.tags!.join(","));

// Compare old and new hash
if (NoteHelper.areNotesIdentical(state, _hash)) {
if (areNotesIdentical(state, _hash)) {
onNotesClosed();
} else {
bool? result = await showCloseDialog(context);
Expand Down

0 comments on commit 2302988

Please sign in to comment.