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

[Bug report] 时间排序问题 #1232

Closed
iCytus opened this issue Nov 26, 2024 · 3 comments
Closed

[Bug report] 时间排序问题 #1232

iCytus opened this issue Nov 26, 2024 · 3 comments

Comments

@iCytus
Copy link

iCytus commented Nov 26, 2024

Version

3.5.0

Platforms

Android

Device Model

meizu 20 pro

flutter info

[✓] Flutter (Channel stable, 3.19.6, on macOS 14.6.1 23G93 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.19.6 on channel stable at /Users/chenmou/flutterDev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (7 个月前), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/chenmou/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/chenmou/Library/Android
    • Java binary at: /Applications/Android Studio 2.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode-15.4.0.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio 2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

How to reproduce?

在example示例里,custom filter example -> Advanced Custom Filter中,打开相册「最近」,我看了下规则是按照创建时间排序,

  final List<OrderByItem> _orderBy = [
    OrderByItem.named(
      column: CustomColumns.base.createDate,
      isAsc: false,
    ),
  ];

但是呢,输出的图像却感觉像是按照id排序的,并未像预期那样,是否需要其他设置项呢?
image

Logs

No response

Example code (optional)

No response

Contact

No response

@fluttercandies-dev
Copy link

AI Summary: 该用户报告称在安卓设备上使用 photo_manager 包的自定义过滤器示例时,图片排序似乎是按ID而不是按创建日期排序,尽管代码中指定了按创建日期降序排列。用户询问是否需要其他设置项来实现按创建日期排序。

@AlexV525
Copy link
Member

AlexV525 commented Nov 30, 2024

相册一般是按照拍摄时间排序,可以直接用 date taken column 来排。至于你打印的创建时间,看不到代码不知道是谁的

@iCytus iCytus closed this as completed Dec 4, 2024
@HenrikH96
Copy link

@AlexV525
I have tried sorting by date Taken:

 fil  filter = CustomFilter.sql(
          where: '''
      ${CustomColumns.android.width} IS NOT NULL
    ''',
          orderBy: [OrderByItem.desc(CustomColumns.android.dateTaken)],
        );

And it was much better than sorting by creationTime. However i was not able to ann date filter.

 filter = CustomFilter.sql(
        where: '''
      ${CustomColumns.android.width} IS NOT NULL
      AND ${CustomColumns.android.dateTaken} >= ${CustomColumns.utils.convertDateTimeToSql(dateRange.start)}
      AND ${CustomColumns.android.dateTaken} <= ${CustomColumns.utils.convertDateTimeToSql(dateRange.end)}
    ''',
        orderBy: [OrderByItem.desc(CustomColumns.android.dateTaken)],
      );

      return filter;
    }

it seems like "convertDateTimeToSql" doesn't work with dateTaken.
I want to show the "correct" Datetime of the AssetEntity's but AssetEntity doesn't hold any date Taken Information as far as i can tell

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

No branches or pull requests

4 participants