Giter VIP home page Giter VIP logo

storagepath's People

Contributors

ashish-jajoria avatar follow2vivek avatar nooralibutt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

storagepath's Issues

File path returns {}, {}, {}, {}

Code
files = await StoragePath.videoPath;
The output
"files":[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}....

build failures, try to see if this plugin supports the Android V2 embedding

when I run last version from github I get this error

The plugin storage_path uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.

Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

I was trying to display images from my device storage into a gridview as you did in your FlutterGallery App.
My current code look like this.

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:wallpapers_app/display.dart';
import 'package:storage_path/storage_path.dart';
import 'package:wallpapers_app/image_model.dart';

class Downloads extends StatefulWidget {
  int width;
  int height;
  Downloads(this.width, this.height);
  @override
  _DownloadsState createState() => _DownloadsState();
}

class _DownloadsState extends State<Downloads>
    with AutomaticKeepAliveClientMixin {
  final Color loadingTextColor = Color(0xFF000000);
  final Color bgColor = Color(0xFFFFFFFF);

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  List data = [];
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 720, height: 1440, allowFontScaling: true);
    return FutureBuilder(
        future: StoragePath.imagesPath,
        builder: (BuildContext context, AsyncSnapshot snapshot) {
          if (snapshot.hasData) {
            List<dynamic> data = json.decode(snapshot.data);
            print("Done");

            return new Container(
                color: bgColor,
                child: Scrollbar(
                  child: GridView.builder(
                      shrinkWrap: true,
                      padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
                      itemCount: data.length,
                      gridDelegate:
                          new SliverGridDelegateWithFixedCrossAxisCount(
                              crossAxisCount: 2, childAspectRatio: 0.75),
                      itemBuilder: (BuildContext context, int index) {
                        ImageModel imageModel =
                            ImageModel.fromJson(data[index]);
                        return new GestureDetector(
                          child: Stack(
                            alignment: Alignment.center,
                            children: <Widget>[
                              Positioned.fill(
                                child: new Card(
                                  shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(24))),
                                  elevation: 0.0,
                                  semanticContainer: true,
                                  margin: EdgeInsets.fromLTRB(4, 4, 4, 4),
                                  clipBehavior: Clip.antiAliasWithSaveLayer,
                                  child: new Container(
                                      child: new Hero(
                                          tag: data[index]["url"],
                                          child: Image(
                                            image: FileImage(
                                              File(imageModel.files[0]),
                                            ),
                                            fit: BoxFit.cover,
                                          ))),
                                ),
                              ),
                            ],
                          ),
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) {
                                  return Display(
                                      data[index]["url"],
                                      data[index]["thumb"],
                                      data[index]["color"],
                                      data[index]["color2"],
                                      data[index]["views"],
                                      data[index]["resolution"],
                                      "https://whvn.cc/${data[index]["id"]}",
                                      data[index]["created"],
                                      data[index]["fav"]);
                                },
                              ),
                            );
                          },
                        );
                      }),
                ));
          }
          return Container(
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Image(
                    image: AssetImage("assets/images/loading.png"),
                    height: 600.h,
                    width: 600.w,
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 8),
                    child: Text(
                      "Loading",
                      style: GoogleFonts.raleway(
                          fontSize: 30, color: loadingTextColor),
                      textAlign: TextAlign.center,
                    ),
                  ),
                  Text(
                    "Sit Back and wait a few seconds\nas your downloaded wallpapers are\nloading.",
                    style: GoogleFonts.raleway(
                        fontSize: 16, color: loadingTextColor),
                    textAlign: TextAlign.center,
                  ),
                ],
              ),
            ),
          );
        });
  }

  @override
  bool get wantKeepAlive => true;
}

I also have image_model.dart in my lib folder.

  List<String> files;
  String folderName;

  ImageModel({this.files, this.folderName});

  ImageModel.fromJson(Map<String, dynamic> json) {
    files = json['files'].cast<String>();
    folderName = json['folderName'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['files'] = this.files;
    data['folderName'] = this.folderName;
    return data;
  }
}

I have also added external storage read and write permissions in my AndroidManifest.xml, and I have also allowed storage permission on my device, still this error occurs whenever the above class is called.
Error -

E/MethodChannel#storage_path(21719): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/MethodChannel#storage_path(21719): 	at com.follow2vivek.storagepath.StoragePathPlugin.getImagePaths(StoragePathPlugin.java:130)
E/MethodChannel#storage_path(21719): 	at com.follow2vivek.storagepath.StoragePathPlugin.access$000(StoragePathPlugin.java:31)
E/MethodChannel#storage_path(21719): 	at com.follow2vivek.storagepath.StoragePathPlugin$1.onGranted(StoragePathPlugin.java:56)
E/MethodChannel#storage_path(21719): 	at com.nabinbhandari.android.permissions.Permissions.check(Permissions.java:105)
E/MethodChannel#storage_path(21719): 	at com.nabinbhandari.android.permissions.Permissions.check(Permissions.java:52)
E/MethodChannel#storage_path(21719): 	at com.follow2vivek.storagepath.StoragePathPlugin.onMethodCall(StoragePathPlugin.java:53)
E/MethodChannel#storage_path(21719): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#storage_path(21719): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#storage_path(21719): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#storage_path(21719): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#storage_path(21719): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#storage_path(21719): 	at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#storage_path(21719): 	at android.app.ActivityThread.main(ActivityThread.java:7397)
E/MethodChannel#storage_path(21719): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#storage_path(21719): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#storage_path(21719): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:920)
E/AccessibilityBridge(21719): VirtualView node must not be the root node.
W/System  (21719): A resource failed to call close.

The output of flutter doctor on my system is -

[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale en_IN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[!] Android Studio (version 3.6)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

I am using VS Code as my editor which my flutter doctor doesn't show for some reason.
Please help with this issue.

duplicate data

  • i try to get image in initstate(). But when screen was inited many time, data in path of image were duplicated.

Please fix the issue in release mode

In release mode this not returning any data and if possible please add the thumbnail image and video and instead of returning a json string if we can get Uint8List for the thumbnail image if would be much better.

How to get images from custom path.

I want to retrieve all images in my flutter app from a specific folder/directory in external storage like downloads directory,
please help me.

Root folderName

I'm trying to access the root folder name which is '/storage/emulated/0' but the foldername field in json array for is null and the following error was thrown:

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building Builder(dirty):
A non-null String must be provided to a Text widget.
'package:flutter/src/widgets/text.dart':
Failed assertion: line 360 pos 10: 'data != null'

The relevant error-causing widget was:
Builder file:///C:/Users/Aatif/AndroidStudioProjects/gallery_app/lib/main.dart:59:32
When the exception was thrown, this was the stack:
#2 new Text (package:flutter/src/widgets/text.dart:360:10)
#3 _HomeState.build.. (package:gallery_app/main.dart:66:36)
#4 Builder.build (package:flutter/src/widgets/basic.dart:7166:48)
#5 StatelessElement.build (package:flutter/src/widgets/framework.dart:4631:28)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4557:15)
...

JSON array:
**_{files: [/storage/emulated/0/IMG_20160709_181323981.jpg]}, {files: [/storage/emulated/0/IMG_20160709_174128028.jpg]}_**, {files: [/storage/emulated/0/timetable/IMG-20200107-WA0002.jpg], folderName: timetable}, {files: [/storage/emulated/0/Fake Tweets/Image-6156.jpg, /storage/emulated/0/Fake Tweets/Image-3012.jpg, /storage/emulated/0/Fake Tweets/IMG_20180703_141329.jpg], folderName: Fake Tweets},

as you can see there's no folderName field.

Please we want the IOS Version of this Plugin

Hi . Fist of all thanks for this awesome Plugin . it really helped me a lot . But i saw that you guys said you need a Mac for the IOS Version. That's actually untrue , you don't need that . If you have an ios folder in your Project you can develop for ios too . I am using a Windows Machine and i have that
folder. But this is gonna be really strange if you don't have one ?

Close cursors

Hey, you should be closing that cursors after reading data from it.

package uses the deprecated api

Note: D:\My Projects\flutterprojects\flutter.pub-cache\hosted\pub.dartlang.org\storage_path-0.2.0\android\src\main\java\com\follow2vivek\storagepath\StoragePathPlugin.java uses or overrides a deprecated API.
I am getting this error message while i was building my flutter app using this package.

how to get file meta data detail

in this library how can i get file meta data such as file size, video duration if file is video, date time, dimension if file is image or video?
FileModel only have List<String> files; and String folder;

for example:

class FileModel {
  List<String> files;
  String folder;
  String fileSize;
  String duration;    // can be null if file is not video
  String dimension; // can be null if file is not image or video
  ...
}

Doesn't work when Android APK file is built

I am using the getFilePath() method to get a list of all the files in the app. This works very well when the app is ran using 'flutter run' and also works using 'flutter run --release'.
But it doesn't work when the apk file is built using 'flutter build apk'. Even though the storage permissions are provided to the app it doesn't work.

Video thumbnail is not available

When i get all video then only video path is available in json, but video thumbnail is not available.
Please add a one more field for thumbnail.

append list value

list value increases when String paths = await StoragePath.videoPath; called more than once.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.