mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-17 18:49:55 +08:00

With a FAB, flushbar's snackbar is just too difficult to press. We're reverting to the classic Scaffold and making sure we're calling it with the correct context. https://github.com/AndreHaueisen/flushbar/issues/64
42 lines
1.0 KiB
Dart
42 lines
1.0 KiB
Dart
import 'package:fimber/fimber.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:package_info/package_info.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;
|
|
}
|
|
|
|
SnackBar buildUndoDeleteSnackbar(BuildContext context, Note deletedNote) {
|
|
return SnackBar(
|
|
content: const Text('Note Deleted'),
|
|
action: SnackBarAction(
|
|
label: "Undo",
|
|
onPressed: () {
|
|
Fimber.d("Undoing delete");
|
|
|
|
var stateContainer = StateContainer.of(context);
|
|
stateContainer.undoRemoveNote(deletedNote);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
void showSnackbar(BuildContext context, String message) {
|
|
var snackBar = SnackBar(content: Text(message));
|
|
Scaffold.of(context).showSnackBar(snackBar);
|
|
}
|