openBubble method
void
openBubble({})
Start Bubble service and show the bubble, hiding the app, with optional
topText
, middleText
, bottomText
,
topTextColor
, middleTextColor
, bottomTextColor
,
backgroundColor
, topIconAsset
, bottomIconAsset
and callback
Implementation
void openBubble({
String topText = '',
String middleText = '',
String bottomText = '',
String topTextColor = '#000000',
String middleTextColor = '#000000',
String bottomTextColor = '#000000',
String backgroundColor = '#ffffff',
String? topIconAsset,
String? bottomIconAsset,
Timer? callback,
}) async {
var bytesTop = topIconAsset == null
? null
: (await rootBundle.load(topIconAsset)).buffer.asUint8List();
var bytesBottom = bottomIconAsset == null
? null
: (await rootBundle.load(bottomIconAsset)).buffer.asUint8List();
_platform.invokeMethod('openBubble', [
topText,
middleText,
bottomText,
topTextColor,
middleTextColor,
bottomTextColor,
backgroundColor,
bytesTop,
bytesBottom,
]);
setCallback(callback);
///Creates [_timer] to check periodically if
///bubble [isOpen] if Service is bounded, [true] if bounded,
///[false] otherwise
_timer = Timer.periodic(Duration(seconds: 1), (timer) async {
_isOpen = await _platform.invokeMethod('isBubbleOpen') ?? false;
if (!_isOpen) {
timer.cancel();
}
});
}