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