Skip to content

Commit

Permalink
feat: 暂存状态值
Browse files Browse the repository at this point in the history
  • Loading branch information
iiheng committed May 23, 2024
1 parent d20a9f7 commit eebf0cc
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 23 deletions.
Binary file added assets/bililive-windows-amd64.exe
Binary file not shown.
34 changes: 34 additions & 0 deletions assets/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
rpc:
enable: true
bind: :8080
debug: false
interval: 20
out_put_path: ./
ffmpeg_path: ""
log:
out_put_folder: ./
save_last_log: true
save_every_log: false
feature:
use_native_flv_parser: false
remove_symbol_other_character: false
live_rooms:
- url: https://www.lang.live/room/5664344
is_listening: false
quality: 0
audio_only: false
- url: https://live.bilibili.com/22603245
is_listening: true
quality: 0
audio_only: false
out_put_tmpl: ""
video_split_strategies:
on_room_name_changed: false
max_duration: 0s
max_file_size: 0
cookies: {}
on_record_finished:
convert_to_mp4: false
delete_flv_after_convert: false
custom_commandline: ""
timeout_in_us: 60000000
93 changes: 82 additions & 11 deletions lib/view/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:randommovefile/view/bililive.dart';
import 'package:randommovefile/view/video_selector_page.dart';
import 'package:randommovefile/view/video_split_page.dart';
import 'package:randommovefile/view/settings_page.dart';
Expand All @@ -7,6 +8,8 @@ import 'package:randommovefile/view/censorship_page.dart';

import 'app_shell.dart'; // 确保导入了所有页面

enum Status { notRunning, error, running }

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

Expand All @@ -27,46 +30,114 @@ class HomePage extends StatelessWidget {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const AppShell(page: VideoSelectorPage())));
}),
}, Status.notRunning),
_buildFeatureCard(context, '视频分割', Icons.content_cut, () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const AppShell(page: VideoSplitPage())));
}),
}, Status.notRunning),
_buildFeatureCard(context, '违规词消音', Icons.volume_off, () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const AppShell(page: CensorshipPage())));
}),
}, Status.notRunning),
_buildFeatureCard(context, '录播姬', Icons.videocam, () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const AppShell(page: BililivePage())));
}, Status.notRunning),
_buildFeatureCard(context, '设置', Icons.settings, () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const AppShell(page: SettingsPage())));
}),
}, Status.notRunning),
_buildFeatureCard(context, '帮助', Icons.help_outline, () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const AppShell(page: HelpPage())));
}),
}, Status.notRunning),
],
),
),
),
);
}

Widget _buildFeatureCard(
BuildContext context, String title, IconData icon, Function onTap) {
Widget _buildFeatureCard(BuildContext context, String title, IconData icon,
Function onTap, Status status) {
return Card(
child: InkWell(
onTap: onTap as void Function()?,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
onLongPress: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('$title 控制'),
content: const Text('你想停止该进程吗?'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('取消'),
),
TextButton(
onPressed: () {
// Handle stop action here
Navigator.of(context).pop();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('$title 停止')),
);
},
child: const Text('停止'),
),
],
);
},
);
},
child: Stack(
children: <Widget>[
Icon(icon, size: 48.0, color: Theme.of(context).primaryColor),
Text(title, style: const TextStyle(fontSize: 16)),
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(icon, size: 48.0, color: Theme.of(context).primaryColor),
Text(title, style: const TextStyle(fontSize: 16)),
],
),
),
Positioned(
right: 8,
bottom: 8,
child: _buildStatusIndicator(status),
),
],
),
),
);
}

Widget _buildStatusIndicator(Status status) {
Color color;
switch (status) {
case Status.notRunning:
color = Colors.grey;
break;
case Status.error:
color = Colors.red;
break;
case Status.running:
color = Colors.green;
break;
}
return Container(
width: 16,
height: 16,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
),
);
}
}
64 changes: 52 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,30 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.7"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.flutter-io.cn"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
Expand All @@ -236,26 +260,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
version: "1.12.0"
nested:
dependency: transitive
description:
Expand All @@ -268,10 +292,10 @@ packages:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.3"
version: "1.9.0"
path_provider_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -497,10 +521,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.1"
version: "0.7.0"
toastification:
dependency: "direct main"
description:
Expand Down Expand Up @@ -533,6 +557,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.flutter-io.cn"
source: hosted
version: "14.2.1"
wakelock:
dependency: "direct main"
description:
Expand Down Expand Up @@ -573,6 +605,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.0"
webview_windows:
dependency: "direct main"
description:
name: webview_windows
sha256: "47fcad5875a45db29dbb5c9e6709bf5c88dcc429049872701343f91ed7255730"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.0"
win32:
dependency: transitive
description:
Expand All @@ -598,5 +638,5 @@ packages:
source: hosted
version: "1.0.4"
sdks:
dart: ">=3.2.5 <4.0.0"
flutter: ">=3.16.6"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies:
shared_preferences: ^2.2.3
flutter_adaptive_scaffold: ^0.1.10+2
wakelock: ^0.4.0
webview_windows: ^0.4.0

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <desktop_drop/desktop_drop_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <webview_windows/webview_windows_plugin.h>
#include <window_manager/window_manager_plugin.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
Expand All @@ -18,6 +19,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
WebviewWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WebviewWindowsPlugin"));
WindowManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowManagerPlugin"));
}
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
permission_handler_windows
screen_retriever
webview_windows
window_manager
)

Expand Down

0 comments on commit eebf0cc

Please sign in to comment.