(wip) Flutter App v1.1: fix logo, fix build warning (updated to last), freezed SDL libraries to a tag

This commit is contained in:
anthony@rabine.fr 2024-05-20 15:41:30 +02:00
parent d0988a7e6b
commit 52f0312c5c
16 changed files with 89 additions and 94 deletions

4
.gitignore vendored
View file

@ -91,3 +91,7 @@ story-player/storyvm/build/
story-player-sdl/build/ story-player-sdl/build/
story-player-raylib/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
View file

@ -4,6 +4,14 @@
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
"name": "Flutter (debug)",
"type": "dart",
"request": "launch",
"program": "lib/main.dart",
"flutterMode": "debug",
"cwd": "${workspaceFolder}/story-player"
},
{ {
"name": "Debug Story Editor (GDB)", "name": "Debug Story Editor (GDB)",
"type": "cppdbg", "type": "cppdbg",

View file

@ -8,14 +8,23 @@ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
# Environment variables # 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 # Build for Linux
flutter build linux flutter build linux
# Build for Android # Build and run for Android
flutter build apk 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/

View file

@ -132,10 +132,10 @@ include_directories(${sdl3_SOURCE_DIR}/include)
FetchContent_Declare( FetchContent_Declare(
sdl3_mixer sdl3_mixer
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git
GIT_TAG origin/main GIT_TAG cc78718f6e87354fee8ffe4dc516a20f608c2d65
GIT_SHALLOW TRUE # GIT_SHALLOW TRUE
GIT_PROGRESS TRUE # GIT_PROGRESS TRUE
GIT_SUBMODULES "" # GIT_SUBMODULES ""
) )
set(BUILD_SHARED_LIBS TRUE) set(BUILD_SHARED_LIBS TRUE)
@ -151,10 +151,9 @@ include_directories(${sdl3_mixer_SOURCE_DIR}/include)
FetchContent_Declare( FetchContent_Declare(
sdl_image sdl_image
GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
GIT_TAG origin/main GIT_TAG ff62eb68aebe9801f06695c86a67292c6f166b16
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
) )
set(SDL3IMAGE_INSTALL OFF) set(SDL3IMAGE_INSTALL OFF)

View file

@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { 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') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = '1' flutterVersionCode = '1'
@ -21,9 +22,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.0'
} }
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
namespace "org.openstoryteller.story_player" namespace "org.openstoryteller.story_player"
@ -43,15 +41,20 @@ android {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
} }
lintOptions {
checkReleaseBuilds false
}
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "org.openstoryteller.story_player" applicationId "org.openstoryteller.story_player"
// You can update the following values to match your application needs. // 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. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion maxSdkVersion 23
versionCode flutterVersionCode.toInteger() targetSdkVersion 23
versionName flutterVersionName versionCode 2
versionName "1.1.0"
} }
buildTypes { buildTypes {
@ -73,6 +76,5 @@ flutter {
source '../..' source '../..'
} }
dependencies { dependencies {}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

View file

@ -5,6 +5,9 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_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.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 --> <!-- allows startup after boot -->

View file

@ -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 { allprojects {
repositories { repositories {

View file

@ -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") // includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
def properties = new Properties()
assert localPropertiesFile.exists() repositories {
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } google()
mavenCentral()
gradlePluginPortal()
}
}
def flutterSdkPath = properties.getProperty("flutter.sdk") plugins {
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" id "dev.flutter.flutter-plugin-loader" version "1.0.0"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -121,16 +121,17 @@ class IndexFile {
String indexFileName = '$libraryRoot/index.ost'; String indexFileName = '$libraryRoot/index.ost';
bool isGranted = true; bool isGranted = false;
// if (Platform.isAndroid) { if (Platform.isAndroid) {
if (await Permission.storage.request().isGranted) {
// if (await Permission.manageExternalStorage.request().isGranted) { if (await Permission.manageExternalStorage.request().isGranted) {
// isGranted = true; isGranted = true;
// } }
// } else { }
// isGranted = true; } else {
// } isGranted = true;
}
if (isGranted) { if (isGranted) {
final file = File(indexFileName); final file = File(indexFileName);

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart' hide Router; import 'package:flutter/material.dart' hide Router;
import 'package:path/path.dart';
import 'dart:io'; import 'dart:io';
import 'dart:convert'; import 'dart:convert';
@ -98,18 +99,14 @@ enum PlayerState { disabled, indexFile, inStory }
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
String myPath = 'fffff'; String myPath = 'fffff';
IndexFile indexFile = IndexFile(); IndexFile indexFile = IndexFile();
String currentImage = 'assets/320x240.png'; String currentImage = 'assets/logo.png';
final player = AudioPlayer(); final player = AudioPlayer();
StreamSubscription? mediaPub; StreamSubscription? mediaPub;
PlayerState state = PlayerState.disabled; PlayerState state = PlayerState.disabled;
StreamSubscription? audioPlayerSub; 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 { void initPaths() async {
Directory? dir; Directory? dir;
@ -221,7 +218,10 @@ class _MyHomePageState extends State<MyHomePage> {
); );
}).toList(); }).toList();
}, },
), ),
const Divider()
, const Text("v1.1")
], ],
), ),
body: Center( body: Center(

View file

@ -1,11 +0,0 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
void fl_register_plugins(FlPluginRegistry* registry) {
}

View file

@ -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)

View file

@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) { if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar)); 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_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else { } else {
gtk_window_set_title(window, "flutter_launcher"); gtk_window_set_title(window, "Story Player");
} }
gtk_window_set_default_size(window, 1280, 720); gtk_window_set_default_size(window, 1280, 720);

View file

@ -103,5 +103,5 @@ flutter:
# For details regarding fonts from package dependencies, # For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages # see https://flutter.dev/custom-fonts/#from-packages
assets: assets:
- assets/320x240.png - assets/logo.png