setting to control modal barrier
This commit is contained in:
@@ -54,6 +54,8 @@ class BottomSheetPage<T> extends Page<T> {
|
|||||||
shape: Theme.of(context).bottomSheetTheme.shape,
|
shape: Theme.of(context).bottomSheetTheme.shape,
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
constraints: Theme.of(context).bottomSheetTheme.constraints,
|
constraints: Theme.of(context).bottomSheetTheme.constraints,
|
||||||
|
modalBarrierColor:
|
||||||
|
barrierColor ?? Theme.of(context).bottomSheetTheme.modalBarrierColor,
|
||||||
isScrollControlled: isScrollControlled,
|
isScrollControlled: isScrollControlled,
|
||||||
isDismissible: barrierDismissible,
|
isDismissible: barrierDismissible,
|
||||||
useSafeArea: useSafeArea,
|
useSafeArea: useSafeArea,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class DialogPage<T> extends Page<T> {
|
|||||||
const DialogPage({
|
const DialogPage({
|
||||||
required this.builder,
|
required this.builder,
|
||||||
this.anchorPoint,
|
this.anchorPoint,
|
||||||
this.barrierColor = Colors.black54,
|
this.barrierColor,
|
||||||
this.barrierDismissible = true,
|
this.barrierDismissible = true,
|
||||||
this.barrierLabel,
|
this.barrierLabel,
|
||||||
this.useSafeArea = true,
|
this.useSafeArea = true,
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
// Theme with dynamic snackbar margin to position above bottom toolbar
|
// Theme with dynamic snackbar margin to position above bottom toolbar
|
||||||
final themeData = Theme.of(context).copyWith(
|
final themeData = Theme.of(context).copyWith(
|
||||||
bottomSheetTheme: BottomSheetThemeData(
|
bottomSheetTheme: Theme.of(context).bottomSheetTheme.copyWith(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth:
|
maxWidth:
|
||||||
MediaQuery.of(context).size.width -
|
MediaQuery.of(context).size.width -
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ class _VisualSection extends StatelessWidget {
|
|||||||
SettingSection(name: 'Visual'),
|
SettingSection(name: 'Visual'),
|
||||||
_UiZoomSection(),
|
_UiZoomSection(),
|
||||||
_DisableAnimationsTile(),
|
_DisableAnimationsTile(),
|
||||||
|
_ShowModalBarrierTile(),
|
||||||
_ThemeSection(),
|
_ThemeSection(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -177,6 +178,34 @@ class _DisableAnimationsTile extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _ShowModalBarrierTile extends HookConsumerWidget {
|
||||||
|
const _ShowModalBarrierTile();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final showModalBarrier = ref.watch(
|
||||||
|
generalSettingsWithDefaultsProvider.select((s) => s.showModalBarrier),
|
||||||
|
);
|
||||||
|
|
||||||
|
return SwitchListTile.adaptive(
|
||||||
|
title: const Text('Show Modal Barrier'),
|
||||||
|
subtitle: const Text(
|
||||||
|
'Dim the background behind dialogs and bottom sheets',
|
||||||
|
),
|
||||||
|
secondary: const Icon(Icons.layers),
|
||||||
|
value: showModalBarrier,
|
||||||
|
onChanged: (value) async {
|
||||||
|
await ref
|
||||||
|
.read(saveGeneralSettingsControllerProvider.notifier)
|
||||||
|
.save(
|
||||||
|
(currentSettings) =>
|
||||||
|
currentSettings.copyWith.showModalBarrier(value),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class _TabBarSection extends StatelessWidget {
|
class _TabBarSection extends StatelessWidget {
|
||||||
const _TabBarSection();
|
const _TabBarSection();
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
final ThemeMode themeMode;
|
final ThemeMode themeMode;
|
||||||
final double uiScaleFactor;
|
final double uiScaleFactor;
|
||||||
final bool disableAnimations;
|
final bool disableAnimations;
|
||||||
|
final bool showModalBarrier;
|
||||||
final bool enableReadability;
|
final bool enableReadability;
|
||||||
final bool enforceReadability;
|
final bool enforceReadability;
|
||||||
final Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit;
|
final Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit;
|
||||||
@@ -119,6 +120,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
required this.themeMode,
|
required this.themeMode,
|
||||||
required this.uiScaleFactor,
|
required this.uiScaleFactor,
|
||||||
required this.disableAnimations,
|
required this.disableAnimations,
|
||||||
|
required this.showModalBarrier,
|
||||||
required this.enableReadability,
|
required this.enableReadability,
|
||||||
required this.enforceReadability,
|
required this.enforceReadability,
|
||||||
required this.deleteBrowsingDataOnQuit,
|
required this.deleteBrowsingDataOnQuit,
|
||||||
@@ -168,6 +170,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
ThemeMode? themeMode,
|
ThemeMode? themeMode,
|
||||||
double? uiScaleFactor,
|
double? uiScaleFactor,
|
||||||
bool? disableAnimations,
|
bool? disableAnimations,
|
||||||
|
bool? showModalBarrier,
|
||||||
bool? enableReadability,
|
bool? enableReadability,
|
||||||
bool? enforceReadability,
|
bool? enforceReadability,
|
||||||
this.deleteBrowsingDataOnQuit,
|
this.deleteBrowsingDataOnQuit,
|
||||||
@@ -214,6 +217,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||||
uiScaleFactor = uiScaleFactor ?? defaultUiScaleFactor,
|
uiScaleFactor = uiScaleFactor ?? defaultUiScaleFactor,
|
||||||
disableAnimations = disableAnimations ?? false,
|
disableAnimations = disableAnimations ?? false,
|
||||||
|
showModalBarrier = showModalBarrier ?? true,
|
||||||
enableReadability = enableReadability ?? true,
|
enableReadability = enableReadability ?? true,
|
||||||
enforceReadability = enforceReadability ?? false,
|
enforceReadability = enforceReadability ?? false,
|
||||||
defaultSearchProvider = defaultSearchProvider ?? _fallbackSearchProvider,
|
defaultSearchProvider = defaultSearchProvider ?? _fallbackSearchProvider,
|
||||||
@@ -293,6 +297,7 @@ class GeneralSettings with FastEquatable {
|
|||||||
themeMode,
|
themeMode,
|
||||||
uiScaleFactor,
|
uiScaleFactor,
|
||||||
disableAnimations,
|
disableAnimations,
|
||||||
|
showModalBarrier,
|
||||||
enableReadability,
|
enableReadability,
|
||||||
enforceReadability,
|
enforceReadability,
|
||||||
deleteBrowsingDataOnQuit,
|
deleteBrowsingDataOnQuit,
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ abstract class _$GeneralSettingsCWProxy {
|
|||||||
|
|
||||||
GeneralSettings disableAnimations(bool disableAnimations);
|
GeneralSettings disableAnimations(bool disableAnimations);
|
||||||
|
|
||||||
|
GeneralSettings showModalBarrier(bool showModalBarrier);
|
||||||
|
|
||||||
GeneralSettings enableReadability(bool enableReadability);
|
GeneralSettings enableReadability(bool enableReadability);
|
||||||
|
|
||||||
GeneralSettings enforceReadability(bool enforceReadability);
|
GeneralSettings enforceReadability(bool enforceReadability);
|
||||||
@@ -128,6 +130,7 @@ abstract class _$GeneralSettingsCWProxy {
|
|||||||
ThemeMode themeMode,
|
ThemeMode themeMode,
|
||||||
double uiScaleFactor,
|
double uiScaleFactor,
|
||||||
bool disableAnimations,
|
bool disableAnimations,
|
||||||
|
bool showModalBarrier,
|
||||||
bool enableReadability,
|
bool enableReadability,
|
||||||
bool enforceReadability,
|
bool enforceReadability,
|
||||||
Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit,
|
Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit,
|
||||||
@@ -192,6 +195,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
|||||||
GeneralSettings disableAnimations(bool disableAnimations) =>
|
GeneralSettings disableAnimations(bool disableAnimations) =>
|
||||||
call(disableAnimations: disableAnimations);
|
call(disableAnimations: disableAnimations);
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneralSettings showModalBarrier(bool showModalBarrier) =>
|
||||||
|
call(showModalBarrier: showModalBarrier);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
GeneralSettings enableReadability(bool enableReadability) =>
|
GeneralSettings enableReadability(bool enableReadability) =>
|
||||||
call(enableReadability: enableReadability);
|
call(enableReadability: enableReadability);
|
||||||
@@ -389,6 +396,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
|||||||
Object? themeMode = const $CopyWithPlaceholder(),
|
Object? themeMode = const $CopyWithPlaceholder(),
|
||||||
Object? uiScaleFactor = const $CopyWithPlaceholder(),
|
Object? uiScaleFactor = const $CopyWithPlaceholder(),
|
||||||
Object? disableAnimations = const $CopyWithPlaceholder(),
|
Object? disableAnimations = const $CopyWithPlaceholder(),
|
||||||
|
Object? showModalBarrier = const $CopyWithPlaceholder(),
|
||||||
Object? enableReadability = const $CopyWithPlaceholder(),
|
Object? enableReadability = const $CopyWithPlaceholder(),
|
||||||
Object? enforceReadability = const $CopyWithPlaceholder(),
|
Object? enforceReadability = const $CopyWithPlaceholder(),
|
||||||
Object? deleteBrowsingDataOnQuit = const $CopyWithPlaceholder(),
|
Object? deleteBrowsingDataOnQuit = const $CopyWithPlaceholder(),
|
||||||
@@ -450,6 +458,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
|||||||
? _value.disableAnimations
|
? _value.disableAnimations
|
||||||
// ignore: cast_nullable_to_non_nullable
|
// ignore: cast_nullable_to_non_nullable
|
||||||
: disableAnimations as bool,
|
: disableAnimations as bool,
|
||||||
|
showModalBarrier:
|
||||||
|
showModalBarrier == const $CopyWithPlaceholder() ||
|
||||||
|
showModalBarrier == null
|
||||||
|
? _value.showModalBarrier
|
||||||
|
// ignore: cast_nullable_to_non_nullable
|
||||||
|
: showModalBarrier as bool,
|
||||||
enableReadability:
|
enableReadability:
|
||||||
enableReadability == const $CopyWithPlaceholder() ||
|
enableReadability == const $CopyWithPlaceholder() ||
|
||||||
enableReadability == null
|
enableReadability == null
|
||||||
@@ -726,6 +740,7 @@ GeneralSettings _$GeneralSettingsFromJson(
|
|||||||
themeMode: $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']),
|
themeMode: $enumDecodeNullable(_$ThemeModeEnumMap, json['themeMode']),
|
||||||
uiScaleFactor: (json['uiScaleFactor'] as num?)?.toDouble(),
|
uiScaleFactor: (json['uiScaleFactor'] as num?)?.toDouble(),
|
||||||
disableAnimations: json['disableAnimations'] as bool?,
|
disableAnimations: json['disableAnimations'] as bool?,
|
||||||
|
showModalBarrier: json['showModalBarrier'] as bool?,
|
||||||
enableReadability: json['enableReadability'] as bool?,
|
enableReadability: json['enableReadability'] as bool?,
|
||||||
enforceReadability: json['enforceReadability'] as bool?,
|
enforceReadability: json['enforceReadability'] as bool?,
|
||||||
deleteBrowsingDataOnQuit: (json['deleteBrowsingDataOnQuit'] as List<dynamic>?)
|
deleteBrowsingDataOnQuit: (json['deleteBrowsingDataOnQuit'] as List<dynamic>?)
|
||||||
@@ -815,6 +830,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
|
|||||||
'themeMode': _$ThemeModeEnumMap[instance.themeMode]!,
|
'themeMode': _$ThemeModeEnumMap[instance.themeMode]!,
|
||||||
'uiScaleFactor': instance.uiScaleFactor,
|
'uiScaleFactor': instance.uiScaleFactor,
|
||||||
'disableAnimations': instance.disableAnimations,
|
'disableAnimations': instance.disableAnimations,
|
||||||
|
'showModalBarrier': instance.showModalBarrier,
|
||||||
'enableReadability': instance.enableReadability,
|
'enableReadability': instance.enableReadability,
|
||||||
'enforceReadability': instance.enforceReadability,
|
'enforceReadability': instance.enforceReadability,
|
||||||
'deleteBrowsingDataOnQuit': instance.deleteBrowsingDataOnQuit
|
'deleteBrowsingDataOnQuit': instance.deleteBrowsingDataOnQuit
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
|||||||
DriftSqlType.bool,
|
DriftSqlType.bool,
|
||||||
db.typeMapping,
|
db.typeMapping,
|
||||||
),
|
),
|
||||||
|
'showModalBarrier': settings['showModalBarrier']?.readAs(
|
||||||
|
DriftSqlType.bool,
|
||||||
|
db.typeMapping,
|
||||||
|
),
|
||||||
'enableReadability': settings['enableReadability']?.readAs(
|
'enableReadability': settings['enableReadability']?.readAs(
|
||||||
DriftSqlType.bool,
|
DriftSqlType.bool,
|
||||||
db.typeMapping,
|
db.typeMapping,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ final class GeneralSettingsRepositoryProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$generalSettingsRepositoryHash() =>
|
String _$generalSettingsRepositoryHash() =>
|
||||||
r'12e49ad38ff25c6bad1680b3eb3a01274ebfb35f';
|
r'7a30fefa2cdc934232e08e8809c62a83e99635fd';
|
||||||
|
|
||||||
abstract class _$GeneralSettingsRepository
|
abstract class _$GeneralSettingsRepository
|
||||||
extends $StreamNotifier<GeneralSettings> {
|
extends $StreamNotifier<GeneralSettings> {
|
||||||
|
|||||||
@@ -163,6 +163,11 @@ class _MainWidget extends HookConsumerWidget {
|
|||||||
(value) => value.disableAnimations,
|
(value) => value.disableAnimations,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
final showModalBarrier = ref.watch(
|
||||||
|
generalSettingsWithDefaultsProvider.select(
|
||||||
|
(value) => value.showModalBarrier,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
useOnInitialization(() async {
|
useOnInitialization(() async {
|
||||||
await CountryCodes.init();
|
await CountryCodes.init();
|
||||||
@@ -286,6 +291,12 @@ class _MainWidget extends HookConsumerWidget {
|
|||||||
pageTransitionsTheme: disableAnimations
|
pageTransitionsTheme: disableAnimations
|
||||||
? _noAnimationPageTransitionsTheme
|
? _noAnimationPageTransitionsTheme
|
||||||
: null,
|
: null,
|
||||||
|
dialogTheme: DialogThemeData(
|
||||||
|
barrierColor: showModalBarrier ? null : Colors.transparent,
|
||||||
|
),
|
||||||
|
bottomSheetTheme: BottomSheetThemeData(
|
||||||
|
modalBarrierColor: showModalBarrier ? null : Colors.transparent,
|
||||||
|
),
|
||||||
extensions: const <ThemeExtension<dynamic>>[AppColors.light],
|
extensions: const <ThemeExtension<dynamic>>[AppColors.light],
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData(
|
darkTheme: ThemeData(
|
||||||
@@ -294,6 +305,12 @@ class _MainWidget extends HookConsumerWidget {
|
|||||||
pageTransitionsTheme: disableAnimations
|
pageTransitionsTheme: disableAnimations
|
||||||
? _noAnimationPageTransitionsTheme
|
? _noAnimationPageTransitionsTheme
|
||||||
: null,
|
: null,
|
||||||
|
dialogTheme: DialogThemeData(
|
||||||
|
barrierColor: showModalBarrier ? null : Colors.transparent,
|
||||||
|
),
|
||||||
|
bottomSheetTheme: BottomSheetThemeData(
|
||||||
|
modalBarrierColor: showModalBarrier ? null : Colors.transparent,
|
||||||
|
),
|
||||||
extensions: const <ThemeExtension<dynamic>>[AppColors.dark],
|
extensions: const <ThemeExtension<dynamic>>[AppColors.dark],
|
||||||
),
|
),
|
||||||
themeMode: themeMode,
|
themeMode: themeMode,
|
||||||
|
|||||||
Reference in New Issue
Block a user