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