DevsOnFlutter / file_manager

FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.
https://pub.dev/packages/file_manager
BSD 3-Clause "New" or "Revised" License
61 stars 18 forks source link

showFileExtension is not working as expect #12

Open zhuyijing opened 2 years ago

zhuyijing commented 2 years ago

Describe the bug

  static String basename(dynamic entity, [bool showFileExtension = true]) {
    if (entity is Directory) {
      return entity.path.split('/').last;
    } else if (entity is File) {
      return (showFileExtension)   ====> should be (!showFileExtension)
          ? entity.path.split('/').last.split('.').first
          : entity.path.split('/').last;
    } else {
      print(
          "Please provide a Object of type File, Directory or FileSystemEntity");
      return "";
    }
  }

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Logs Run flutter analyze and attach any output of that command below. If there are any analysis errors, try resolving them before filing this issue.

Paste the output of running flutter doctor -v here.

Additional context Add any other context about the problem here.