mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-06 17:09:06 +01:00
(wip) Flutter App v1.1: fix logo, fix build warning (updated to last), freezed SDL libraries to a tag
This commit is contained in:
parent
d0988a7e6b
commit
52f0312c5c
16 changed files with 89 additions and 94 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -91,3 +91,7 @@ story-player/storyvm/build/
|
|||
story-player-sdl/build/
|
||||
|
||||
story-player-raylib/build/
|
||||
|
||||
story-player/linux/flutter/generated_plugin_registrant.cc
|
||||
|
||||
story-player/linux/flutter/generated_plugins.cmake
|
||||
|
|
|
|||
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
|
|
@ -4,6 +4,14 @@
|
|||
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Flutter (debug)",
|
||||
"type": "dart",
|
||||
"request": "launch",
|
||||
"program": "lib/main.dart",
|
||||
"flutterMode": "debug",
|
||||
"cwd": "${workspaceFolder}/story-player"
|
||||
},
|
||||
{
|
||||
"name": "Debug Story Editor (GDB)",
|
||||
"type": "cppdbg",
|
||||
|
|
|
|||
|
|
@ -8,14 +8,23 @@ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
|
|||
|
||||
# Environment variables
|
||||
|
||||
```
|
||||
export PATH=$PATH:/home/anthony/development/flutter
|
||||
|
||||
export ANDROID_HOME=/mnt/work/android-sdk
|
||||
export PATH=$PATH:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
|
||||
```
|
||||
|
||||
# Build for Linux
|
||||
|
||||
flutter build linux
|
||||
|
||||
# Build for Android
|
||||
# Build and run for Android
|
||||
|
||||
|
||||
flutter build apk
|
||||
|
||||
|
||||
adb devices
|
||||
adb -s emulator-5554 install -r build/app/outputs/flutter-apk/app-release.apk
|
||||
adb push stories /storage/emulated/0/Download/
|
||||
|
|
|
|||
|
|
@ -132,10 +132,10 @@ include_directories(${sdl3_SOURCE_DIR}/include)
|
|||
FetchContent_Declare(
|
||||
sdl3_mixer
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git
|
||||
GIT_TAG origin/main
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
GIT_SUBMODULES ""
|
||||
GIT_TAG cc78718f6e87354fee8ffe4dc516a20f608c2d65
|
||||
# GIT_SHALLOW TRUE
|
||||
# GIT_PROGRESS TRUE
|
||||
# GIT_SUBMODULES ""
|
||||
)
|
||||
|
||||
set(BUILD_SHARED_LIBS TRUE)
|
||||
|
|
@ -151,8 +151,7 @@ include_directories(${sdl3_mixer_SOURCE_DIR}/include)
|
|||
FetchContent_Declare(
|
||||
sdl_image
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
|
||||
GIT_TAG origin/main
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_TAG ff62eb68aebe9801f06695c86a67292c6f166b16
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
plugins {
|
||||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
id "dev.flutter.flutter-gradle-plugin"
|
||||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
|
|
@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
|
|||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
|
|
@ -21,9 +22,6 @@ if (flutterVersionName == null) {
|
|||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
namespace "org.openstoryteller.story_player"
|
||||
|
|
@ -43,15 +41,20 @@ android {
|
|||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "org.openstoryteller.story_player"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
maxSdkVersion 23
|
||||
targetSdkVersion 23
|
||||
versionCode 2
|
||||
versionName "1.1.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
@ -73,6 +76,5 @@ flutter {
|
|||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
dependencies {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
|
||||
|
||||
<!-- allows startup after boot -->
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,26 @@
|
|||
include ':app'
|
||||
pluginManagement {
|
||||
def flutterSdkPath = {
|
||||
def properties = new Properties()
|
||||
file("local.properties").withInputStream { properties.load(it) }
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
return flutterSdkPath
|
||||
}
|
||||
settings.ext.flutterSdkPath = flutterSdkPath()
|
||||
|
||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||
def properties = new Properties()
|
||||
// includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
|
||||
|
||||
assert localPropertiesFile.exists()
|
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
||||
plugins {
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version "7.3.0" apply false
|
||||
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB |
BIN
story-player/assets/logo.png
Normal file
BIN
story-player/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
|
|
@ -121,16 +121,17 @@ class IndexFile {
|
|||
|
||||
String indexFileName = '$libraryRoot/index.ost';
|
||||
|
||||
bool isGranted = true;
|
||||
bool isGranted = false;
|
||||
|
||||
// if (Platform.isAndroid) {
|
||||
|
||||
// if (await Permission.manageExternalStorage.request().isGranted) {
|
||||
// isGranted = true;
|
||||
// }
|
||||
// } else {
|
||||
// isGranted = true;
|
||||
// }
|
||||
if (Platform.isAndroid) {
|
||||
if (await Permission.storage.request().isGranted) {
|
||||
if (await Permission.manageExternalStorage.request().isGranted) {
|
||||
isGranted = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isGranted = true;
|
||||
}
|
||||
|
||||
if (isGranted) {
|
||||
final file = File(indexFileName);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart' hide Router;
|
||||
import 'package:path/path.dart';
|
||||
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
|
|
@ -98,18 +99,14 @@ enum PlayerState { disabled, indexFile, inStory }
|
|||
class _MyHomePageState extends State<MyHomePage> {
|
||||
String myPath = 'fffff';
|
||||
IndexFile indexFile = IndexFile();
|
||||
String currentImage = 'assets/320x240.png';
|
||||
String currentImage = 'assets/logo.png';
|
||||
final player = AudioPlayer();
|
||||
StreamSubscription? mediaPub;
|
||||
PlayerState state = PlayerState.disabled;
|
||||
StreamSubscription? audioPlayerSub;
|
||||
|
||||
Image img = const Image(image: AssetImage('assets/320x240.png'));
|
||||
Image img = const Image(image: AssetImage('assets/logo.png'));
|
||||
|
||||
// final Permission _permission = Permission.storage;
|
||||
PermissionStatus _permissionStatus = PermissionStatus.denied;
|
||||
|
||||
var _openResult = 'Unknown';
|
||||
|
||||
void initPaths() async {
|
||||
Directory? dir;
|
||||
|
|
@ -221,7 +218,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
);
|
||||
}).toList();
|
||||
},
|
||||
|
||||
),
|
||||
const Divider()
|
||||
, const Text("v1.1")
|
||||
],
|
||||
),
|
||||
body: Center(
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
|
|
@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
|
|||
if (use_header_bar) {
|
||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||
gtk_header_bar_set_title(header_bar, "flutter_launcher");
|
||||
gtk_header_bar_set_title(header_bar, "Story Player");
|
||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||
} else {
|
||||
gtk_window_set_title(window, "flutter_launcher");
|
||||
gtk_window_set_title(window, "Story Player");
|
||||
}
|
||||
|
||||
gtk_window_set_default_size(window, 1280, 720);
|
||||
|
|
|
|||
|
|
@ -103,5 +103,5 @@ flutter:
|
|||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
assets:
|
||||
- assets/320x240.png
|
||||
- assets/logo.png
|
||||
|
||||
Loading…
Reference in a new issue