hide toolbar on scrool
This commit is contained in:
@@ -19,6 +19,7 @@ typedef IconUpdateEvent = ({String url, Uint8List bytes});
|
||||
typedef ThumbnailEvent = ({String tabId, Uint8List? bytes});
|
||||
typedef FindResultsEvent = ({String tabId, List<FindResultState> results});
|
||||
typedef LongPressEvent = ({String tabId, HitResult hitResult});
|
||||
typedef ScrollEvent = ({String tabId, int scrollY});
|
||||
|
||||
class GeckoEventService extends GeckoStateEvents {
|
||||
// Stream controllers
|
||||
@@ -37,6 +38,7 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
final _thumbnailSubject = PublishSubject<ThumbnailEvent>();
|
||||
final _findResultsSubject = PublishSubject<FindResultsEvent>();
|
||||
final _longPressSubject = PublishSubject<LongPressEvent>();
|
||||
final _scrollEventSubject = PublishSubject<ScrollEvent>();
|
||||
|
||||
final _tabAddedSubject = PublishSubject<String>();
|
||||
|
||||
@@ -56,6 +58,7 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
Stream<ThumbnailEvent> get thumbnailEvents => _thumbnailSubject.stream;
|
||||
Stream<FindResultsEvent> get findResultsEvent => _findResultsSubject.stream;
|
||||
Stream<LongPressEvent> get longPressEvent => _longPressSubject.stream;
|
||||
Stream<ScrollEvent> get scrollEvent => _scrollEventSubject.stream;
|
||||
|
||||
Stream<String> get tabAddedStream => _tabAddedSubject.stream;
|
||||
|
||||
@@ -166,6 +169,14 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
_tabAddedSubject.addWhenMoreRecent(timestamp, null, tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
void onScrollChange(int timestamp, String tabId, int scrollY) {
|
||||
_scrollEventSubject.addWhenMoreRecent(timestamp, tabId, (
|
||||
tabId: tabId,
|
||||
scrollY: scrollY,
|
||||
));
|
||||
}
|
||||
|
||||
GeckoEventService.setUp({
|
||||
BinaryMessenger? binaryMessenger,
|
||||
String messageChannelSuffix = '',
|
||||
@@ -188,6 +199,7 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
unawaited(_thumbnailSubject.close());
|
||||
unawaited(_findResultsSubject.close());
|
||||
unawaited(_longPressSubject.close());
|
||||
unawaited(_scrollEventSubject.close());
|
||||
unawaited(_tabAddedSubject.close());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4338,6 +4338,8 @@ abstract class GeckoStateEvents {
|
||||
|
||||
void onLongPress(int timestamp, String id, HitResult hitResult);
|
||||
|
||||
void onScrollChange(int timestamp, String tabId, int scrollY);
|
||||
|
||||
static void setUp(GeckoStateEvents? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) {
|
||||
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
|
||||
{
|
||||
@@ -4750,6 +4752,37 @@ abstract class GeckoStateEvents {
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onScrollChange$messageChannelSuffix', pigeonChannelCodec,
|
||||
binaryMessenger: binaryMessenger);
|
||||
if (api == null) {
|
||||
pigeonVar_channel.setMessageHandler(null);
|
||||
} else {
|
||||
pigeonVar_channel.setMessageHandler((Object? message) async {
|
||||
assert(message != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onScrollChange was null.');
|
||||
final List<Object?> args = (message as List<Object?>?)!;
|
||||
final int? arg_timestamp = (args[0] as int?);
|
||||
assert(arg_timestamp != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onScrollChange was null, expected non-null int.');
|
||||
final String? arg_tabId = (args[1] as String?);
|
||||
assert(arg_tabId != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onScrollChange was null, expected non-null String.');
|
||||
final int? arg_scrollY = (args[2] as int?);
|
||||
assert(arg_scrollY != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onScrollChange was null, expected non-null int.');
|
||||
try {
|
||||
api.onScrollChange(arg_timestamp!, arg_tabId!, arg_scrollY!);
|
||||
return wrapResponse(empty: true);
|
||||
} on PlatformException catch (e) {
|
||||
return wrapResponse(error: e);
|
||||
} catch (e) {
|
||||
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user