Skip to content

Commit

Permalink
Added feedback button
Browse files Browse the repository at this point in the history
  • Loading branch information
ActiveChooN committed Dec 4, 2024
1 parent 54499bc commit 481b983
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 64 deletions.
50 changes: 30 additions & 20 deletions lib/openvino_console_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:inference/providers/preference_provider.dart';
import 'package:inference/providers/project_provider.dart';
import 'package:inference/theme_fluent.dart';
import 'package:inference/utils.dart';
import 'package:inference/widgets/feedback_button.dart';
import 'package:provider/provider.dart';
import 'package:fluent_ui/fluent_ui.dart';

Expand Down Expand Up @@ -124,26 +125,35 @@ class _OpenVINOTestDriveAppState extends State<OpenVINOTestDriveApp> {

@override
Widget build(BuildContext context) {
return NavigationView(
appBar: NavigationAppBar(
leading: Container(),
height: 48,
return Stack(
children: [
NavigationView(
appBar: NavigationAppBar(
leading: Container(),
height: 48,
),
paneBodyBuilder: (item, child) {
final name =
item?.key is ValueKey ? (item!.key as ValueKey).value : null;
return FocusTraversalGroup(
key: ValueKey('body$name'),
child: widget.child,
);
},
pane: NavigationPane(
selected: _calculateSelectedIndex(context),
toggleable: false,
displayMode: PaneDisplayMode.compact,
items: originalNavigationItems,
footerItems: footerNavigationItems,
),
),
paneBodyBuilder: (item, child) {
final name =
item?.key is ValueKey ? (item!.key as ValueKey).value : null;
return FocusTraversalGroup(
key: ValueKey('body$name'),
child: widget.child,
);
},
pane: NavigationPane(
selected: _calculateSelectedIndex(context),
toggleable: false,
displayMode: PaneDisplayMode.compact,
items: originalNavigationItems,
footerItems: footerNavigationItems,
),
);
const Positioned(
right: 24,
bottom: 24,
child: FeedbackButton()
)
],
);
}
}
11 changes: 8 additions & 3 deletions lib/pages/text_generation/text_generation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ class _TextGenerationPageState extends State<TextGenerationPage> {
!textInferenceProvider.sameProps(widget.project, preferences.device);
if (init) {
final textInferenceProvider = TextInferenceProvider(widget.project, preferences.device);
textInferenceProvider.loadModel().catchError((e) {
// TODO: Error handling
print(e);
textInferenceProvider.loadModel().catchError((e) async {
// ignore: use_build_context_synchronously
await displayInfoBar(context, builder: (context, close) => InfoBar(
title: const Text('Error loading model'),
content: Text(e.toString()),
severity: InfoBarSeverity.error,
action: IconButton(icon: const Icon(FluentIcons.clear), onPressed: close),
));
});
return textInferenceProvider;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/theme_fluent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ const cosmosBackground = DarkLightColor(Color(0xFFEFEAFF), Color(0xFF463d66));
const userMessageColor = DarkLightColor(Color(0xFFe0d6fd), Color(0xFF463D66));
const modelMessageColor = DarkLightColor(Color(0xFFF5F5F5), Color(0xFF343434));

final AccentColor electricCoral = AccentColor.swatch(const {

Check warning on line 113 in lib/theme_fluent.dart

View check run for this annotation

Codecov / codecov/patch

lib/theme_fluent.dart#L113

Added line #L113 was not covered by tests
'normal': Color(0xFFFE5A80),
});

final AccentColor electricCosmos = AccentColor.swatch(const {
'normal': Color(0xFF7000FF),
});
Expand Down
38 changes: 38 additions & 0 deletions lib/widgets/feedback_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:inference/theme_fluent.dart';
import 'package:inference/widgets/elevation.dart';
import 'package:url_launcher/url_launcher.dart';

final Uri _url = Uri.parse('https://github.com/openvinotoolkit/openvino_testdrive/issues/new');


class FeedbackButton extends StatelessWidget {
const FeedbackButton({super.key});

@override
Widget build(BuildContext context) {
return MouseRegion(
cursor: SystemMouseCursors.click,
child: Elevation(
elevation: 8,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
child: IconButton(
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(electricCoral.normal),
foregroundColor: const WidgetStatePropertyAll(Colors.white),
shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.circular(24))),
padding: const WidgetStatePropertyAll(EdgeInsets.all(16.0)),
),
icon: const Icon(FluentIcons.megaphone, size: 16,),
onPressed: () async {
if (await canLaunchUrl(_url)) {
await launchUrl(_url);
} else {
throw 'Could not launch $_url';
}
},
),
),
);
}
}
Empty file added lib/widgets/help_button.dart
Empty file.
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <media_kit_video/media_kit_video_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) desktop_drop_registrar =
Expand All @@ -36,4 +37,7 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) system_theme_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SystemThemePlugin");
system_theme_plugin_register_with_registrar(system_theme_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
media_kit_video
super_native_extensions
system_theme
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import path_provider_foundation
import screen_brightness_macos
import super_native_extensions
import system_theme
import url_launcher_macos
import wakelock_plus

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
Expand All @@ -30,5 +31,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
SystemThemePlugin.register(with: registry.registrar(forPlugin: "SystemThemePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
}
8 changes: 7 additions & 1 deletion macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ PODS:
- FlutterMacOS
- system_theme (0.0.1):
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- wakelock_plus (0.0.1):
- FlutterMacOS

Expand All @@ -42,6 +44,7 @@ DEPENDENCIES:
- screen_brightness_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos`)
- super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`)
- system_theme (from `Flutter/ephemeral/.symlinks/plugins/system_theme/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)

EXTERNAL SOURCES:
Expand Down Expand Up @@ -71,6 +74,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos
system_theme:
:path: Flutter/ephemeral/.symlinks/plugins/system_theme/macos
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
wakelock_plus:
:path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos

Expand All @@ -83,11 +88,12 @@ SPEC CHECKSUMS:
media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82
media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5
media_kit_video: c75b07f14d59706c775778e4dd47dd027de8d1e5
package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b
package_info_plus: d2f71247aab4b6521434f887276093acc70d214c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3
system_theme: c7b9f6659a5caa26c9bc2284da096781e9a6fcbc
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269

PODFILE CHECKSUM: 16208599a12443d53889ba2270a4985981cfb204
Expand Down
Loading

0 comments on commit 481b983

Please sign in to comment.