Files
GitJournal/lib/utils.dart
Vishesh Handa 3f40a2992a Add the concept of Editors
* We no longer have a separate editing and browsing view - This does
mean we loose the ability to quick flip between notes by swiping.
However, this is more how a note editor would behave. I do later want to
add that capability back.

* We have 2 editors for now - Markdown and Raw. By default we use the
Markdown editor which can be toggled between Preview / Edit mode.

I later want to add a rich text editor and a todo editor as well.
2020-01-29 00:04:24 +01:00

54 lines
1.2 KiB
Dart

import 'package:fimber/fimber.dart';
import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';
import 'package:flushbar/flushbar.dart';
import 'app.dart';
import 'core/note.dart';
import 'state_container.dart';
Future<String> getVersionString() async {
var info = await PackageInfo.fromPlatform();
var versionText = "";
if (info != null) {
versionText = info.appName + " " + info.version + "+" + info.buildNumber;
if (JournalApp.isInDebugMode) {
versionText += " (Debug)";
}
}
return versionText;
}
void showUndoDeleteSnackbar(
BuildContext context,
StateContainerState stateContainer,
Note deletedNote,
) {
var theme = Theme.of(context);
Flushbar(
message: "Note Deleted",
duration: const Duration(seconds: 3),
mainButton: FlatButton(
child: Text(
"Undo",
style: TextStyle(color: theme.accentColor),
),
onPressed: () {
Fimber.d("Undoing delete");
stateContainer.undoRemoveNote(deletedNote);
},
),
).show(context);
}
void showSnackbar(BuildContext context, String message) {
Flushbar(
message: message,
duration: const Duration(seconds: 3),
).show(context);
}