added landing page

This commit is contained in:
Fabian Freund
2024-06-03 01:02:57 +02:00
parent 406db9c170
commit 7525bac5c0
7 changed files with 197 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
../../../CHANGELOG.md
+13
View File
@@ -0,0 +1,13 @@
Welcome to Bang Navigator, a privacy-centric search and research browser designed to enhance your mobile search experience while ensuring your personal data and identity remains secure during research. Bang Navigator offers a seamless and intuitive interface, integrating the powerful tools of Kagi Search Engine.
Bang Navigator is packed with a variety of features aimed at improving usability and maintaining privacy:
- **Privacy by Default**: Incognito mode is enabled by default to keep your searches and browsing history private.
- **Full Browser Functionality**: Includes all the essential features of a basic browser to browse the web efficiently.
- **Kagi Integration**: Seamlessly integrates Kagi's search, assistant, and summarizer tools within a user-friendly interface.
- **Easy Sharing**: Share URLs or text from any app directly into Bang Navigator without the need to copy and paste, for direct use with summarizer/assistant.
- **Quick Summarization**: Long press any link on a website to get a summary via Kagi's summarizer.
- **Enhanced Text Interaction**: Custom context menu allows for easy passage of marked text to Kagi's search or assistant tools.
- **Home Widget**: Includes a home screen widget for quick actions, enhancing productivity.
- **Speech Input**: Supports voice commands for hands-free operation and accessibility.
- **PDF processing**: Open and directly summarize/prompt PDF documents.
@@ -6,6 +6,7 @@ import 'package:bang_navigator/features/search_browser/domain/providers.dart';
import 'package:bang_navigator/features/search_browser/domain/services/create_tab.dart'; import 'package:bang_navigator/features/search_browser/domain/services/create_tab.dart';
import 'package:bang_navigator/features/search_browser/domain/services/session.dart'; import 'package:bang_navigator/features/search_browser/domain/services/session.dart';
import 'package:bang_navigator/features/search_browser/presentation/widgets/app_bar_title.dart'; import 'package:bang_navigator/features/search_browser/presentation/widgets/app_bar_title.dart';
import 'package:bang_navigator/features/search_browser/presentation/widgets/landing/content.dart';
import 'package:bang_navigator/features/search_browser/presentation/widgets/sheets/shared_content_sheet.dart'; import 'package:bang_navigator/features/search_browser/presentation/widgets/sheets/shared_content_sheet.dart';
import 'package:bang_navigator/features/search_browser/presentation/widgets/sheets/view_tabs_sheet.dart'; import 'package:bang_navigator/features/search_browser/presentation/widgets/sheets/view_tabs_sheet.dart';
import 'package:bang_navigator/features/search_browser/presentation/widgets/tabs_action_button.dart'; import 'package:bang_navigator/features/search_browser/presentation/widgets/tabs_action_button.dart';
@@ -306,10 +307,11 @@ class KagiScreen extends HookConsumerWidget {
), ),
index: (activeWebView != null) index: (activeWebView != null)
? webViews.keys ? webViews.keys
.toList() .toList()
.indexOf(activeWebView.page.value.key) .indexOf(activeWebView.page.value.key) +
: null, 1
children: webViews.values.toList(), : 0,
children: [const LandingContent(), ...webViews.values],
), ),
); );
}, },
@@ -0,0 +1,93 @@
import 'package:bang_navigator/core/routing/routes.dart';
import 'package:bang_navigator/features/search_browser/domain/entities/modes.dart';
import 'package:bang_navigator/features/search_browser/domain/entities/sheet.dart';
import 'package:bang_navigator/features/search_browser/domain/services/create_tab.dart';
import 'package:bang_navigator/features/settings/data/repositories/settings_repository.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
class LandingAction extends HookConsumerWidget {
const LandingAction({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = Theme.of(context);
final sessionTokenAvailable = ref.watch(
settingsRepositoryProvider.select(
(value) => value.valueOrNull?.kagiSession?.isNotEmpty ?? false,
),
);
return Visibility(
visible: sessionTokenAvailable,
replacement: Container(
margin: const EdgeInsets.symmetric(horizontal: 16.0),
decoration: BoxDecoration(
color: theme.colorScheme.errorContainer,
borderRadius: BorderRadius.circular(4.0),
),
child: Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.warning,
size: 36,
color: theme.colorScheme.onErrorContainer,
),
),
Expanded(
child: Markdown(
shrinkWrap: true,
onTapLink: (text, href, title) async {
if (href == 'settings') {
await context.push(SettingsRoute().location);
}
},
data: '## No Kagi Session Provided\n'
'Please navigate to [Settings](settings) and enter your Kagi Session Token.\n'
"You must provide a valid session in order to use Kagi's features.",
),
),
],
),
),
child: Wrap(
spacing: 8.0,
alignment: WrapAlignment.spaceEvenly,
children: [
OutlinedButton.icon(
onPressed: () {
ref.read(createTabStreamProvider.notifier).createTab(
CreateTab(preferredTool: KagiTool.search),
);
},
icon: const Icon(MdiIcons.searchWeb),
label: const Text('Search'),
),
OutlinedButton.icon(
onPressed: () {
ref.read(createTabStreamProvider.notifier).createTab(
CreateTab(preferredTool: KagiTool.assistant),
);
},
icon: const Icon(MdiIcons.brain),
label: const Text('Assistant'),
),
OutlinedButton.icon(
onPressed: () {
ref.read(createTabStreamProvider.notifier).createTab(
CreateTab(preferredTool: KagiTool.summarizer),
);
},
icon: const Icon(MdiIcons.text),
label: const Text('Summarizer'),
),
],
),
);
}
}
@@ -0,0 +1,66 @@
import 'package:bang_navigator/features/search_browser/presentation/widgets/landing/action.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
class LandingContent extends HookConsumerWidget {
const LandingContent({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final textTheme = Theme.of(context).textTheme;
// ignore: discarded_futures
final descriptionAssetFuture = useMemoized(
() async => rootBundle.loadString('assets/landing/description.md'),
);
final descriptionAsset = useFuture(descriptionAssetFuture);
// ignore: discarded_futures
final changelogAssetFuture = useMemoized(
() async => rootBundle.loadString('assets/landing/changelog.md'),
);
final changelogAsset = useFuture(changelogAssetFuture);
return SingleChildScrollView(
child: Column(
children: [
Text(
'BangNavigator',
style: textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
Text(
'A Privacy-Focused Browser for Kagi',
style: textTheme.titleMedium,
textAlign: TextAlign.center,
),
FractionallySizedBox(
widthFactor: 0.5,
child: Image.asset('assets/icon/icon.png'),
),
const LandingAction(),
Markdown(
data: descriptionAsset.data ?? '',
selectable: true,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
),
Text(
'Changelog',
style: textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
Markdown(
data: changelogAsset.data ?? '',
selectable: true,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
),
],
),
);
}
}
+16
View File
@@ -406,6 +406,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.13.1" version: "0.13.1"
flutter_markdown:
dependency: "direct main"
description:
name: flutter_markdown
sha256: "9921f9deda326f8a885e202b1e35237eadfc1345239a0f6f0f1ff287e047547f"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
flutter_material_design_icons: flutter_material_design_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -651,6 +659,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
markdown:
dependency: transitive
description:
name: markdown
sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051
url: "https://pub.dev"
source: hosted
version: "7.2.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
+2
View File
@@ -17,6 +17,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter_hooks: ^0.20.5 flutter_hooks: ^0.20.5
flutter_inappwebview: ^6.0.0 flutter_inappwebview: ^6.0.0
flutter_markdown: ^0.7.1
flutter_material_design_icons: ^1.1.7447 flutter_material_design_icons: ^1.1.7447
flutter_pdf_text: ^0.6.0 flutter_pdf_text: ^0.6.0
flutter_secure_storage: ^9.0.0 flutter_secure_storage: ^9.0.0
@@ -57,6 +58,7 @@ flutter:
uses-material-design: true uses-material-design: true
assets: assets:
- assets/icon/icon.png - assets/icon/icon.png
- assets/landing/
flutter_launcher_icons: flutter_launcher_icons:
android: "launcher_icon" android: "launcher_icon"