dart format project

This commit is contained in:
Fabian Freund
2026-01-01 07:48:51 +01:00
parent f7a05f57f4
commit f7f2109db7
11 changed files with 55 additions and 65 deletions
@@ -29,9 +29,7 @@ Future<bool?> showDeleteBangDialog(BuildContext context) {
return AlertDialog(
icon: const Icon(Icons.warning),
title: const Text('Delete Bang'),
content: const Text(
'Are you sure you want to delete this Bang?',
),
content: const Text('Are you sure you want to delete this Bang?'),
actions: <Widget>[
TextButton(
onPressed: () {
@@ -218,25 +218,22 @@ Stream<MlProgressData> mlProgressEvents(Ref ref) {
class MlDownloadState extends _$MlDownloadState {
@override
MlProgressData? build() {
ref.listen(
mlProgressEventsProvider,
(previous, next) {
next.whenData((progress) {
if (progress.type == MlProgressType.downloading) {
if (progress.status == MlProgressStatus.done) {
// Keep showing for 2 seconds after completion
Future.delayed(const Duration(seconds: 2), () {
if (ref.mounted && state != null && state!.id == progress.id) {
state = null;
}
});
} else {
state = progress;
}
ref.listen(mlProgressEventsProvider, (previous, next) {
next.whenData((progress) {
if (progress.type == MlProgressType.downloading) {
if (progress.status == MlProgressStatus.done) {
// Keep showing for 2 seconds after completion
Future.delayed(const Duration(seconds: 2), () {
if (ref.mounted && state != null && state!.id == progress.id) {
state = null;
}
});
} else {
state = progress;
}
});
},
);
}
});
});
return null;
}
@@ -26,9 +26,7 @@ Future<bool?> showDeleteBookmarkDialog(BuildContext context) {
return AlertDialog(
icon: const Icon(Icons.warning),
title: const Text('Delete Bookmark'),
content: const Text(
'Are you sure you want to delete this Bookmark?',
),
content: const Text('Are you sure you want to delete this Bookmark?'),
actions: <Widget>[
TextButton(
onPressed: () {
@@ -63,9 +63,7 @@ class BrowserDataService extends _$BrowserDataService {
return _service.clearDataForContext(contextId);
}
Future<void> clearContainerDataOnEngineStart(
List<String> contextIds,
) async {
Future<void> clearContainerDataOnEngineStart(List<String> contextIds) async {
if (!_onStartDeleted && contextIds.isNotEmpty) {
for (final contextId in contextIds) {
await clearDataForContext(contextId);
@@ -28,7 +28,7 @@ Future<void> showContentSelectionDialog(
required Widget title,
required TabData tabData,
required Future<void> Function(String content, String? fileName)
shareMarkdownAction,
shareMarkdownAction,
}) async {
await showDialog(
context: context,
@@ -20,27 +20,18 @@
import 'package:flutter/material.dart';
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
Future<bool?> showClearContainerDataDialog(
BuildContext context,
int tabCount,
) {
Future<bool?> showClearContainerDataDialog(BuildContext context, int tabCount) {
return showDialog<bool?>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
icon: const Icon(
MdiIcons.databaseRemove,
),
title: const Text(
'Clear Container Data?',
),
icon: const Icon(MdiIcons.databaseRemove),
title: const Text('Clear Container Data?'),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'This will clear all data for this container:',
),
const Text('This will clear all data for this container:'),
const SizedBox(height: 8),
const Text('• Cookies'),
const Text('• Site data'),
@@ -51,9 +42,7 @@ Future<bool?> showClearContainerDataDialog(
'$tabCount tab(s) will be closed and reopened fresh.',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(
context,
).colorScheme.tertiary,
color: Theme.of(context).colorScheme.tertiary,
),
),
],
@@ -26,9 +26,7 @@ Future<bool?> showEnableAiTabSuggestionsDialog(BuildContext context) {
builder: (BuildContext context) {
return AlertDialog(
icon: const Icon(MdiIcons.download),
title: const Text(
'Enable AI Tab Suggestions',
),
title: const Text('Enable AI Tab Suggestions'),
content: const Text(
'Enabling this feature may require downloading AI models. '
'The download size and progress cannot be determined in advance.\n\n'
@@ -96,8 +96,11 @@ class GridTabPreview extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final tabState = ref.watch(
tabStateWithFallbackProvider(tabId).select((asyncValue) => asyncValue.value),
final tabState =
ref.watch(
tabStateWithFallbackProvider(
tabId,
).select((asyncValue) => asyncValue.value),
) ??
TabState.$default(tabId);
@@ -256,8 +259,11 @@ class ListTabPreview extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final colorScheme = Theme.of(context).colorScheme;
final tabState = ref.watch(
tabStateWithFallbackProvider(tabId).select((asyncValue) => asyncValue.value),
final tabState =
ref.watch(
tabStateWithFallbackProvider(
tabId,
).select((asyncValue) => asyncValue.value),
) ??
TabState.$default(tabId);
@@ -172,11 +172,14 @@ class TabViewHeader extends HookConsumerWidget {
tooltip: downloadProgress != null
? 'Downloading AI models (${downloadProgress.progress.toInt()}%)'
: tabSuggestionsEnabled
? 'Disable AI tab suggestions'
: 'Enable AI tab suggestions',
? 'Disable AI tab suggestions'
: 'Enable AI tab suggestions',
onPressed: () async {
if (!tabSuggestionsEnabled) {
final result = await showEnableAiTabSuggestionsDialog(context);
final result =
await showEnableAiTabSuggestionsDialog(
context,
);
if (result == true) {
ref
@@ -275,7 +278,9 @@ class TabViewHeader extends HookConsumerWidget {
leadingIcon: const Icon(MdiIcons.closeCircle),
child: const Text('Close All Tabs'),
onPressed: () async {
final result = await showCloseAllTabsDialog(context);
final result = await showCloseAllTabsDialog(
context,
);
if (result == true) {
final container = ref.read(
@@ -302,7 +307,9 @@ class TabViewHeader extends HookConsumerWidget {
leadingIcon: const Icon(MdiIcons.incognitoCircleOff),
child: const Text('Close Private Tabs'),
onPressed: () async {
final result = await showCloseAllPrivateTabsDialog(context);
final result = await showCloseAllPrivateTabsDialog(
context,
);
if (result == true) {
final container = ref.read(
@@ -364,10 +371,11 @@ class TabViewHeader extends HookConsumerWidget {
if (!context.mounted) return;
final result = await showClearContainerDataDialog(
context,
tabs.length,
);
final result =
await showClearContainerDataDialog(
context,
tabs.length,
);
if (result == true) {
try {
@@ -121,7 +121,8 @@ class ProfileBackupScreen extends HookConsumerWidget {
onPressed: () async {
if (formKey.currentState?.validate() ?? false) {
if (!skipPasswordConfirmation.value) {
final confirmation = await showPasswordConfirmationDialog(context);
final confirmation =
await showPasswordConfirmationDialog(context);
if (confirmation != passwordTextController.text) {
if (context.mounted) {