Add proxy routing and sing-box support

This commit is contained in:
Fabian Freund
2026-05-22 18:16:31 +02:00
parent 51289f1266
commit a5974617aa
262 changed files with 32003 additions and 3962 deletions
@@ -23,67 +23,102 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:nullability/nullability.dart';
import 'package:weblibre/core/design/app_colors.dart';
import 'package:weblibre/core/routing/routes.dart';
import 'package:weblibre/features/settings/presentation/controllers/save_settings.dart';
import 'package:weblibre/features/settings/presentation/widgets/settings_detail.dart';
import 'package:weblibre/features/tor/domain/extensions/tor_status_x.dart';
import 'package:weblibre/features/tor/domain/services/tor_proxy.dart';
import 'package:weblibre/features/tor/presentation/screens/country_picker.dart';
import 'package:weblibre/features/user/data/models/tor_settings.dart';
import 'package:weblibre/features/user/domain/repositories/general_settings.dart';
import 'package:weblibre/features/user/domain/repositories/tor_settings.dart';
import 'package:weblibre/presentation/hooks/on_initialization.dart';
import 'package:weblibre/presentation/icons/tor_icons.dart';
import 'package:weblibre/utils/ui_helper.dart';
const List<SettingsSectionDefinition> torProxySettingsSections = [
SettingsSectionDefinition(
title: 'Service',
keywords: ['power', 'start', 'stop'],
entries: [
SettingsEntryDefinition(
title: 'Tor™ Service',
subtitle: 'Start or stop the Tor service',
keywords: ['enable', 'connect'],
child: _TorServiceTile(),
),
SettingsEntryDefinition(
title: 'Request New Identity',
subtitle: 'Use a fresh circuit for new connections',
keywords: ['circuit'],
child: _RequestNewIdentityTile(),
),
],
),
SettingsSectionDefinition(
title: 'Circumvention',
keywords: ['bridges', 'transport', 'obfs4', 'snowflake'],
entries: [
SettingsEntryDefinition(
title: 'Auto Configure Transport',
subtitle:
'Pick the right pluggable transport for your network automatically',
keywords: ['auto'],
child: _AutoConfigureTransportTile(),
),
SettingsEntryDefinition(
title: 'Transport',
subtitle:
'Choose how to reach the Tor network when not auto-configured',
keywords: ['direct', 'obfs4', 'snowflake'],
child: _TransportSection(),
),
],
),
SettingsSectionDefinition(
title: 'Country Restrictions',
keywords: ['entry', 'exit', 'country'],
entries: [
SettingsEntryDefinition(
title: 'Entry Country',
subtitle: 'Choose the country of the entry guard',
keywords: ['guard'],
child: _CountryPickerTile(role: _NodeRole.entry),
),
SettingsEntryDefinition(
title: 'Exit Country',
subtitle: 'Choose the country of the exit node',
keywords: ['exit'],
child: _CountryPickerTile(role: _NodeRole.exit),
),
],
),
SettingsSectionDefinition(
title: 'About',
keywords: ['trademark', 'legal'],
entries: [
SettingsEntryDefinition(
title: 'Trademark',
keywords: ['legal'],
child: ListTile(
leading: Icon(Icons.info_outline),
title: Text('Trademark'),
subtitle: Text(
'Tor is a trademark of The Tor Project; all rights reserved. '
'WebLibre is not endorsed or sponsored by, or affiliated with, '
'the Tor Project.',
),
isThreeLine: true,
),
),
],
),
];
class TorProxyScreen extends HookConsumerWidget {
const TorProxyScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final appColors = AppColors.of(context);
final bootstrapProgress = ref.watch(
torProxyServiceProvider.select(
(value) => value.value?.bootstrapProgress ?? 0,
),
);
final torPendingRequest = useState<bool?>(null);
ref.listen(torProxyServiceProvider, (previous, next) {
if (next.hasValue && torPendingRequest.value != null) {
if (next.requireValue.isRunning != previous?.value?.isRunning ||
next.requireValue.bootstrapProgress !=
previous?.value?.bootstrapProgress) {
if (torPendingRequest.value == true) {
if (next.requireValue.bootstrapProgress > 0) {
torPendingRequest.value = null;
}
} else {
torPendingRequest.value = null;
}
}
}
});
final torIsRunning = ref.watch(
torProxyServiceProvider.select(
(value) => value.value?.isRunning ?? false,
),
);
final torIsBootstrapped = ref.watch(
torProxyServiceProvider.select(
(value) => value.value?.bootstrapProgress == 100,
),
);
final torIsBusy =
torPendingRequest.value != null ||
bootstrapProgress > 0 && bootstrapProgress < 100;
final torSettings = ref.watch(torSettingsWithDefaultsProvider);
final showContainerUi = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.showContainerUi),
);
useOnInitialization(() async {
await ref.read(torProxyServiceProvider.notifier).requestSync();
});
@@ -97,485 +132,294 @@ class TorProxyScreen extends HookConsumerWidget {
}
});
return Scaffold(
body: Theme(
data: Theme.of(context).copyWith(
listTileTheme: ListTileTheme.of(
context,
).copyWith(iconColor: Colors.white, textColor: Colors.white),
switchTheme: SwitchTheme.of(context).copyWith(
trackColor: WidgetStateProperty.resolveWith<Color?>((
Set<WidgetState> states,
) {
if (states.isEmpty) {
return appColors.torBackgroundGrey;
}
return null; // Use the default color.
}),
trackOutlineColor: WidgetStateProperty.resolveWith<Color?>((
Set<WidgetState> states,
) {
if (states.isEmpty) {
return Colors.white;
}
return null; // Use the default color.
}),
),
radioTheme: RadioTheme.of(context).copyWith(
fillColor: WidgetStateColor.resolveWith((states) {
return Colors.white;
}),
),
checkboxTheme: CheckboxTheme.of(context).copyWith(
fillColor: WidgetStateColor.resolveWith((states) {
return Colors.white;
}),
checkColor: WidgetStateProperty.all(appColors.torPurple),
),
iconTheme: const IconThemeData(color: Colors.white),
),
child: SafeArea(
child: ColoredBox(
color: appColors.torPurple,
child: CustomScrollView(
slivers: [
SliverAppBar(
pinned: true,
title: SwitchListTile.adaptive(
inactiveThumbColor: Colors.white,
activeThumbColor: appColors.torActiveGreen,
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.contains(WidgetState.selected)) {
return const Icon(MdiIcons.axisArrowLock);
}
return null; // Use the default color.
}),
value: torPendingRequest.value ?? torIsRunning,
title: const Text('Tor™ Service'),
secondary: const Icon(MdiIcons.power),
onChanged: torIsBusy
? null
: (value) async {
if (value) {
torPendingRequest.value = true;
await ref
.read(torProxyServiceProvider.notifier)
.startOrReconfigure(
reconfigureIfRunning: false,
);
} else {
torPendingRequest.value = false;
await ref
.read(torProxyServiceProvider.notifier)
.disconnect();
}
},
),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(4 + 40 + 8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (torPendingRequest.value != false && torIsBusy)
LinearProgressIndicator(
backgroundColor: appColors.torBackgroundGrey,
color: appColors.torActiveGreen,
value: bootstrapProgress / 100,
),
Padding(
padding: const EdgeInsets.only(
top: 4.0,
right: 16,
left: 16,
bottom: 4,
),
child: SizedBox(
width: double.infinity,
child: FilledButton.icon(
onPressed:
torIsRunning &&
torIsBootstrapped &&
!torIsBusy
? () async {
await ref
.read(
torProxyServiceProvider.notifier,
)
.requestNewIdentity();
if (context.mounted) {
showInfoMessage(
context,
'Requesting new Tor identity...',
);
}
}
: null,
icon: const Icon(MdiIcons.refresh),
label: const Text('Request New Identity'),
),
),
),
],
),
),
),
SliverList.list(
children: [
const SizedBox(height: 16),
const Padding(
padding: EdgeInsets.only(left: 24.0),
child: Text(
'Routing',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
RadioGroup(
groupValue: torSettings.proxyRegularTabsMode,
onChanged: (value) async {
if (value != null) {
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.proxyRegularTabsMode(value),
);
}
},
child: Column(
children: [
if (showContainerUi)
const RadioListTile.adaptive(
value: TorRegularTabProxyMode.container,
title: Text('Container-Based Routing'),
subtitle: Text(
'Route only tabs in Tor containers through the Tor network. Private tabs remain unaffected.',
),
),
const RadioListTile.adaptive(
value: TorRegularTabProxyMode.all,
title: Text('Global Routing'),
subtitle: Text(
'Route all regular tabs through the Tor network. Private tabs remain unaffected.',
),
),
if (!showContainerUi &&
torSettings.proxyRegularTabsMode ==
TorRegularTabProxyMode.container)
const Padding(
padding: EdgeInsets.only(
left: 56,
right: 24,
top: 4,
),
child: Text(
'Container-based routing is currently active but hidden because Container UI is disabled.',
),
),
],
),
),
SwitchListTile.adaptive(
inactiveThumbColor: Colors.white,
activeThumbColor: appColors.torActiveGreen,
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.contains(WidgetState.selected)) {
return const Icon(MdiIcons.incognito);
}
return null; // Use the default color.
}),
value: torSettings.proxyPrivateTabsTor,
title: const Text('Proxy Private Tabs'),
subtitle: const Text(
'When enabled, all Private Tabs will be tunneled through Tor',
),
secondary: const Icon(MdiIcons.incognito),
onChanged: (value) async {
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.proxyPrivateTabsTor(value),
);
},
),
const SizedBox(height: 16),
const Padding(
padding: EdgeInsets.only(left: 24.0),
child: Text(
'Circumvention',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
SwitchListTile.adaptive(
inactiveThumbColor: Colors.white,
activeThumbColor: appColors.torActiveGreen,
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.contains(WidgetState.selected)) {
return const Icon(MdiIcons.arrowDecisionAuto);
}
return null; // Use the default color.
}),
value: torSettings.config == TorConnectionConfig.auto,
title: const Text('Auto Configure Transport'),
subtitle: const Text(
'From some locations, it is necessary to use a pluggable transport to connect to Tor',
),
secondary: const Icon(MdiIcons.arrowDecisionAuto),
onChanged: torIsBusy
? null
: (value) async {
await ref
.read(
saveTorSettingsControllerProvider.notifier,
)
.save(
(currentSettings) =>
currentSettings.copyWith.config(
value
? TorConnectionConfig.auto
: TorConnectionConfig.direct,
),
);
},
),
if (torSettings.config == TorConnectionConfig.auto) ...[
SwitchListTile.adaptive(
inactiveThumbColor: Colors.white,
activeThumbColor: appColors.torActiveGreen,
value: torSettings.requireBridge,
contentPadding: const EdgeInsets.only(
left: 56,
right: 24,
),
onChanged: torIsBusy
? null
: (value) async {
await ref
.read(
saveTorSettingsControllerProvider
.notifier,
)
.save(
(currentSettings) => currentSettings
.copyWith
.requireBridge(value),
);
},
title: const Text(
"I'm sure I cannot connect without a bridge",
),
),
] else ...[
RadioGroup(
groupValue: torSettings.config,
onChanged: (value) async {
if (value != null) {
await ref
.read(
saveTorSettingsControllerProvider.notifier,
)
.save(
(currentSettings) =>
currentSettings.copyWith.config(value),
);
}
},
child: Column(
children: [
RadioListTile.adaptive(
value: TorConnectionConfig.direct,
enabled: !torIsBusy,
contentPadding: const EdgeInsets.only(
left: 56,
right: 24,
),
title: const Text('Direct Connection'),
subtitle: const Text(
'The best way to connect to Tor if Tor is not blocked',
),
),
RadioListTile.adaptive(
value: TorConnectionConfig.obfs4,
enabled: !torIsBusy,
contentPadding: const EdgeInsets.only(
left: 56,
right: 24,
),
title: const Text('obfs4'),
subtitle: const Text(
'Suitable for light censorship and high bandwidth needs',
),
),
RadioListTile.adaptive(
value: TorConnectionConfig.snowflake,
enabled: !torIsBusy,
contentPadding: const EdgeInsets.only(
left: 56,
right: 24,
),
title: const Text('Snowflake'),
subtitle: const Text(
'Suitable for heavy censorship',
),
),
],
),
),
CheckboxListTile.adaptive(
value: torSettings.fetchRemoteBridges,
controlAffinity: ListTileControlAffinity.leading,
enabled:
torSettings.config != TorConnectionConfig.direct,
contentPadding: const EdgeInsets.only(
left: 56,
right: 24,
),
onChanged: torIsBusy
? null
: (value) async {
if (value != null) {
await ref
.read(
saveTorSettingsControllerProvider
.notifier,
)
.save(
(currentSettings) => currentSettings
.copyWith
.fetchRemoteBridges(value),
);
}
},
title: const Text(
"Fetch fresh Bridges before connecting",
),
),
],
const SizedBox(height: 16),
const Padding(
padding: EdgeInsets.only(left: 24.0),
child: Text(
'Country Restrictions',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
ListTile(
enabled: !torIsBusy,
leading:
torSettings.entryNodeCountry.mapNotNull(
(code) => CountryFlag.fromCountryCode(
code,
theme: const EmojiTheme(size: 28),
),
) ??
const Icon(Icons.public, color: Colors.white),
title: const Text('Entry Country'),
subtitle: Text(
torSettings.entryNodeCountry ?? 'Automatic',
),
trailing: const Icon(
MdiIcons.chevronRight,
color: Colors.white,
),
onTap: () async {
final result = await TorCountryPickerRoute(
title: 'Entry Country',
$extra: torSettings.entryNodeCountry,
).push<String>(context);
if (result == null) return;
final value = result == automaticCountry
? null
: result;
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.entryNodeCountry(value),
);
},
),
ListTile(
enabled: !torIsBusy,
leading:
torSettings.exitNodeCountry.mapNotNull(
(code) => CountryFlag.fromCountryCode(
code,
theme: const EmojiTheme(size: 28),
),
) ??
const Icon(Icons.public, color: Colors.white),
title: const Text('Exit Country'),
subtitle: Text(
torSettings.exitNodeCountry ?? 'Automatic',
),
trailing: const Icon(
MdiIcons.chevronRight,
color: Colors.white,
),
onTap: () async {
final result = await TorCountryPickerRoute(
title: 'Exit Country',
$extra: torSettings.exitNodeCountry,
).push<String>(context);
if (result == null) return;
final value = result == automaticCountry
? null
: result;
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.exitNodeCountry(value),
);
},
),
],
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.only(
top: 32.0,
right: 12.0,
left: 12.0,
bottom: 8.0,
),
child: Text(
'Tor is a trademark of The Tor Project; all rights reserved. WebLibre is not endorsed or sponsored by, or affiliated with, the Tor Project.',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontStyle: FontStyle.italic,
color: Colors.white,
),
),
),
),
],
),
),
),
),
return const SettingsDetailScaffold(
title: 'Tor™ Proxy',
subtitle:
'Onion routing, pluggable transports, bridges and country restrictions.',
icon: TorIcons.onionAlt,
sections: torProxySettingsSections,
);
}
}
class _TorServiceTile extends HookConsumerWidget {
const _TorServiceTile();
@override
Widget build(BuildContext context, WidgetRef ref) {
final status = ref.watch(
torProxyServiceProvider.select((value) => value.value),
);
final pendingRequest = useState<bool?>(null);
ref.listen(torProxyServiceProvider, (previous, next) {
if (next.hasValue && pendingRequest.value != null) {
final current = next.requireValue;
final prev = previous?.value;
if (current.isRunning != prev?.isRunning ||
current.bootstrapProgress != prev?.bootstrapProgress) {
if (pendingRequest.value == true) {
if (current.bootstrapProgress > 0) {
pendingRequest.value = null;
}
} else {
pendingRequest.value = null;
}
}
}
});
final isRunning = status?.isRunning ?? false;
final progress = status?.bootstrapProgress ?? 0;
final isBusy = pendingRequest.value != null || (status?.isBusy ?? false);
return Column(
children: [
SwitchListTile.adaptive(
secondary: const Icon(MdiIcons.power),
title: const Text('Tor™ Service'),
subtitle: const Text('Start or stop the Tor service'),
value: pendingRequest.value ?? isRunning,
onChanged: isBusy
? null
: (value) async {
if (value) {
pendingRequest.value = true;
await ref
.read(torProxyServiceProvider.notifier)
.startOrReconfigure(reconfigureIfRunning: false);
} else {
pendingRequest.value = false;
await ref
.read(torProxyServiceProvider.notifier)
.disconnect();
}
},
),
if (pendingRequest.value != false && isBusy)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: LinearProgressIndicator(value: progress / 100),
),
],
);
}
}
class _RequestNewIdentityTile extends ConsumerWidget {
const _RequestNewIdentityTile();
@override
Widget build(BuildContext context, WidgetRef ref) {
final status = ref.watch(
torProxyServiceProvider.select((value) => value.value),
);
final enabled = status?.isReady ?? false;
return ListTile(
enabled: enabled,
leading: const Icon(MdiIcons.refresh),
title: const Text('Request New Identity'),
subtitle: const Text('Use a fresh circuit for new connections'),
trailing: const Icon(Icons.chevron_right),
onTap: () async {
await ref.read(torProxyServiceProvider.notifier).requestNewIdentity();
if (context.mounted) {
showInfoMessage(context, 'Requesting new Tor identity...');
}
},
);
}
}
class _AutoConfigureTransportTile extends ConsumerWidget {
const _AutoConfigureTransportTile();
@override
Widget build(BuildContext context, WidgetRef ref) {
final torSettings = ref.watch(torSettingsWithDefaultsProvider);
final isBusy = ref.watch(
torProxyServiceProvider.select((value) => value.isBusy),
);
return Column(
children: [
SwitchListTile.adaptive(
secondary: const Icon(MdiIcons.arrowDecisionAuto),
title: const Text('Auto Configure Transport'),
subtitle: const Text(
'From some locations, it is necessary to use a pluggable transport to connect to Tor',
),
value: torSettings.config == TorConnectionConfig.auto,
onChanged: isBusy
? null
: (value) async {
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(current) => current.copyWith.config(
value
? TorConnectionConfig.auto
: TorConnectionConfig.direct,
),
);
},
),
if (torSettings.config == TorConnectionConfig.auto)
SwitchListTile.adaptive(
contentPadding: const EdgeInsets.only(left: 56, right: 24),
title: const Text("I'm sure I cannot connect without a bridge"),
value: torSettings.requireBridge,
onChanged: isBusy
? null
: (value) async {
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(current) => current.copyWith.requireBridge(value),
);
},
),
],
);
}
}
class _TransportSection extends ConsumerWidget {
const _TransportSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final torSettings = ref.watch(torSettingsWithDefaultsProvider);
final isBusy = ref.watch(
torProxyServiceProvider.select((value) => value.isBusy),
);
if (torSettings.config == TorConnectionConfig.auto) {
return const ListTile(
leading: Icon(Icons.info_outline),
title: Text('Auto-configured'),
subtitle: Text(
'Disable auto-configure above to pick a transport manually.',
),
);
}
return Column(
children: [
RadioGroup<TorConnectionConfig>(
groupValue: torSettings.config,
onChanged: (value) async {
if (value != null) {
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save((current) => current.copyWith.config(value));
}
},
child: Column(
children: [
RadioListTile<TorConnectionConfig>.adaptive(
value: TorConnectionConfig.direct,
enabled: !isBusy,
title: const Text('Direct Connection'),
subtitle: const Text(
'The best way to connect to Tor if Tor is not blocked',
),
),
RadioListTile<TorConnectionConfig>.adaptive(
value: TorConnectionConfig.obfs4,
enabled: !isBusy,
title: const Text('obfs4'),
subtitle: const Text(
'Suitable for light censorship and high bandwidth needs',
),
),
RadioListTile<TorConnectionConfig>.adaptive(
value: TorConnectionConfig.snowflake,
enabled: !isBusy,
title: const Text('Snowflake'),
subtitle: const Text('Suitable for heavy censorship'),
),
],
),
),
CheckboxListTile.adaptive(
controlAffinity: ListTileControlAffinity.leading,
enabled: !isBusy && torSettings.config != TorConnectionConfig.direct,
value: torSettings.fetchRemoteBridges,
title: const Text('Fetch fresh Bridges before connecting'),
onChanged: isBusy
? null
: (value) async {
if (value != null) {
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(current) =>
current.copyWith.fetchRemoteBridges(value),
);
}
},
),
],
);
}
}
enum _NodeRole {
entry(title: 'Entry Country'),
exit(title: 'Exit Country');
const _NodeRole({required this.title});
final String title;
}
class _CountryPickerTile extends ConsumerWidget {
const _CountryPickerTile({required this.role});
final _NodeRole role;
@override
Widget build(BuildContext context, WidgetRef ref) {
final torSettings = ref.watch(torSettingsWithDefaultsProvider);
final isBusy = ref.watch(
torProxyServiceProvider.select((value) => value.isBusy),
);
final country = switch (role) {
_NodeRole.entry => torSettings.entryNodeCountry,
_NodeRole.exit => torSettings.exitNodeCountry,
};
return ListTile(
enabled: !isBusy,
leading:
country.mapNotNull(
(code) => CountryFlag.fromCountryCode(
code,
theme: const EmojiTheme(size: 28),
),
) ??
const Icon(Icons.public),
title: Text(role.title),
subtitle: Text(country ?? 'Automatic'),
trailing: const Icon(Icons.chevron_right),
onTap: () async {
final result = await TorCountryPickerRoute(
title: role.title,
$extra: country,
).push<String>(context);
if (result == null) return;
final value = result == automaticCountry ? null : result;
await ref
.read(saveTorSettingsControllerProvider.notifier)
.save(
(current) => switch (role) {
_NodeRole.entry => current.copyWith.entryNodeCountry(value),
_NodeRole.exit => current.copyWith.exitNodeCountry(value),
},
);
},
);
}
}
@@ -21,6 +21,7 @@ import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:weblibre/core/design/app_colors.dart';
import 'package:weblibre/features/geckoview/domain/controllers/overlay.dart';
import 'package:weblibre/features/tor/domain/extensions/tor_status_x.dart';
import 'package:weblibre/features/tor/domain/services/tor_proxy.dart';
import 'package:weblibre/presentation/icons/tor_icons.dart';
import 'package:weblibre/presentation/widgets/animate_gradient_shader.dart';
@@ -33,10 +34,7 @@ class TorNotification extends HookConsumerWidget {
final appColors = AppColors.of(context);
ref.listen(torProxyServiceProvider, (previous, next) {
final status = next.value;
if (status != null &&
status.isRunning &&
status.bootstrapProgress >= 100) {
if (next.isReady) {
ref.read(overlayControllerProvider.notifier).dismiss();
}
});