Skip to content

Commit

Permalink
Audio, AudioRecorder, Video and WebView controls moved to sep…
Browse files Browse the repository at this point in the history
…arate Flutter packages (#2579)

* `Audio` control moved to a separate `flet_audio` package

* Run Flutter job only

* Run dry run

* remove cd -

* Removed custom control example

* Fix flutter warnings

* `Video` control moved to `flet_video` library

* Added flet_video to the build

* AudioRecorder control moved to flet_audio_recorder package

* WebView control moved to flet_webview package

* Remove .flutter-plugins

* Ignore .flutter-plugins

* Enable all CI jobs

* `flet build` to support flutter extra packages

* Disable Build Flet for iOS job

* 0.20.0 changelogs, readmeas
  • Loading branch information
FeodorFitsner committed Feb 10, 2024
1 parent 946a2fd commit fe1a4d1
Show file tree
Hide file tree
Showing 330 changed files with 1,126 additions and 3,883 deletions.
67 changes: 56 additions & 11 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,70 @@ for:
install:
- ps: |
if ($env:APPVEYOR_REPO_TAG_NAME) {
$v = $env:APPVEYOR_REPO_TAG_NAME.replace("v", "")
$env:PKG_VER = $env:APPVEYOR_REPO_TAG_NAME.replace("v", "")
} else {
$cv = [version](git describe --abbrev=0).substring(1)
$v = "$($cv.major).$($cv.minor+1).0+$($env:APPVEYOR_BUILD_NUMBER)"
$env:PKG_VER = "$($cv.major).$($cv.minor+1).0+$($env:APPVEYOR_BUILD_NUMBER)"
}
Update-AppveyorBuild -Version $v
Update-AppveyorBuild -Version $env:PKG_VER
- flutter upgrade --force

build_script:
- cd package
- flutter test

deploy_script:
# publish package
- sh: |
if [[ "$APPVEYOR_REPO_TAG_NAME" != "" ]]; then
mkdir -p $HOME/.config/dart
echo $PUB_DEV_TOKEN | base64 --decode > $HOME/.config/dart/pub-credentials.json
dart pub publish --force
mkdir -p $HOME/.config/dart
echo $PUB_DEV_TOKEN | base64 --decode > $HOME/.config/dart/pub-credentials.json
# patch pubspecs
python3 ci/patch_pubspec.py packages/flet/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py packages/flet_audio/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py packages/flet_audio_recorder/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py packages/flet_video/pubspec.yaml $PKG_VER
python3 ci/patch_pubspec.py packages/flet_webview/pubspec.yaml $PKG_VER
cd packages/flet
flutter test
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_audio
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_audio_recorder
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_video
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_webview
dart pub publish --force || exit 1
cd $APPVEYOR_BUILD_FOLDER
else
cd packages/flet
flutter test
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_audio
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_audio_recorder
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_video
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
cd packages/flet_webview
dart pub publish --dry-run
cd $APPVEYOR_BUILD_FOLDER
fi
# ======================================
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Flet changelog

# 0.20.0

* `--include-packages` option and support for `pubspec.yaml` for custom Flutter packages plus API for adding custom Flutter packages.
* Add `rtl` property to multiple controls ([#2582](https://github.com/flet-dev/flet/issues/2582)).
* Fix: Material icon is shown instead of Cupertino icon if its name is thesame ([#2581](https://github.com/flet-dev/flet/issues/2581)).
* `TextStyle.letter_spacing`property ([#2574](https://github.com/flet-dev/flet/issues/2574)).
* `Audio`, `AudioRecorder`, `Video` and `WebView` controls moved into separate Flutter packages ([#2579](https://github.com/flet-dev/flet/issues/2579)).
* Introduced `Control.on_update()` overridable method ([#2578](https://github.com/flet-dev/flet/issues/2578)).
* New `AlertDialog` properties: `icon`, `bgcolor`, `elevation`.
* `expand_loose` property for Control and all controls that have `expand` property ([#2561](https://github.com/flet-dev/flet/issues/2561)).
* Pyodide v0.25.0.
* `flet create` command to show verbose output ([#2544](https://github.com/flet-dev/flet/issues/2544)).
* `AudioRecorder` control ([#2494](https://github.com/flet-dev/flet/issues/2494)).
* Bugfix: `flet pack --distpath` deletes `dist` directory ([#2500](https://github.com/flet-dev/flet/issues/2500)).
* Added recursive `adaptive` property to all container-alike controls.
* `TextField.text_vertical_align` property ([#2496](https://github.com/flet-dev/flet/issues/2496)).
* `CupertinoButton` Control ([#2495](https://github.com/flet-dev/flet/issues/2495)).
* `CupertinoListTile` control ([#2487](https://github.com/flet-dev/flet/issues/2487)).
* Support for custom Flutter controls ([#2482](https://github.com/flet-dev/flet/issues/2482)).
* `Pagelet` control ([#2469](https://github.com/flet-dev/flet/issues/2469)).
* Add `AppBar.adaptive` ([#2458](https://github.com/flet-dev/flet/issues/2458)).
* Cupertino Icons and Colors ([#2433](https://github.com/flet-dev/flet/issues/2433)).
* `CupertinoTextfield` control ([#2417](https://github.com/flet-dev/flet/issues/2417)).
* `FloatingActionButtonLocation` offset ([#2411](https://github.com/flet-dev/flet/issues/2411)).

# 0.19.0

* `flet build` to apply Python SSL fix when packaging for iOS and Android ([#2349](https://github.com/flet-dev/flet/issues/2349)).
Expand Down
32 changes: 32 additions & 0 deletions ci/patch_pubspec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import pathlib
import sys

import yaml

if len(sys.argv) < 3:
print("Specify pubspec.yaml file and version to patch")
sys.exit(1)

current_dir = pathlib.Path(os.getcwd())
pubspec_path = current_dir.joinpath(current_dir, sys.argv[1])
ver = sys.argv[2]
print(f"Patching pubspec.yaml file {pubspec_path} with {ver}")

dependencies = [
"flet",
]

with open(pubspec_path, "r") as f:
data = yaml.safe_load(f)

# patch version
data["version"] = ver

# patch dependencies
for dep in data["dependencies"]:
if dep in dependencies:
data["dependencies"][dep] = f"^{ver}"
# print(dep)
with open(pubspec_path, "w") as file:
yaml.dump(data, file, sort_keys=False)
21 changes: 17 additions & 4 deletions client/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import 'dart:io';

import 'package:flet/flet.dart';
import 'package:flet_audio/flet_audio.dart' as flet_audio;
import 'package:flet_audio_recorder/flet_audio_recorder.dart'
as flet_audio_recorder;
import 'package:flet_video/flet_video.dart' as flet_video;
import 'package:flet_webview/flet_webview.dart' as flet_webview;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:media_kit/media_kit.dart';
import 'package:url_strategy/url_strategy.dart';

const bool isProduction = bool.fromEnvironment('dart.vm.product');
Expand All @@ -16,6 +20,12 @@ void main([List<String>? args]) async {

await setupDesktop();

WidgetsFlutterBinding.ensureInitialized();
flet_audio.ensureInitialized();
flet_audio_recorder.ensureInitialized();
flet_video.ensureInitialized();
flet_webview.ensureInitialized();

var pageUrl = Uri.base.toString();
var assetsDir = "";
//debugPrint("Uri.base: ${Uri.base}");
Expand Down Expand Up @@ -66,13 +76,16 @@ void main([List<String>? args]) async {
};
}

WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();

runApp(FletApp(
title: 'Flet',
pageUrl: pageUrl,
assetsDir: assetsDir,
errorsHandler: errorsHandler,
createControlFactories: [
flet_audio.createControl,
flet_audio_recorder.createControl,
flet_video.createControl,
flet_webview.createControl
],
));
}
36 changes: 32 additions & 4 deletions client/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,38 @@ packages:
flet:
dependency: "direct main"
description:
path: "../package"
path: "../packages/flet"
relative: true
source: path
version: "0.19.0"
version: "0.20.0"
flet_audio:
dependency: "direct main"
description:
path: "../packages/flet_audio"
relative: true
source: path
version: "0.20.0"
flet_audio_recorder:
dependency: "direct main"
description:
path: "../packages/flet_audio_recorder"
relative: true
source: path
version: "0.20.0"
flet_video:
dependency: "direct main"
description:
path: "../packages/flet_video"
relative: true
source: path
version: "0.20.0"
flet_webview:
dependency: "direct main"
description:
path: "../packages/flet_webview"
relative: true
source: path
version: "0.20.0"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -599,7 +627,7 @@ packages:
source: hosted
version: "4.2.4"
record:
dependency: "direct main"
dependency: transitive
description:
name: record
sha256: "5c8e12c692a4800b33f5f8b6c821ea083b12bfdbd031b36ba9322c40a4eeecc9"
Expand Down Expand Up @@ -1148,5 +1176,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0 <4.0.0"
dart: ">=3.2.3 <4.0.0"
flutter: ">=3.16.0"
11 changes: 9 additions & 2 deletions client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ dependencies:
sdk: flutter

flet:
path: ../package/
path: ../packages/flet
flet_audio:
path: ../packages/flet_audio
flet_audio_recorder:
path: ../packages/flet_audio_recorder
flet_video:
path: ../packages/flet_video
flet_webview:
path: ../packages/flet_webview

url_strategy: ^0.2.0
record: ^5.0.4
cupertino_icons: ^1.0.6

integration_test:
Expand Down
7 changes: 0 additions & 7 deletions package/example/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions package/example/my_controls/CHANGELOG.md

This file was deleted.

3 changes: 0 additions & 3 deletions package/example/my_controls/README.md

This file was deleted.

33 changes: 0 additions & 33 deletions package/example/my_controls/example/.metadata

This file was deleted.

16 changes: 0 additions & 16 deletions package/example/my_controls/example/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions package/example/my_controls/example/analysis_options.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions package/example/my_controls/example/lib/main.dart

This file was deleted.

7 changes: 0 additions & 7 deletions package/example/my_controls/example/macos/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit fe1a4d1

Please sign in to comment.