Skip to content

Commit

Permalink
Update to BJ 0.0.9
Browse files Browse the repository at this point in the history
Fix camera support
Tweak alignment in Windows Titlebar
  • Loading branch information
esDotDev committed Mar 14, 2021
1 parent 3f0b610 commit da6c8cc
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ class WindowsTitleBar extends StatelessWidget {
MoveWindow(),
child,
Align(
alignment: Alignment.centerRight,
alignment: Alignment.topRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
//Container(height: 40, width: 40, color: Colors.red),
MinimizeWindowButton(colors: _btnColors),
MaximizeWindowButton(colors: _btnColors),
CloseWindowButton(),
Expand Down
41 changes: 24 additions & 17 deletions lib/commands/pick_images_command.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import 'package:file_selector/file_selector.dart';
import 'package:flutter_absolute_path/flutter_absolute_path.dart';
import 'package:flutter_folio/_utils/device_info.dart';
import 'package:flutter_folio/_utils/string_utils.dart';
import 'package:flutter_folio/commands/commands.dart';
import 'package:image_picker/image_picker.dart';
import 'package:multi_image_picker/multi_image_picker.dart';

class PickedImage {
String path;
Asset asset;
}

/// Due to differences in platforms, this Command will return either a list of plain string paths
/// or, when multi-picking images it returns a list of [Asset]s. This is due to implementation details
/// on modern phones, where you may not get a true path to the file, rather you get some sort of promise.
class PickImagesCommand extends BaseAppCommand {
Future<List<PickedImage>> run({bool allowMultiple = false, bool enableCamera = true}) async {
List<PickedImage> images = [];
Expand All @@ -18,21 +20,26 @@ class PickImagesCommand extends BaseAppCommand {
images =
(await openFiles(acceptedTypeGroups: [typeGroup])).map((file) => PickedImage()..path = file.path).toList();
} else {
int maxImages = 24; // Need to pick some limit
// Get assets
List<Asset> assets = await MultiImagePicker.pickImages(
materialOptions: MaterialOptions(
actionBarColor: "#${appTheme.accent1.value.toRadixString(16).substring(2, 8)}",
actionBarTitle: "Pick Scraps",
statusBarColor: "#${appTheme.accent1.value.toRadixString(16).substring(2, 8)}",
allViewTitle: "All Photos",
useDetailsView: false,
selectCircleStrokeColor: "#000000",
),
enableCamera: true,
maxImages: allowMultiple ? maxImages : 1);
for (var asset in assets) {
images.add(PickedImage()..asset = asset);
if (enableCamera) {
final picker = ImagePicker();
images = [PickedImage()..path = (await picker.getImage(source: ImageSource.camera)).path];
} else {
int maxImages = 24; // Need to pick some limit
// Get assets
List<Asset> assets = await MultiImagePicker.pickImages(
materialOptions: MaterialOptions(
actionBarColor: "#${appTheme.accent1.value.toRadixString(16).substring(2, 8)}",
actionBarTitle: "Pick Scraps",
statusBarColor: "#${appTheme.accent1.value.toRadixString(16).substring(2, 8)}",
allViewTitle: "All Photos",
useDetailsView: false,
selectCircleStrokeColor: "#000000",
),
enableCamera: true,
maxImages: allowMultiple ? maxImages : 1);
for (var asset in assets) {
images.add(PickedImage()..asset = asset);
}
}
}
return images;
Expand Down
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

#include "generated_plugin_registrant.h"

#include <bitsdojo_window_linux/bitsdojo_window_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <menubar/menubar_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_size/window_size_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) bitsdojo_window_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "BitsdojoWindowPlugin");
bitsdojo_window_plugin_register_with_registrar(bitsdojo_window_linux_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
Expand Down
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
bitsdojo_window_linux
file_selector_linux
menubar
url_launcher_linux
Expand Down
16 changes: 8 additions & 8 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ packages:
name: bitsdojo_window
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.8"
version: "0.0.9"
bitsdojo_window_linux:
dependency: transitive
description:
name: bitsdojo_window_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1"
bitsdojo_window_macos:
dependency: transitive
description:
Expand Down Expand Up @@ -416,13 +423,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_absolute_path:
dependency: "direct main"
description:
name: flutter_absolute_path
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.6"
flutter_blurhash:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
git:
url: git://github.com/gskinnerTeam/auto_size_text.git
ref: 8800276218b053265ffc796a24e84820bebaaeac
bitsdojo_window: ^0.0.5
bitsdojo_window: ^0.0.9
cached_network_image: ^2.5.0
cloudinary_public: ^0.7.0
darq: ^0.4.0+1
Expand Down

0 comments on commit da6c8cc

Please sign in to comment.