16 changed files with 153 additions and 193 deletions
			
			
		| 
		 After Width: | Height: | Size: 70 KiB  | 
| 
		 After Width: | Height: | Size: 52 KiB  | 
@ -1,2 +1,3 @@
					 | 
				
			||||
https://iconduck.com/icons/94312/flutter | 
				
			||||
https://iconduck.com/icons/54169/package | 
				
			||||
https://iconduck.com/illustrations/108225/gingerbread-man-christmas-treat-candy-cartoon | 
				
			||||
					 | 
				
			||||
@ -0,0 +1,8 @@
					 | 
				
			||||
import 'package:flutter/widgets.dart'; | 
				
			||||
import 'package:scoped_model/scoped_model.dart'; | 
				
			||||
 | 
				
			||||
/// Model for [PhotoViewPage] | 
				
			||||
class PhotoViewModel extends Model { | 
				
			||||
  /// Get [ScopedModel] | 
				
			||||
  static PhotoViewModel of(BuildContext context) => ScopedModel.of<PhotoViewModel>(context); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,23 @@
					 | 
				
			||||
import 'package:flutter_example_packages/base/package/package_page.dart'; | 
				
			||||
import 'package:flutter_example_packages/packages/photo_view/page.dart'; | 
				
			||||
import 'package:get_it/get_it.dart'; | 
				
			||||
 | 
				
			||||
import 'model.dart'; | 
				
			||||
 | 
				
			||||
/// Package values | 
				
			||||
final packagePhotoView = PackagePage( | 
				
			||||
  key: 'photo_view', | 
				
			||||
  descEN: ''' | 
				
			||||
    A simple zoomable image/content widget for Flutter. | 
				
			||||
    ''', | 
				
			||||
  descRU: ''' | 
				
			||||
    Простой масштабируемый виджет изображения/контента для Flutter. | 
				
			||||
    ''', | 
				
			||||
  version: '0.14.0', | 
				
			||||
  isPlatformDependent: false, | 
				
			||||
  page: () => PhotoViewPage(), | 
				
			||||
  init: () { | 
				
			||||
    GetIt.instance.registerFactory<PhotoViewModel>( | 
				
			||||
        () => PhotoViewModel()); | 
				
			||||
  }, | 
				
			||||
); | 
				
			||||
@ -0,0 +1,82 @@
					 | 
				
			||||
import 'package:flutter/material.dart'; | 
				
			||||
import 'package:flutter_example_packages/base/di/app_di.dart'; | 
				
			||||
import 'package:flutter_example_packages/base/package/package.dart'; | 
				
			||||
import 'package:flutter_example_packages/packages/photo_view/model.dart'; | 
				
			||||
import 'package:flutter_example_packages/packages/photo_view/package.dart'; | 
				
			||||
import 'package:flutter_example_packages/theme/radius.dart'; | 
				
			||||
import 'package:flutter_example_packages/widgets/base/export.dart'; | 
				
			||||
import 'package:flutter_example_packages/widgets/blocks/block_info_package.dart'; | 
				
			||||
import 'package:flutter_example_packages/widgets/layouts/block_layout.dart'; | 
				
			||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | 
				
			||||
import 'package:photo_view/photo_view.dart'; | 
				
			||||
 | 
				
			||||
class PhotoViewPage extends AppStatefulWidget { | 
				
			||||
  PhotoViewPage({ | 
				
			||||
    super.key, | 
				
			||||
  }); | 
				
			||||
 | 
				
			||||
  final Package package = packagePhotoView; | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  State<PhotoViewPage> createState() => _PhotoViewPageState(); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class _PhotoViewPageState extends AppState<PhotoViewPage> { | 
				
			||||
  double _heightPhotoView = 1; | 
				
			||||
  final _keyPhotoView = GlobalKey(); | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  void onDidChangeMetrics() { | 
				
			||||
    setState(() { | 
				
			||||
      _heightPhotoView = _getHeightPhotoView(); | 
				
			||||
    }); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Widget buildWide( | 
				
			||||
    BuildContext context, | 
				
			||||
    MediaQueryData media, | 
				
			||||
    AppLocalizations l10n, | 
				
			||||
  ) { | 
				
			||||
    return BlockLayout<PhotoViewModel>( | 
				
			||||
      model: getIt<PhotoViewModel>(), | 
				
			||||
      title: widget.package.key, | 
				
			||||
      builder: (context, child, model) { | 
				
			||||
        return SingleChildScrollView( | 
				
			||||
          child: Padding( | 
				
			||||
            padding: const EdgeInsets.all(20), | 
				
			||||
            child: Column( | 
				
			||||
              crossAxisAlignment: CrossAxisAlignment.start, | 
				
			||||
              children: [ | 
				
			||||
                BlockInfoPackage(widget.package), | 
				
			||||
                ClipRRect( | 
				
			||||
                  borderRadius: AppRadius.small, | 
				
			||||
                  child: SizedBox( | 
				
			||||
                    key: _keyPhotoView, | 
				
			||||
                    width: double.infinity, | 
				
			||||
                    height: _heightPhotoView, | 
				
			||||
                    child: PhotoView( | 
				
			||||
                      imageProvider: | 
				
			||||
                          const AssetImage("assets/images/large_image.jpg"), | 
				
			||||
                    ), | 
				
			||||
                  ), | 
				
			||||
                ), | 
				
			||||
              ], | 
				
			||||
            ), | 
				
			||||
          ), | 
				
			||||
        ); | 
				
			||||
      }, | 
				
			||||
    ); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  double _getHeightPhotoView() { | 
				
			||||
    if (_keyPhotoView.currentContext != null) { | 
				
			||||
      RenderBox? box = | 
				
			||||
          _keyPhotoView.currentContext?.findRenderObject() as RenderBox; | 
				
			||||
      Offset position = | 
				
			||||
          box.localToGlobal(Offset.zero); //this is global position | 
				
			||||
      return MediaQuery.of(context).size.height - position.dy - 20; | 
				
			||||
    } | 
				
			||||
    return 1; | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -1,99 +0,0 @@
					 | 
				
			||||
#!/bin/bash | 
				
			||||
 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
## Build example, sign rpm, upload/install/run rpm to device | 
				
			||||
 | 
				
			||||
## Usage | 
				
			||||
## | 
				
			||||
## chmod +x ./build_example.sh | 
				
			||||
## | 
				
			||||
## ./build_example.sh \ | 
				
			||||
##   -p xdga_directories \ | 
				
			||||
##   -d <ip>:<password> \ | 
				
			||||
##   -s /home/user/sign/system_keys | 
				
			||||
 | 
				
			||||
## Flutter path | 
				
			||||
FLUTTER="$HOME/.local/opt/flutter-sdk/bin/flutter" | 
				
			||||
 | 
				
			||||
## https://developer.auroraos.ru/doc/software_development/psdk/setup | 
				
			||||
## Install Platform SDK path | 
				
			||||
## You may not have set the PSDK_DIR environment variable. | 
				
			||||
## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk | 
				
			||||
 | 
				
			||||
while getopts p:d:s: flag; do | 
				
			||||
  case "${flag}" in | 
				
			||||
  p) package=${OPTARG} ;; | 
				
			||||
  d) device=${OPTARG} ;; | 
				
			||||
  s) sign=${OPTARG} ;; | 
				
			||||
  *) | 
				
			||||
    echo "usage: $0 [-p] [-d] [-s]" >&2 | 
				
			||||
    exit 1 | 
				
			||||
    ;; | 
				
			||||
  esac | 
				
			||||
done | 
				
			||||
 | 
				
			||||
if [ -z "$package" ]; then | 
				
			||||
  echo "Specify a build package" | 
				
			||||
  exit | 
				
			||||
else | 
				
			||||
  cd "../packages/$package" 2>/dev/null || eval 'echo "Package \"$package\" not found." && exit' | 
				
			||||
  ## Update dependency | 
				
			||||
  $FLUTTER pub get | 
				
			||||
  ## Run ffigen if has | 
				
			||||
  $FLUTTER pub run ffigen --config ffigen.yaml  2>/dev/null | 
				
			||||
  ## Open example dir | 
				
			||||
  cd "example" || exit | 
				
			||||
  ## Build aurora example app | 
				
			||||
  { | 
				
			||||
      $FLUTTER build aurora --release | 
				
			||||
  } || { | 
				
			||||
    exit 1; | 
				
			||||
  } | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if [ -n "$sign" ]; then | 
				
			||||
 | 
				
			||||
  key=$(ls "$sign"/*key.pem) | 
				
			||||
 | 
				
			||||
  if [ -z "$key" ]; then | 
				
			||||
    echo "Key *key.pem not found." | 
				
			||||
    exit | 
				
			||||
  fi | 
				
			||||
 | 
				
			||||
  cert=$(ls "$sign"/*cert.pem) | 
				
			||||
 | 
				
			||||
  if [ -z "$cert" ]; then | 
				
			||||
    echo "Key *cert.pem not found." | 
				
			||||
    exit | 
				
			||||
  fi | 
				
			||||
 | 
				
			||||
  ## Sign rpm system key | 
				
			||||
  "$PSDK_DIR"/sdk-chroot rpmsign-external sign \ | 
				
			||||
    --key "$key" \ | 
				
			||||
    --cert "$cert" \ | 
				
			||||
    build/aurora/arm/release/RPMS/*.rpm | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if [ -n "$device" ]; then | 
				
			||||
 | 
				
			||||
  IFS=':' read -ra ADDR <<< "$device" | 
				
			||||
  IFS='/' read -ra ADDP <<< "$package" | 
				
			||||
 | 
				
			||||
  D_IP="${ADDR[0]}" | 
				
			||||
  D_PASS="${ADDR[1]}" | 
				
			||||
  APP_KEY="${ADDP[-1]}" | 
				
			||||
 | 
				
			||||
  # shellcheck disable=SC2012 | 
				
			||||
  rpm=$(ls "$PWD"/build/aurora/arm/release/RPMS/*.rpm | sort -r | head -n 1) | 
				
			||||
 | 
				
			||||
  # upload rpm | 
				
			||||
  scp "$rpm" defaultuser@"$D_IP:/home/defaultuser/Downloads" | 
				
			||||
 | 
				
			||||
  # install rpm | 
				
			||||
  ssh -t defaultuser@$D_IP "echo $D_PASS | devel-su pkcon -y install-local /home/defaultuser/Downloads/*$APP_KEY*.rpm"  | 
				
			||||
 | 
				
			||||
  # run application | 
				
			||||
  ssh -t defaultuser@$D_IP "/usr/bin/com.example.${APP_KEY}_example" | 
				
			||||
fi | 
				
			||||
@ -1,67 +0,0 @@
					 | 
				
			||||
#!/bin/bash | 
				
			||||
 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
## Script create c_cpp_properties.json with dependencies for flutter aurora | 
				
			||||
 | 
				
			||||
## Usage | 
				
			||||
## | 
				
			||||
## chmod +x ./vscode_properties.sh | 
				
			||||
## ./vscode_properties.sh | 
				
			||||
 | 
				
			||||
## https://developer.auroraos.ru/doc/software_development/psdk/setup | 
				
			||||
## Install Platform SDK path | 
				
			||||
## You may not have set the PSDK_DIR environment variable. | 
				
			||||
## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk | 
				
			||||
 | 
				
			||||
cd ../ | 
				
			||||
 | 
				
			||||
## check file | 
				
			||||
[ -f .vscode/c_cpp_properties.json ] && { echo "File c_cpp_properties.json already exist!"; exit; } | 
				
			||||
 | 
				
			||||
## find target | 
				
			||||
TARGET=$($PSDK_DIR/sdk-chroot sdk-assistant list | grep armv | grep default | sed 's/^.*A/A/g' | sed 's/\s.*//g') | 
				
			||||
 | 
				
			||||
## mkdir .vscode if not exist | 
				
			||||
[ -d .vscode ] || mkdir .vscode | 
				
			||||
 | 
				
			||||
## find targets path | 
				
			||||
TARGETS_PATH=$(cd "$PSDK_DIR/../../" && pwd)/targets | 
				
			||||
 | 
				
			||||
## save file | 
				
			||||
tee -a .vscode/c_cpp_properties.json << END | 
				
			||||
{ | 
				
			||||
    "configurations": [ | 
				
			||||
        { | 
				
			||||
            "name": "Linux", | 
				
			||||
            "includePath": [ | 
				
			||||
                "\${workspaceFolder}/**", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/dconf", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/flutter-embedder", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/maliit", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/appmanifest-cpp", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/glib-2.0", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/lib/glib-2.0/include", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/sailfishapp", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5/QtConcurrent", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5/QtCore", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5/QtDBus", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5/QtGui", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5/QtMultimedia", | 
				
			||||
                "$TARGETS_PATH/$TARGET/usr/include/qt5/QtQuick" | 
				
			||||
            ], | 
				
			||||
            "defines": [ | 
				
			||||
                "__ARM_PCS_VFP" | 
				
			||||
            ], | 
				
			||||
            "compilerPath": "/usr/bin/g++", | 
				
			||||
            "cStandard": "c17", | 
				
			||||
            "cppStandard": "c++17", | 
				
			||||
            "intelliSenseMode": "clang-x64" | 
				
			||||
        } | 
				
			||||
    ], | 
				
			||||
    "version": 4 | 
				
			||||
} | 
				
			||||
END | 
				
			||||
					Loading…
					
					
				
		Reference in new issue