dart format

This commit is contained in:
Fabian Freund
2026-03-23 11:14:20 +01:00
parent b9669635d9
commit 182bfe3d72
11 changed files with 163 additions and 154 deletions
@@ -159,13 +159,11 @@ class _BrowserViewState extends ConsumerState<BrowserView>
data: (androidInfo) {
if (androidInfo == null) {
// Not Android, always show GeckoView based on route
return topRoute is GoRoute &&
topRoute.name == BrowserRoute.name;
return topRoute is GoRoute && topRoute.name == BrowserRoute.name;
}
// Android: only apply visibility fix on Android 12 and lower (API <= 31)
if (androidInfo.sdkInt <= 31) {
return topRoute is GoRoute &&
topRoute.name == BrowserRoute.name;
return topRoute is GoRoute && topRoute.name == BrowserRoute.name;
}
// Android 13+: always show GeckoView
return true;
@@ -72,9 +72,7 @@ class FontSizeBottomSheet extends ConsumerWidget {
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Card(
color: Theme.of(context)
.colorScheme
.surfaceContainerHighest,
color: Theme.of(context).colorScheme.surfaceContainerHighest,
child: Padding(
padding: const EdgeInsets.all(12),
child: Row(
@@ -101,11 +101,16 @@ class TabDao extends DatabaseAccessor<TabDatabase> with $TabDaoMixin {
..orderBy([(t) => OrderingTerm.desc(t.timestamp)]);
}
Selectable<TabData> getContainerTabsFifo(String? containerId, {int limit = 25}) {
Selectable<TabData> getContainerTabsFifo(
String? containerId, {
int limit = 25,
}) {
return select(db.tab)
..where((t) => containerId != null
? t.containerId.equals(containerId)
: t.containerId.isNull())
..where(
(t) => containerId != null
? t.containerId.equals(containerId)
: t.containerId.isNull(),
)
..limit(limit)
..orderBy([(t) => OrderingTerm.desc(t.timestamp)]);
}
@@ -18,7 +18,4 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
enum OnboardingMode {
express,
detailed,
}
enum OnboardingMode { express, detailed }
@@ -82,10 +82,11 @@ class AiConfigurationPage extends HookConsumerWidget {
children: [
TextSpan(
text: 'Things to keep in mind\n\n',
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
color: Theme.of(context).colorScheme.onError,
fontWeight: FontWeight.w600,
),
style: Theme.of(context).textTheme.headlineSmall
?.copyWith(
color: Theme.of(context).colorScheme.onError,
fontWeight: FontWeight.w600,
),
),
const TextSpan(text: ''),
const TextSpan(
@@ -65,115 +65,117 @@ class DefaultSearchPage extends HookConsumerWidget {
return BrowserPage(
child: BrowserPageContent(
child: bangs.when(
skipLoadingOnReload: true,
data: (availableBangs) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 24),
Center(
child: Text('Search', style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 24),
const ListTile(
title: Text('Default Search Provider'),
leading: Icon(MdiIcons.cloudSearch),
contentPadding: EdgeInsets.zero,
),
if (activeBang != null)
Align(
alignment: Alignment.centerLeft,
child: FilterChip(
showCheckmark: false,
label: Text(activeBang.websiteName),
avatar: UrlIcon([activeBang.getDefaultUrl()], iconSize: 20),
selected: true,
onSelected: (value) {},
),
skipLoadingOnReload: true,
data: (availableBangs) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 24),
Center(
child: Text('Search', style: theme.textTheme.headlineMedium),
),
const Divider(),
Wrap(
spacing: 8.0,
children: [
...availableBangs.map(
(bang) => FilterChip(
const SizedBox(height: 24),
const ListTile(
title: Text('Default Search Provider'),
leading: Icon(MdiIcons.cloudSearch),
contentPadding: EdgeInsets.zero,
),
if (activeBang != null)
Align(
alignment: Alignment.centerLeft,
child: FilterChip(
showCheckmark: false,
label: Text(bang.websiteName),
avatar: UrlIcon([bang.getDefaultUrl()], iconSize: 20),
selected: activeBang?.trigger == bang.trigger,
onSelected: (selected) async {
if (selected) {
await updateSearchProvider(bang.toKey());
label: Text(activeBang.websiteName),
avatar: UrlIcon([
activeBang.getDefaultUrl(),
], iconSize: 20),
selected: true,
onSelected: (value) {},
),
),
const Divider(),
Wrap(
spacing: 8.0,
children: [
...availableBangs.map(
(bang) => FilterChip(
showCheckmark: false,
label: Text(bang.websiteName),
avatar: UrlIcon([bang.getDefaultUrl()], iconSize: 20),
selected: activeBang?.trigger == bang.trigger,
onSelected: (selected) async {
if (selected) {
await updateSearchProvider(bang.toKey());
}
},
),
),
ActionChip(
label: const Text('Search more'),
avatar: const Icon(Icons.search),
onPressed: () async {
final trigger = await const BangSearchRoute()
.push<BangKey?>(context);
if (trigger != null) {
await updateSearchProvider(trigger);
}
},
),
),
ActionChip(
label: const Text('Search more'),
avatar: const Icon(Icons.search),
onPressed: () async {
final trigger = await const BangSearchRoute()
.push<BangKey?>(context);
if (trigger != null) {
await updateSearchProvider(trigger);
}
},
),
],
),
const SizedBox(height: 24),
const ListTile(
title: Text('Default Autocomplete Provider'),
leading: Icon(MdiIcons.weatherCloudyArrowRight),
contentPadding: EdgeInsets.zero,
),
DropdownMenu<SearchSuggestionProviders>(
initialSelection: activeAutosuggest,
inputDecorationTheme: InputDecorationTheme(
prefixIconConstraints: BoxConstraints.tight(
const Size.square(24),
),
],
),
width: double.infinity,
leadingIcon: activeAutosuggest.relatedBang.mapNotNull(
(trigger) => BangIcon(trigger: trigger),
const SizedBox(height: 24),
const ListTile(
title: Text('Default Autocomplete Provider'),
leading: Icon(MdiIcons.weatherCloudyArrowRight),
contentPadding: EdgeInsets.zero,
),
dropdownMenuEntries: SearchSuggestionProviders.values.map((
provider,
) {
return DropdownMenuEntry(
value: provider,
label: provider.label,
leadingIcon: provider.relatedBang.mapNotNull(
(trigger) => BangIcon(trigger: trigger),
DropdownMenu<SearchSuggestionProviders>(
initialSelection: activeAutosuggest,
inputDecorationTheme: InputDecorationTheme(
prefixIconConstraints: BoxConstraints.tight(
const Size.square(24),
),
);
}).toList(),
onSelected: (value) async {
if (value != null) {
await ref
.read(saveGeneralSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.defaultSearchSuggestionsProvider(value),
);
}
},
),
],
);
},
error: (error, stackTrace) => Center(
child: FailureWidget(
title: 'Could not load search engines',
exception: error,
onRetry: () =>
ref.refresh(bangListProvider(triggers: defaultBangs)),
),
width: double.infinity,
leadingIcon: activeAutosuggest.relatedBang.mapNotNull(
(trigger) => BangIcon(trigger: trigger),
),
dropdownMenuEntries: SearchSuggestionProviders.values.map((
provider,
) {
return DropdownMenuEntry(
value: provider,
label: provider.label,
leadingIcon: provider.relatedBang.mapNotNull(
(trigger) => BangIcon(trigger: trigger),
),
);
}).toList(),
onSelected: (value) async {
if (value != null) {
await ref
.read(saveGeneralSettingsControllerProvider.notifier)
.save(
(currentSettings) => currentSettings.copyWith
.defaultSearchSuggestionsProvider(value),
);
}
},
),
],
);
},
error: (error, stackTrace) => Center(
child: FailureWidget(
title: 'Could not load search engines',
exception: error,
onRetry: () =>
ref.refresh(bangListProvider(triggers: defaultBangs)),
),
),
loading: () => const SizedBox(height: 48, width: double.infinity),
),
loading: () => const SizedBox(height: 48, width: double.infinity),
),
),
);
}
@@ -32,22 +32,22 @@ class DohSettingsPage extends HookConsumerWidget {
return BrowserPage(
child: BrowserPageContent(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 24),
Center(
child: Text(
'DNS over HTTPS',
style: theme.textTheme.headlineMedium,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 24),
Center(
child: Text(
'DNS over HTTPS',
style: theme.textTheme.headlineMedium,
),
),
),
const SizedBox(height: 24),
const ListTileTheme(
contentPadding: EdgeInsets.zero,
child: DohSettingsContent(),
),
],
),
const SizedBox(height: 24),
const ListTileTheme(
contentPadding: EdgeInsets.zero,
child: DohSettingsContent(),
),
],
),
),
);
}
@@ -52,7 +52,10 @@ class ToolbarLayoutPage extends HookConsumerWidget {
settings: settings,
backgroundColor: Colors.transparent,
compact: true,
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
padding: const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 8.0,
),
),
),
SliverPadding(
@@ -47,7 +47,10 @@ class UBlockOptInPage extends HookConsumerWidget implements IFormPage {
SvgPicture.asset('assets/images/ublock.svg'),
const SizedBox(height: 8),
Center(
child: Text('uBlock Origin', style: theme.textTheme.headlineMedium),
child: Text(
'uBlock Origin',
style: theme.textTheme.headlineMedium,
),
),
const SizedBox(height: 24),
const MarkdownBody(
@@ -59,19 +59,12 @@ class KagiCategories {
final rawGroups = json['groups'] as Map<String, dynamic>;
final groups = rawGroups.map(
(name, slugs) => MapEntry(
name,
(slugs as List<dynamic>).cast<String>(),
),
(name, slugs) => MapEntry(name, (slugs as List<dynamic>).cast<String>()),
);
final rawRemap = json['remap'] as Map<String, dynamic>;
final remap = rawRemap.cast<String, String>();
return KagiCategories(
categories: categories,
groups: groups,
remap: remap,
);
return KagiCategories(categories: categories, groups: groups, remap: remap);
}
}
+19 -10
View File
@@ -10,7 +10,11 @@ class BrowserPage extends ConsumerWidget {
final double bottomViewportInset;
final Widget child;
const BrowserPage({super.key, this.bottomViewportInset = 0, required this.child});
const BrowserPage({
super.key,
this.bottomViewportInset = 0,
required this.child,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -45,12 +49,20 @@ class BrowserPage extends ConsumerWidget {
Positioned(
top: -70,
left: -120,
child: _BackdropOrb(width: 400, height: 400, color: appColors.auraPurple),
child: _BackdropOrb(
width: 400,
height: 400,
color: appColors.auraPurple,
),
),
Positioned(
top: 220,
right: -150,
child: _BackdropOrb(width: 340, height: 340, color: appColors.auraGold),
child: _BackdropOrb(
width: 340,
height: 340,
color: appColors.auraGold,
),
),
Positioned(
bottom: 18,
@@ -66,7 +78,9 @@ class BrowserPage extends ConsumerWidget {
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 72, sigmaY: 72),
child: ColoredBox(color: appColors.auraTint.withValues(alpha: 0.12)),
child: ColoredBox(
color: appColors.auraTint.withValues(alpha: 0.12),
),
),
),
),
@@ -94,12 +108,7 @@ class BrowserPageContent extends StatelessWidget {
builder: (context, constraints) {
return SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.fromLTRB(
24,
32,
24,
32 + bottomViewportInset,
),
padding: EdgeInsets.fromLTRB(24, 32, 24, 32 + bottomViewportInset),
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: math.max(