Skip to content

Commit

Permalink
Merge pull request #7 from guchengxi1994/dev
Browse files Browse the repository at this point in the history
0.1.7
  • Loading branch information
guchengxi1994 committed Apr 21, 2023
2 parents 033b964 + 40360ac commit 85c826f
Show file tree
Hide file tree
Showing 52 changed files with 2,311 additions and 18 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## changelogs

* **0.1.7**

* **0.1.7+2** game center; modify a minesweeper game from [here](https://github.com/Cifruktus/FlutterMinesweeper)
* **0.1.7+1** [text editor](https://pub.dev/packages/appflowy_editor) ***Not support Chinese yet [#24](https://github.com/AppFlowy-IO/appflowy-editor/issues/24) [#113909](https://github.com/flutter/flutter/issues/113909#issuecomment-1311478223)***

* **0.1.6**

* **0.1.6+4** management form(WIP)
Expand Down
Binary file added assets/images/appicons/editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/appicons/game.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/appicons/mine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/components/app_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ class SystemConfig {
static const String sAppManagement = "管理";
static const String sAudioPlayer = "音乐播放器";
static const String sVideoPlayer = "视频播放器";
static const String sEditor = "文本编辑器";
static const String sGameCenter = "游戏中心";
static const String sMinesweeper = "扫雷";
}
21 changes: 21 additions & 0 deletions lib/components/applications/_system_applications/details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ ApplicationDetails appManagementDetails = ApplicationDetails(
iconUrl: "assets/images/appicons/management.png",
deletable: false);

ApplicationDetails editorDetails = ApplicationDetails(
uuid: const Uuid().v1(),
xmax: 1100,
ymax: 500,
name: SystemConfig.sEditor,
needsTaskbarDisplay: true,
needsTrayDisplay: false,
iconUrl: "assets/images/appicons/editor.png",
deletable: false);

ApplicationDetails audioPlayerDetails = ApplicationDetails(
uuid: const Uuid().v1(),
xmax: 300,
Expand All @@ -51,3 +61,14 @@ ApplicationDetails videoPlayerDetails = ApplicationDetails(
iconUrl: "assets/images/appicons/video_player.png",
deletable: false,
resizable: false);

ApplicationDetails gameCenterDetails = ApplicationDetails(
uuid: const Uuid().v1(),
xmax: 800,
ymax: 600,
name: SystemConfig.sGameCenter,
needsTaskbarDisplay: true,
needsTrayDisplay: true,
iconUrl: "assets/images/appicons/game.png",
deletable: false,
resizable: false);
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter_desktop/components/applications/_system_applications/details.dart'
show editorDetails;

import '../application.dart';

Application editorApplication() {
return Application(
uuid: editorDetails.uuid,
name: editorDetails.name,
resizable: false,
child: const EditorForm(),
);
}

class EditorForm extends StatefulWidget {
const EditorForm({super.key});

@override
State<EditorForm> createState() => _EditorFormState();
}

class _EditorFormState extends State<EditorForm> {
final editorState = EditorState.empty();

@override
Widget build(BuildContext context) {
return SizedBox(
height: 500,
width: 1100,
child: AppFlowyEditor(
editorState: editorState,
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:flutter_desktop/components/app_style.dart';
import 'package:flutter_desktop/components/applications/_system_applications/details.dart'
show gameCenterDetails;
import 'package:flutter_desktop/components/applications/application.dart';
import 'package:flutter_desktop/components/minesweeper/minesweeper_details.dart';

import 'system_application_builder.dart';

Application gameCenterApplication() {
return Application(
uuid: gameCenterDetails.uuid,
name: gameCenterDetails.name,
resizable: false,
background: AppStyle.dark,
child: const GameCenterForm(),
);
}

class GameCenterForm extends StatefulWidget {
const GameCenterForm({super.key});

@override
State<GameCenterForm> createState() => _GameCenterFormState();
}

class _GameCenterFormState extends State<GameCenterForm> {
@override
Widget build(BuildContext context) {
return Wrap(
children: [
SystemApplicationBuilder.build(context, mineEasyDetails),
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ class ManagementForm extends StatefulWidget {
}

class _ManagementFormState extends State<ManagementForm> {
final ScrollController controller = ScrollController();

@override
void dispose() {
controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
final d = context.watch<ApplicationController>().details;
final l = [1, 2, 3, 4, 5, 6, 7, 8, 9];
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_desktop/components/app_style.dart';
import 'package:flutter_desktop/components/applications/_system_applications/audio_player_application.dart';
import 'package:flutter_desktop/components/applications/_system_applications/editor_application.dart';
import 'package:flutter_desktop/components/applications/_system_applications/game_center_application.dart';
import 'package:flutter_desktop/components/applications/_system_applications/management_application.dart';
import 'package:flutter_desktop/components/applications/_system_applications/my_computer_application.dart';
import 'package:flutter_desktop/components/applications/_system_applications/recycle_application.dart';
import 'package:flutter_desktop/components/applications/_system_applications/video_player_application.dart';
import 'package:flutter_desktop/components/applications/application_entry.dart';
import 'package:flutter_desktop/components/desktop/desktop_controller.dart';
import 'package:flutter_desktop/components/minesweeper/mine_application.dart';
import 'package:flutter_desktop/components/taskbar/taskbar_controller.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -56,6 +59,21 @@ class SystemApplicationBuilder {
.read<DesktopController>()
.addApplication(videoPlayerApplication(), exists: exists);
break;
case SystemConfig.sEditor:
ctx
.read<DesktopController>()
.addApplication(editorApplication(), exists: exists);
break;
case SystemConfig.sGameCenter:
ctx
.read<DesktopController>()
.addApplication(gameCenterApplication(), exists: exists);
break;
case SystemConfig.sMinesweeper:
ctx
.read<DesktopController>()
.addApplication(minesweeperApplication(), exists: exists);
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class _VideoPlayerFormState extends State<VideoPlayerForm> {
controller = await VideoController.create(videoPlayer);

/// Play any media source.
///
/// TODO
///
/// remove test
await videoPlayer.open(/*for test*/ Media(
r"C:\Users\xiaoshuyui\Desktop\不常用的东西\新建文件夹 (2)\result_voice324.mp4"));
await videoPlayer.setVolume(50);
Expand Down
4 changes: 4 additions & 0 deletions lib/components/desktop/desktop_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ class _DesktopScreenState extends State<DesktopScreen>
ctx, audioPlayerDetails),
SystemApplicationBuilder.build(
ctx, videoPlayerDetails),
SystemApplicationBuilder.build(
ctx, editorDetails),
SystemApplicationBuilder.build(
ctx, gameCenterDetails),
],
),
)),
Expand Down
29 changes: 29 additions & 0 deletions lib/components/minesweeper/mine_application.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:flutter_desktop/components/app_style.dart';
import 'package:flutter_desktop/components/applications/application.dart';
import 'package:flutter_desktop/components/minesweeper/minesweeper_details.dart';
import 'package:minesweeper/lib.dart';

Application minesweeperApplication() {
return Application(
uuid: mineEasyDetails.uuid,
name: mineEasyDetails.name,
resizable: false,
background: AppStyle.light,
child: const MinesweeperForm(),
);
}

class MinesweeperForm extends StatefulWidget {
const MinesweeperForm({super.key});

@override
State<MinesweeperForm> createState() => _MinesweeperFormState();
}

class _MinesweeperFormState extends State<MinesweeperForm> {
@override
Widget build(BuildContext context) {
return const MinesweeperWindow();
}
}
14 changes: 14 additions & 0 deletions lib/components/minesweeper/minesweeper_details.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter_desktop/components/applications/application_details.dart';

import '../app_style.dart';

ApplicationDetails mineEasyDetails = ApplicationDetails(
uuid: "system-minesweeper",
xmax: 300,
ymax: 350,
name: SystemConfig.sMinesweeper,
needsTaskbarDisplay: true,
needsTrayDisplay: true,
iconUrl: "assets/images/appicons/mine.png",
deletable: false,
resizable: false);
10 changes: 10 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// ignore_for_file: depend_on_referenced_packages

import 'dart:io';

import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_desktop/components/routers.dart';
Expand All @@ -9,6 +12,7 @@ import 'package:intl/date_symbol_data_local.dart';
import 'package:media_kit/media_kit.dart';
import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -56,6 +60,12 @@ class MyApp extends StatelessWidget {
ctx.read<SysInfoController>().init();

return MaterialApp(
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
AppFlowyEditorLocalizations.delegate,
],
debugShowCheckedModeBanner: false,
title: '桌面',
theme: ThemeData(fontFamily: "思源"),
Expand Down
8 changes: 8 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <flutter_volume_controller/flutter_volume_controller_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <media_kit_video/media_kit_video_plugin.h>
#include <rich_clipboard_linux/rich_clipboard_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
Expand All @@ -26,9 +28,15 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar);
g_autoptr(FlPluginRegistrar) rich_clipboard_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "RichClipboardPlugin");
rich_clipboard_plugin_register_with_registrar(rich_clipboard_linux_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_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);
g_autoptr(FlPluginRegistrar) window_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin");
window_manager_plugin_register_with_registrar(window_manager_registrar);
Expand Down
2 changes: 2 additions & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_volume_controller
media_kit_libs_linux
media_kit_video
rich_clipboard_linux
screen_retriever
url_launcher_linux
window_manager
)

Expand Down
4 changes: 4 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import flutter_volume_controller
import media_kit_video
import network_info_plus
import path_provider_foundation
import rich_clipboard_macos
import screen_retriever
import url_launcher_macos
import window_manager

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
Expand All @@ -21,6 +23,8 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin"))
NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RichClipboardPlugin.register(with: registry.registrar(forPlugin: "RichClipboardPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}
46 changes: 46 additions & 0 deletions minesweeper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

/example
Loading

0 comments on commit 85c826f

Please sign in to comment.