-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly shift enter and enter send, more fade animations + cre…
…ate timeline model
- Loading branch information
1 parent
502a5e5
commit 6325a09
Showing
10 changed files
with
185 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:matrix/matrix.dart'; | ||
import 'package:safe_change_notifier/safe_change_notifier.dart'; | ||
|
||
class TimelineModel extends SafeChangeNotifier { | ||
// TIMELINES | ||
|
||
bool _updatingTimeline = false; | ||
bool get updatingTimeline => _updatingTimeline; | ||
void setUpdatingTimeline(bool value) { | ||
if (value == _updatingTimeline) return; | ||
_updatingTimeline = value; | ||
notifyListeners(); | ||
} | ||
|
||
Future<void> requestHistory( | ||
Timeline timeline, { | ||
int historyCount = 350, | ||
StateFilter? filter, | ||
bool notify = true, | ||
}) async { | ||
if (notify) { | ||
setUpdatingTimeline(true); | ||
} | ||
if (timeline.isRequestingHistory) { | ||
setUpdatingTimeline(false); | ||
return; | ||
} | ||
await timeline.requestHistory(filter: filter, historyCount: historyCount); | ||
await timeline.setReadMarker(); | ||
if (notify) { | ||
setUpdatingTimeline(false); | ||
} | ||
} | ||
|
||
bool _timelineSearchActive = false; | ||
bool get timelineSearchActive => _timelineSearchActive; | ||
void toggleTimelineSearch({bool? value}) { | ||
bool theValue = value ?? !_timelineSearchActive; | ||
if (theValue == _timelineSearchActive) return; | ||
_timelineSearchActive = theValue; | ||
notifyListeners(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.