Skip to content

Commit

Permalink
Export project (#219)
Browse files Browse the repository at this point in the history
* Backup project option

* Bump version
  • Loading branch information
ruskakimov authored Aug 12, 2021
1 parent 09d094e commit a66f7d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/home/ui/project_thumbnail.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'dart:io';
import 'package:archive/archive_io.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:mooltik/common/data/project/project.dart';
import 'package:mooltik/common/ui/labeled_icon_button.dart';
import 'package:mooltik/common/ui/popup_with_arrow.dart';
import 'package:mooltik/drawing/ui/frame_window.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';

import '../data/gallery_model.dart';

Expand Down Expand Up @@ -110,6 +112,12 @@ class _ProjectThumbnailState extends State<ProjectThumbnail> {
color: Theme.of(context).colorScheme.onPrimary,
onTap: _moveToBin,
),
LabeledIconButton(
icon: FontAwesomeIcons.fileArchive,
label: 'Backup',
color: Theme.of(context).colorScheme.onPrimary,
onTap: _exportBackup,
),
],
),
);
Expand All @@ -128,6 +136,13 @@ class _ProjectThumbnailState extends State<ProjectThumbnail> {
void _moveToBin() {
context.read<GalleryModel>().moveProjectToBin(context.read<Project>());
}

void _exportBackup() async {
final project = context.read<Project>();
final zipEncoder = ZipFileEncoder();
zipEncoder.zipDirectory(project.directory);
await Share.shareFiles([zipEncoder.zip_path]);
}
}

class _Thumbnail extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.14.1
version: 1.15.0

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit a66f7d5

Please sign in to comment.