chitr icon indicating copy to clipboard operation
chitr copied to clipboard

Added image download functionality

Open bimsina opened this issue 5 years ago • 5 comments

bimsina avatar Dec 21 '19 04:12 bimsina

Getting these messages while running your branch.

Compiler message:
Error: Could not resolve the package 'image_downloader' in 'package:image_downloader/image_downloader.dart'.
Error: Could not resolve the package 'permission_handler' in 'package:permission_handler/permission_handler.dart'.
lib/screens/image_page.dart:7:8: Error: Not found: 'package:image_downloader/image_downloader.dart'
import 'package:image_downloader/image_downloader.dart';
       ^
lib/screens/image_page.dart:8:8: Error: Not found: 'package:permission_handler/permission_handler.dart'
import 'package:permission_handler/permission_handler.dart';
       ^
lib/screens/image_page.dart:267:7: Error: 'PermissionStatus' isn't a type.
      PermissionStatus status = await PermissionHandler()
      ^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:267:39: Error: The method 'PermissionHandler' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing method, or defining a method named 'PermissionHandler'.
      PermissionStatus status = await PermissionHandler()
                                      ^^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:268:34: Error: The getter 'PermissionGroup' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PermissionGroup'.
          .checkPermissionStatus(PermissionGroup.storage);
                                 ^^^^^^^^^^^^^^^
lib/screens/image_page.dart:270:21: Error: The getter 'PermissionStatus' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PermissionStatus'.
      if (status == PermissionStatus.granted) {
                    ^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:274:31: Error: The getter 'ImageDownloader' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'ImageDownloader'.
          var imageId = await ImageDownloader.downloadImage(
                              ^^^^^^^^^^^^^^^
lib/screens/image_page.dart:276:28: Error: The getter 'AndroidDestinationType' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'AndroidDestinationType'.
              destination: AndroidDestinationType.directoryDownloads);
                           ^^^^^^^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:293:5: Error: 'PermissionStatus' isn't a type.
    PermissionStatus status = await PermissionHandler()
    ^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:292:11: Error: The method 'PermissionHandler' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing method, or defining a method named 'PermissionHandler'.
    await PermissionHandler().requestPermissions([PermissionGroup.storage]);
          ^^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:292:51: Error: The getter 'PermissionGroup' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PermissionGroup'.
    await PermissionHandler().requestPermissions([PermissionGroup.storage]);
                                                  ^^^^^^^^^^^^^^^
lib/screens/image_page.dart:293:37: Error: The method 'PermissionHandler' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing method, or defining a method named 'PermissionHandler'.
    PermissionStatus status = await PermissionHandler()
                                    ^^^^^^^^^^^^^^^^^
lib/screens/image_page.dart:294:32: Error: The getter 'PermissionGroup' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PermissionGroup'.
        .checkPermissionStatus(PermissionGroup.storage);
                               ^^^^^^^^^^^^^^^
lib/screens/image_page.dart:295:19: Error: The getter 'PermissionStatus' isn't defined for the class '_ImagePageState'.
 - '_ImagePageState' is from 'package:chitr/screens/image_page.dart' ('lib/screens/image_page.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PermissionStatus'.
    if (status == PermissionStatus.granted) {

divyanshub024 avatar Dec 29 '19 08:12 divyanshub024

Sorry, the issue was with my compiler. Ignore the above message.

divyanshub024 avatar Dec 29 '19 08:12 divyanshub024

When I click on download button it shows me Toast that "Check notification to see progress" but there is no notification.

divyanshub024 avatar Dec 29 '19 08:12 divyanshub024

Are you running on emulator or real device? It works fine on the devices I have tested. I have implemented the same download module here : https://github.com/bimsina/reWalls .

bimsina avatar Dec 29 '19 14:12 bimsina

@bimsina I was running on the real device. Although after a couple of hours I got all those notifications. Let me check why That was happening.

divyanshub024 avatar Dec 31 '19 06:12 divyanshub024