Skip to content

Commit

Permalink
sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
MelbourneDeveloper committed Sep 22, 2024
1 parent a2491c6 commit a7ad358
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions charts_flutter/example/lib/picker/iterable_extensions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extension IterableExtensions<T> on Iterable<T> {
/// Non mutating sort
List<T> orderBy([int Function(T a, T b)? compare]) => toList()..sort(compare);
}
3 changes: 2 additions & 1 deletion charts_flutter/example/lib/picker/tag_selection_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/main.dart';
import 'package:example/picker/data.dart';
import 'package:example/picker/full_screen_sample.dart';
import 'package:example/picker/iterable_extensions.dart';
import 'package:example/picker/tag_item_selector.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -103,7 +104,7 @@ class _TagSelectionScreenState extends State<TagSelectionScreen> {
(tag) => tags.contains(tag),
),
)
.toList(),
.orderBy((a, b) => a.title.compareTo(b.title)),
allTags: tagDefinitions.values.toList(),
),
);
Expand Down

0 comments on commit a7ad358

Please sign in to comment.