Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shareand delete #42

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Shareand delete #42

wants to merge 5 commits into from

Conversation

Bibhukiju
Copy link
Contributor

functions added

  • share and delete pdf within an app

  • toast msg to alert user about pdf is created and deleted

@@ -43,6 +44,10 @@ Future cropImage(String imagepath, Function(String) onCrop) async {
}
}

void showToast(String msg) {
Fluttertoast.showToast(msg: msg, gravity: ToastGravity.BOTTOM);
Copy link
Collaborator

@cimplesid cimplesid Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get.showSnackbar() use this remove fluttertoast

@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:fluttertoast/fluttertoast.dart';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow ladder import

@@ -27,4 +28,7 @@ class ImageToPdfController extends GetxController {
}

void removeImage(int index) => _images.removeAt(index);
void showToast(String msg) {
Fluttertoast.showToast(msg: msg, gravity: ToastGravity.BOTTOM);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toast to get

@@ -7,6 +7,7 @@ import 'package:EasyScan/Utils/constants.dart';
import 'package:EasyScan/widgets/history_card.dart';
import 'package:EasyScan/Utils/permission_checker.dart';
import 'package:native_pdf_renderer/native_pdf_renderer.dart';
import 'package:share/share.dart';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lader import

final file = dd.File(fileSystemEntitys[index].path);
file.delete(recursive: false);
} catch (e) {
//error will be here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refresh file

_savedPdfController.refreshFiles();
_savedPdfController.deleteFile(i);
showToast("Pdf has been deleted");
Get.to(HomeScreen());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't go back

onPressed: () {
_imageToPdfController.exportToPdf();
showToast("Pdf has been created");
Get.to(HomeScreen());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't navigate

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';

class ShareDelOption extends StatelessWidget {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better naming like customRow or customDialogOption

class ShareDelOption extends StatelessWidget {
final IconData iconData;
final String title;
final Color color;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iconColor

return Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either user Icon as parameter or give default value to color

final IconData iconData;
final String title;
final Color color;
const ShareDelOption({Key key, this.iconData, this.title, this.color})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make iconData & title required

@@ -42,6 +43,19 @@ class PdfController extends GetxController {
}
}

void share({int index}) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make index required parameter remove curly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants