Merge pull request #733 from GetStream/hotfix/mediaListView
fix(ui): use createdAt to sort media (the default value is updatedAt)
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
- Updated Dart SDK constraints to `>=2.14.0 <3.0.0`
|
- Updated Dart SDK constraints to `>=2.14.0 <3.0.0`
|
||||||
|
|
||||||
|
🐞 Fixed
|
||||||
|
|
||||||
|
- [[#491]](https://github.com/GetStream/stream-chat-flutter/issues/491): Fix `MediaListView` showing media in wrong order.
|
||||||
|
|
||||||
✅ Added
|
✅ Added
|
||||||
|
|
||||||
- `MessageListViewThemeData` now accepts a `DecorationImage` as a background image for `MessageListView`.
|
- `MessageListViewThemeData` now accepts a `DecorationImage` as a background image for `MessageListView`.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
@@ -145,21 +146,24 @@ class _MediaListViewState extends State<MediaListView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getMedia() async {
|
Future<void> _getMedia() async {
|
||||||
final assetList = await PhotoManager.getAssetPathList().then((value) {
|
final assetList = (await PhotoManager.getAssetPathList(
|
||||||
if (value.isNotEmpty) {
|
filterOption: FilterOptionGroup(
|
||||||
return value.singleWhere((element) => element.isAll);
|
orders: [
|
||||||
}
|
const OrderOption(
|
||||||
});
|
// ignore: avoid_redundant_argument_values
|
||||||
|
type: OrderOptionType.createDate,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onlyAll: true,
|
||||||
|
))
|
||||||
|
.firstOrNull;
|
||||||
|
|
||||||
if (assetList == null) {
|
final media = await assetList?.getAssetListPaged(_currentPage, 50);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final media = await assetList.getAssetListPaged(_currentPage, 50);
|
if (media?.isNotEmpty == true) {
|
||||||
|
|
||||||
if (media.isNotEmpty) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_media.addAll(media);
|
_media.addAll(media!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
++_currentPage;
|
++_currentPage;
|
||||||
|
|||||||
@@ -118,8 +118,11 @@ class MessageListViewThemeData with Diagnosticable {
|
|||||||
properties
|
properties
|
||||||
..add(ColorProperty('backgroundColor', backgroundColor))
|
..add(ColorProperty('backgroundColor', backgroundColor))
|
||||||
..add(
|
..add(
|
||||||
DiagnosticsProperty<DecorationImage>('backgroundImage', backgroundImage,
|
DiagnosticsProperty<DecorationImage>(
|
||||||
defaultValue: null),
|
'backgroundImage',
|
||||||
|
backgroundImage,
|
||||||
|
defaultValue: null,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user