Skip to content

Commit 3955859

Browse files
committed
use stack instead of visibility
1 parent 6fa8a56 commit 3955859

File tree

1 file changed

+67
-64
lines changed
  • app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules

1 file changed

+67
-64
lines changed

app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -218,71 +218,74 @@ class _BrowserViewState extends ConsumerState<BrowserView>
218218
},
219219
);
220220

221-
return Visibility(
222-
visible: hasTab,
223-
maintainState: true,
224-
replacement: SizedBox.expand(child: Container(color: Colors.grey[800])),
225-
child: GeckoView(
226-
preInitializationStep: () async {
227-
await ref
228-
.read(eventServiceProvider)
229-
.viewReadyStateEvents
230-
.firstWhere((state) => state == true)
231-
.timeout(
232-
const Duration(seconds: 3),
233-
onTimeout: () {
234-
logger.e(
235-
'Browser fragement not reported ready, trying to intitialize anyways',
236-
);
237-
return true;
238-
},
239-
);
240-
},
241-
postInitializationStep: () async {
242-
await widget.postInitializationStep?.call();
243-
244-
if (!initializationCompleter.isCompleted) {
245-
const quickActions = QuickActions();
246-
247-
//Debounce: https://github.com/flutter/flutter/issues/131121
248-
DateTime? lastAction;
249-
await quickActions.initialize((type) async {
250-
if (lastAction == null ||
251-
DateTime.now().difference(lastAction!) >
252-
const Duration(seconds: 5)) {
253-
if (type == 'new_tab') {
254-
lastAction = DateTime.now();
255-
256-
final router = await ref.read(routerProvider.future);
257-
const route = SearchRoute(tabType: TabType.regular);
258-
259-
await router.push(route.location);
260-
} else if (type == 'new_private_tab') {
261-
lastAction = DateTime.now();
262-
263-
final router = await ref.read(routerProvider.future);
264-
const route = SearchRoute(tabType: TabType.private);
265-
266-
await router.push(route.location);
267-
} else {
268-
throw UnimplementedError();
221+
return Stack(
222+
children: [
223+
GeckoView(
224+
preInitializationStep: () async {
225+
await ref
226+
.read(eventServiceProvider)
227+
.viewReadyStateEvents
228+
.firstWhere((state) => state == true)
229+
.timeout(
230+
const Duration(seconds: 3),
231+
onTimeout: () {
232+
logger.e(
233+
'Browser fragement not reported ready, trying to intitialize anyways',
234+
);
235+
return true;
236+
},
237+
);
238+
},
239+
postInitializationStep: () async {
240+
await widget.postInitializationStep?.call();
241+
242+
if (!initializationCompleter.isCompleted) {
243+
const quickActions = QuickActions();
244+
245+
//Debounce: https://github.com/flutter/flutter/issues/131121
246+
DateTime? lastAction;
247+
await quickActions.initialize((type) async {
248+
if (lastAction == null ||
249+
DateTime.now().difference(lastAction!) >
250+
const Duration(seconds: 5)) {
251+
if (type == 'new_tab') {
252+
lastAction = DateTime.now();
253+
254+
final router = await ref.read(routerProvider.future);
255+
const route = SearchRoute(tabType: TabType.regular);
256+
257+
await router.push(route.location);
258+
} else if (type == 'new_private_tab') {
259+
lastAction = DateTime.now();
260+
261+
final router = await ref.read(routerProvider.future);
262+
const route = SearchRoute(tabType: TabType.private);
263+
264+
await router.push(route.location);
265+
} else {
266+
throw UnimplementedError();
267+
}
269268
}
270-
}
271-
});
272-
273-
await quickActions.setShortcutItems([
274-
//TODO: add icons
275-
const ShortcutItem(type: 'new_tab', localizedTitle: 'New Tab'),
276-
const ShortcutItem(
277-
type: 'new_private_tab',
278-
localizedTitle: 'New Private Tab',
279-
),
280-
]);
281-
282-
initializationCompleter.complete();
283-
}
284-
},
285-
),
269+
});
270+
271+
await quickActions.setShortcutItems([
272+
//TODO: add icons
273+
const ShortcutItem(type: 'new_tab', localizedTitle: 'New Tab'),
274+
const ShortcutItem(
275+
type: 'new_private_tab',
276+
localizedTitle: 'New Private Tab',
277+
),
278+
]);
279+
280+
initializationCompleter.complete();
281+
}
282+
},
283+
),
284+
if (!hasTab)
285+
Positioned.fill(
286+
child: SizedBox.expand(child: Container(color: Colors.grey[800])),
287+
),
288+
],
286289
);
287290
}
288291

0 commit comments

Comments
 (0)