Skip to content

Commit

Permalink
Sort list alphabetically (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkamran80 authored Nov 22, 2022
1 parent 4bb94ee commit 7708e60
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,15 @@ class _HomeScreenState extends State<HomeScreen> {
final backgroundColor = Theme.of(context).scaffoldBackgroundColor;
final schedulesData = Provider.of<SchedulesProvider>(context);

Map<String, VariantOrSchedule> schedulesList =
generateScheduleListWithVariants(
schedulesData.schedules,
Map<String, VariantOrSchedule> schedulesList = Map.fromEntries(
generateScheduleListWithVariants(
schedulesData.schedules,
).entries.toList()
..sort(
(schedule1, schedule2) => schedule1.value.comparableName.compareTo(
schedule2.value.comparableName,
),
),
);

SchedulerBinding.instance.addPostFrameCallback(
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/schedule_variant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class VariantOrSchedule {

String get color =>
type == Schedule ? schedule!.schedule["color"] : variant!.color;

String get comparableName =>
name.toLowerCase().replaceFirst("a ", "").replaceFirst("the", "").trim();
}

Map<String, List<String>> generateVariants(Iterable<String> scheduleIds) {
Expand Down
8 changes: 7 additions & 1 deletion releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Release Notes

## 1.0.2

**Released to iOS on November 17, Android on November 20, 2022**

- Fix period loading system (#39)

## 1.0.1

**Pending release**
**Released to iOS on November 17, Android on November 20, 2022**

- Fix schedule periods bug (periods would be incorrect for that day) (#31)
- Add schedule request form (#25)
Expand Down

0 comments on commit 7708e60

Please sign in to comment.