mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-13 04:57:37 +02:00
fix: Add toast service to simplify creation of toasts
This commit is contained in:
@ -2,16 +2,16 @@ import 'dart:io';
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppSelectorViewModel extends BaseViewModel {
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final List<ApplicationWithIcon> apps = [];
|
||||
bool noApps = false;
|
||||
|
||||
@ -61,14 +61,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
context,
|
||||
'appSelectorView.errorMessage',
|
||||
),
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.CENTER,
|
||||
);
|
||||
_toast.show('appSelectorView.errorMessage');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user