Skip to content

Commit

Permalink
重构部分代码,新增自动打包配置
Browse files Browse the repository at this point in the history
  • Loading branch information
molihuan committed May 13, 2024
1 parent a70ddb3 commit 5d462a6
Show file tree
Hide file tree
Showing 41 changed files with 1,345 additions and 1,048 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Flutter Build

on:
push:
workflow_dispatch:

env:
FLUTTER_VERSION: '3.19.3'

jobs:
setup:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: 'android'
target-platform: 'android-arm64'
- os: ubuntu-latest
platform: 'linux'
- os: windows-latest
platform: 'windows'
- os: macos-14
platform: 'ios'
- os: macos-14
platform: 'macos'
steps:
- uses: actions/checkout@v4


- name: Install Flutter SDK
uses: hughware/flutter-action@v1.0.0
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-${{ env.FLUTTER_VERSION }}

- run: flutter pub get

- name: Build for Android
if: matrix.platform == 'android'
run: flutter build apk --release --target-platform ${{ matrix.target-platform }}


- name: Build for Linux
if: matrix.platform == 'linux'
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
flutter build linux --release
- name: Build for Windows
if: matrix.platform == 'windows'
run: flutter build windows --release

- name: Build for iOS
if: matrix.platform == 'ios'
run: flutter build ios --release --no-codesign

- name: Build for macOS
if: matrix.platform == 'macos'
run: flutter build macos --release

- name: Upload Artifact for Android
if: matrix.platform == 'android'
uses: actions/upload-artifact@v4
with:
name: android-app
path: build/app/outputs/flutter-apk/app-release.apk

- name: Upload Artifact for Linux
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: linux-app
path: build/linux/*/release/bundle

- name: Upload Artifact for Windows
if: matrix.platform == 'windows'
uses: actions/upload-artifact@v4
with:
name: windows-app
path: build/windows/x64/runner/Release/*

- name: Upload Artifact for iOS
if: matrix.platform == 'ios'
uses: actions/upload-artifact@v4
with:
name: ios-app
path: build/ios/iphoneos/*.app

- name: Upload Artifact for macOS
if: matrix.platform == 'macos'
uses: actions/upload-artifact@v4
with:
name: macos-app
path: build/macos/Build/Products/Release/*.app
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 molihuan
Copyright (c) 2023-2024 molihuan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# 我们会一直维护这个软件,除非江水为竭🌊,冬雷震震⚡,没有Star⭐。直至时间的尽头🕑。


## 右上角给项目一个Star(小星星),你的支持是我更新的唯一动力。

# HL视频笔记📒

Expand All @@ -25,7 +25,7 @@
特点:一键视频截屏插入笔记;在笔记上插入视频节点,点击视频节点跳转到视频指定时间点;笔记中插入图片,音频,视频;支持手写笔记;支持录音;多端联动(例如:电脑看视频,平板写笔记,点击平板截屏按钮可一键在笔记中插入电脑视频截图);支持插件系统,安装插件,扩展自定义功能;导出笔记为pdf;在pdf上做笔记;视频支持Bilibili,YouTube;


### 右上角给项目一个Star(小星星),你的支持是我更新的唯一动力。

### 一个人是孤独的,我们非常需要你!诚挚地邀请你上我们的贼船🏴‍☠️!

##### 加入我们吧!无论你是否会写代码,都可加入我们!
Expand Down
10 changes: 10 additions & 0 deletions doc/md/zh_CN/DevelopmentEnvironment.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
• Edge (web) • edge • web-javascript • Microsoft Edge 114.0.1823.82 (unsupported)
```



## 常用命令

```shell
Expand All @@ -72,3 +74,11 @@ flutter build apk --split-per-abi
flutter build ios --release
```

## 注意在编译一些依赖时需要用到rust请安装并配置好rust

```sh
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.78.0 (9b00956e5 2024-04-29)
```

5 changes: 5 additions & 0 deletions lib/common/store/global_store.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class GlobalStore{
// 数据存储
// 所有笔记配置位置列表
static const String DATASTORE_KEY_NOTE_CFG_POS_LIST = "molihuan_note_DATASTORE_KEY_NOTE_CFG_POS_LIST";
}
67 changes: 48 additions & 19 deletions lib/common/utils/common_tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,43 @@ import 'package:flutter/material.dart';
typedef String StrCallbackStr(String value);
typedef void CallbackStr(String value);
typedef String StrCallback();

typedef Widget WgetCallback();
typedef bool BoolCallback();

/// 异步方法
typedef Future<String> FStrCallbackStr(String value);
typedef Future<void> FCallbackStr(String value);
typedef Future<String> FStrCallback();

typedef Widget WgetCallback();

class CommonTool {

Widget conditionalWidget(BoolCallback boolCallback, Widget widget) {
bool condition = boolCallback();
return condition ? widget : Visibility(visible: false, child: widget);
}

/// 获取父位置
static String getParentPos(String path) {
// 如果路径以斜杠结尾,先去掉斜杠
if (path.endsWith('/')) {
path = path.substring(0, path.length - 1);
}

// 使用字符串匹配找到最后一个斜杠的位置
int lastSlashIndex = path.lastIndexOf('/');

// 如果找不到斜杠,或者斜杠在第一个位置,表示当前路径已经是根路径,直接返回原路径
if (lastSlashIndex <= 0) {
return path;
}

// 截取路径字符串,获取上一级路径
return path.substring(0, lastSlashIndex);
}



///String转Duration
static Duration str2Duration(String durationString) {
List<String> parts = durationString.split(':');
Expand All @@ -37,6 +65,7 @@ class CommonTool {
}

///获取当前时间
///2024_05_12_22_36_37_1715524597897
static String getCurrentTime() {
DateTime dateTime = DateTime.now();
final formattedDate =
Expand All @@ -48,21 +77,21 @@ class CommonTool {
}

///获取上一级url
static String? getParentUrl(String url) {
if (url.isEmpty) {
return null;
}

///如果是以路径分隔符结尾则去除最后的路径分隔符
if (url.endsWith("/")) {
url = url.substring(0, url.length - 1);
}

if (!url.contains("/")) {
return null;
}

int endIndex = url.lastIndexOf("/");
return url.substring(0, endIndex);
}
// static String? getParentUrl(String url) {
// if (url.isEmpty) {
// return null;
// }
//
// ///如果是以路径分隔符结尾则去除最后的路径分隔符
// if (url.endsWith("/")) {
// url = url.substring(0, url.length - 1);
// }
//
// if (!url.contains("/")) {
// return null;
// }
//
// int endIndex = url.lastIndexOf("/");
// return url.substring(0, endIndex);
// }
}
Loading

0 comments on commit 5d462a6

Please sign in to comment.