- Remove flutter_local_notifications dependency from pubspec.yaml - Delete notification_service.dart file - Remove notification service references from app_service.dart and app_binding.dart - Clean up related code and dependencies
43 lines
1.2 KiB
Dart
43 lines
1.2 KiB
Dart
import 'dart:async';
|
|
import 'package:flutter/services.dart';
|
|
|
|
class FluttertoastOhos {
|
|
static const MethodChannel _channel = MethodChannel('PonnamKarthik/fluttertoast');
|
|
|
|
static Future<bool?> showToast({
|
|
required String msg,
|
|
String? length,
|
|
int? timeInSecForIosWeb,
|
|
String? gravity,
|
|
int? bgcolor,
|
|
int? textcolor,
|
|
double? fontSize,
|
|
String? fontAsset,
|
|
bool? webShowClose,
|
|
String? webBgColor,
|
|
String? webPosition,
|
|
}) async {
|
|
final Map<String, dynamic> params = <String, dynamic>{
|
|
'msg': msg,
|
|
'length': length ?? 'short',
|
|
'time': timeInSecForIosWeb ?? 1,
|
|
'gravity': gravity ?? 'bottom',
|
|
'bgcolor': bgcolor ?? 0xFF000000,
|
|
'textcolor': textcolor ?? 0xFFFFFFFF,
|
|
'fontSize': fontSize,
|
|
'fontAsset': fontAsset,
|
|
'webShowClose': webShowClose ?? false,
|
|
'webBgColor': webBgColor ?? 'linear-gradient(to right, #00b09b, #96c93d)',
|
|
'webPosition': webPosition ?? 'right',
|
|
};
|
|
|
|
bool? res = await _channel.invokeMethod('showToast', params);
|
|
return res;
|
|
}
|
|
|
|
static Future<bool?> cancel() async {
|
|
bool? res = await _channel.invokeMethod('cancel');
|
|
return res;
|
|
}
|
|
}
|