forked from cwtch.im/cwtch-ui
anudda performance fix
This commit is contained in:
parent
0615a81042
commit
65811231a7
|
@ -40,7 +40,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
var last = scrollListener.itemPositions.value.last.index;
|
var last = scrollListener.itemPositions.value.last.index;
|
||||||
// sometimes these go hi->lo and sometimes they go lo->hi because [who tf knows]
|
// sometimes these go hi->lo and sometimes they go lo->hi because [who tf knows]
|
||||||
if ((first == 0 || last == 0) && Provider.of<AppState>(context, listen: false).unreadMessagesBelow == true) {
|
if ((first == 0 || last == 0) && Provider.of<AppState>(context, listen: false).unreadMessagesBelow == true) {
|
||||||
print("show the button = false");
|
Provider.of<AppState>(context, listen: false).initialScrollIndex = 0;
|
||||||
Provider.of<AppState>(context, listen: false).unreadMessagesBelow = false;
|
Provider.of<AppState>(context, listen: false).unreadMessagesBelow = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -49,14 +49,11 @@ class _MessageViewState extends State<MessageView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
print("messageview didChangeDependencies");
|
|
||||||
var appState = Provider.of<AppState>(context, listen: false);
|
var appState = Provider.of<AppState>(context, listen: false);
|
||||||
|
|
||||||
// using "8" because "# of messages that fit on one screen" isnt trivial to calculate at this point
|
// using "8" because "# of messages that fit on one screen" isnt trivial to calculate at this point
|
||||||
if (appState.initialScrollIndex > 8 && appState.unreadMessagesBelow == false) {
|
if (appState.initialScrollIndex > 8 && appState.unreadMessagesBelow == false) {
|
||||||
print("initScroll > 8");
|
|
||||||
WidgetsFlutterBinding.ensureInitialized().addPostFrameCallback((timeStamp) {
|
WidgetsFlutterBinding.ensureInitialized().addPostFrameCallback((timeStamp) {
|
||||||
print("show the button = true");
|
|
||||||
appState.unreadMessagesBelow = true;
|
appState.unreadMessagesBelow = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ class _MessageListState extends State<MessageList> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext outerContext) {
|
Widget build(BuildContext outerContext) {
|
||||||
var initi = Provider.of<AppState>(outerContext, listen: false).initialScrollIndex;
|
var initi = Provider.of<AppState>(outerContext, listen: false).initialScrollIndex;
|
||||||
print("building message list with initial index = $initi");
|
|
||||||
bool isP2P = !Provider.of<ContactInfoState>(context).isGroup;
|
bool isP2P = !Provider.of<ContactInfoState>(context).isGroup;
|
||||||
bool isGroupAndSyncing = Provider.of<ContactInfoState>(context).isGroup == true && Provider.of<ContactInfoState>(context).status == "Authenticated";
|
bool isGroupAndSyncing = Provider.of<ContactInfoState>(context).isGroup == true && Provider.of<ContactInfoState>(context).status == "Authenticated";
|
||||||
bool isGroupAndSynced = Provider.of<ContactInfoState>(context).isGroup && Provider.of<ContactInfoState>(context).status == "Synced";
|
bool isGroupAndSynced = Provider.of<ContactInfoState>(context).isGroup && Provider.of<ContactInfoState>(context).status == "Synced";
|
||||||
|
|
Loading…
Reference in New Issue