improved input usability
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
* Added landing page
|
* Added landing page
|
||||||
* Adjusted routing for back navigation and landing page
|
* Adjusted routing for back navigation and landing page
|
||||||
* Added link to Kagi Acoount in Settings
|
* Added link to Kagi Acoount in Settings
|
||||||
|
* Improved input usability for Kagi Tools
|
||||||
|
|
||||||
## 0.2.0
|
## 0.2.0
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ class AssistantTab extends HookConsumerWidget {
|
|||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
// border: OutlineInputBorder(),
|
// border: OutlineInputBorder(),
|
||||||
label: Text('Prompt'),
|
label: Text('Prompt'),
|
||||||
|
hintText: 'Enter your prompt...',
|
||||||
|
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||||
),
|
),
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ class SearchTab extends HookConsumerWidget {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
// border: OutlineInputBorder(),
|
// border: OutlineInputBorder(),
|
||||||
label: const Text('Query'),
|
label: const Text('Query'),
|
||||||
|
hintText: 'Ask anything...',
|
||||||
|
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final isServiceAvailable =
|
final isServiceAvailable =
|
||||||
|
|||||||
@@ -7,11 +7,40 @@ import 'package:bang_navigator/features/search_browser/utils/url_builder.dart'
|
|||||||
import 'package:bang_navigator/features/share_intent/domain/entities/shared_content.dart';
|
import 'package:bang_navigator/features/share_intent/domain/entities/shared_content.dart';
|
||||||
import 'package:bang_navigator/presentation/widgets/website_title_tile.dart';
|
import 'package:bang_navigator/presentation/widgets/website_title_tile.dart';
|
||||||
import 'package:bang_navigator/utils/uri_parser.dart' as uri_parser;
|
import 'package:bang_navigator/utils/uri_parser.dart' as uri_parser;
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
||||||
|
import 'package:flutter_pdf_text/flutter_pdf_text.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
|
class _InputField extends StatelessWidget {
|
||||||
|
final TextEditingController? controller;
|
||||||
|
|
||||||
|
const _InputField({required this.controller, super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return TextFormField(
|
||||||
|
controller: controller,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
label: Text('Document'),
|
||||||
|
hintText: 'Enter URL or text to summarize',
|
||||||
|
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||||
|
),
|
||||||
|
maxLines: null,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value?.isEmpty ?? true) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class SummarizeTab extends HookConsumerWidget {
|
class SummarizeTab extends HookConsumerWidget {
|
||||||
final SharedContent? sharedContent;
|
final SharedContent? sharedContent;
|
||||||
final OnSubmitUri onSubmit;
|
final OnSubmitUri onSubmit;
|
||||||
@@ -59,21 +88,7 @@ class SummarizeTab extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
...switch (sharedContent) {
|
...switch (sharedContent) {
|
||||||
SharedUrl() => [
|
SharedUrl() => [
|
||||||
TextFormField(
|
_InputField(controller: textController),
|
||||||
controller: textController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
// border: OutlineInputBorder(),
|
|
||||||
label: Text('Document'),
|
|
||||||
),
|
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
||||||
validator: (value) {
|
|
||||||
if (value?.isEmpty ?? true) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
HookBuilder(
|
HookBuilder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final url =
|
final url =
|
||||||
@@ -108,22 +123,27 @@ class SummarizeTab extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
SharedText() || null => [
|
SharedText() || null => [
|
||||||
TextFormField(
|
SizedBox(
|
||||||
controller: textController,
|
width: double.infinity,
|
||||||
decoration: const InputDecoration(
|
child: OutlinedButton.icon(
|
||||||
// border: OutlineInputBorder(),
|
onPressed: () async {
|
||||||
label: Text('Document'),
|
final pickResult = await FilePicker.platform.pickFiles(
|
||||||
),
|
type: FileType.custom,
|
||||||
maxLines: null,
|
allowedExtensions: ['pdf'],
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
);
|
||||||
validator: (value) {
|
|
||||||
if (value?.isEmpty ?? true) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
if (pickResult?.files.first.path
|
||||||
},
|
case final String filePath) {
|
||||||
|
final content = await PDFDoc.fromPath(filePath)
|
||||||
|
.then((doc) => doc.text);
|
||||||
|
textController.text = content;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(MdiIcons.fileUpload),
|
||||||
|
label: const Text('Read PDF document'),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
_InputField(controller: textController),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -321,6 +321,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.0"
|
version: "7.0.0"
|
||||||
|
file_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: file_picker
|
||||||
|
sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.0.3"
|
||||||
fixnum:
|
fixnum:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -430,6 +438,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.0"
|
version: "0.6.0"
|
||||||
|
flutter_plugin_android_lifecycle:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_plugin_android_lifecycle
|
||||||
|
sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.20"
|
||||||
flutter_riverpod:
|
flutter_riverpod:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ dependencies:
|
|||||||
exceptions: ^0.6.0
|
exceptions: ^0.6.0
|
||||||
expandable_page_view: ^1.0.17
|
expandable_page_view: ^1.0.17
|
||||||
fast_equatable: ^1.1.0
|
fast_equatable: ^1.1.0
|
||||||
|
file_picker: ^8.0.3
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_hooks: ^0.20.5
|
flutter_hooks: ^0.20.5
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
* Added landing page
|
* Added landing page
|
||||||
* Adjusted routing for back navigation and landing page
|
* Adjusted routing for back navigation and landing page
|
||||||
* Added link to Kagi Acoount in Settings
|
* Added link to Kagi Acoount in Settings
|
||||||
|
* Improved input usability for Kagi Tools
|
||||||
Reference in New Issue
Block a user