19 lines
594 B
Dart
19 lines
594 B
Dart
// SPDX-FileCopyrightText: (C) 2024 Matyáš Caras
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
/// Shows either SnackBar on Android or Toast on iOS
|
|
Future<void> showMessage(String message, BuildContext context) async {
|
|
if (Platform.isIOS) {
|
|
await Fluttertoast.showToast(msg: message, toastLength: Toast.LENGTH_LONG);
|
|
} else {
|
|
ScaffoldMessenger.of(context).clearSnackBars();
|
|
ScaffoldMessenger.of(context)
|
|
.showSnackBar(SnackBar(content: Text(message)));
|
|
}
|
|
}
|