mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-12 02:00:22 +00:00
feat: Replace desktop_webview_window with tao&wry , from tauri
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@@ -12,15 +11,6 @@ import 'app.dart';
|
||||
import 'common/utils/multi_window_manager.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
// webview window
|
||||
if (runWebViewTitleBarWidget(
|
||||
args,
|
||||
backgroundColor: const Color.fromRGBO(19, 36, 49, 1),
|
||||
builder: _defaultWebviewTitleBar,
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await windowManager.ensureInitialized();
|
||||
|
||||
@@ -133,33 +123,3 @@ class App extends HookConsumerWidget with WindowListener {
|
||||
super.onWindowClose();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _defaultWebviewTitleBar(BuildContext context) {
|
||||
final state = TitleBarWebViewState.of(context);
|
||||
final controller = TitleBarWebViewController.of(context);
|
||||
return FluentTheme(
|
||||
data: FluentThemeData.dark(),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (Platform.isMacOS) const SizedBox(width: 96),
|
||||
IconButton(onPressed: !state.canGoBack ? null : controller.back, icon: const Icon(FluentIcons.chevron_left)),
|
||||
const SizedBox(width: 12),
|
||||
IconButton(
|
||||
onPressed: !state.canGoForward ? null : controller.forward,
|
||||
icon: const Icon(FluentIcons.chevron_right),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
if (state.isLoading)
|
||||
IconButton(onPressed: controller.stop, icon: const Icon(FluentIcons.chrome_close))
|
||||
else
|
||||
IconButton(onPressed: controller.reload, icon: const Icon(FluentIcons.refresh)),
|
||||
const SizedBox(width: 12),
|
||||
(state.isLoading) ? const SizedBox(width: 24, height: 24, child: ProgressRing()) : const SizedBox(width: 24),
|
||||
const SizedBox(width: 12),
|
||||
SelectableText(state.url ?? ""),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user