|
|
|
|
|
|
public AnimationController _controller; |
|
|
|
public bool _isNextPageLoading; |
|
|
|
public List<object> _oldData; |
|
|
|
public List<string> _oldIndex; |
|
|
|
|
|
|
|
public override void initState() |
|
|
|
{ |
|
|
|
|
|
|
_isNextPageLoading = false; |
|
|
|
_oldData = new List<object>(); |
|
|
|
_oldData.AddRange(widget.items); |
|
|
|
_oldIndex = new List<string>(); |
|
|
|
foreach (var item in widget.items) |
|
|
|
{ |
|
|
|
if (item is Dictionary<string, object>) |
|
|
|
{ |
|
|
|
var message1 = ((Dictionary<string, object>) item)["message"] as ChatComponents.Message; |
|
|
|
_oldIndex.Add(message1.id); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override void didUpdateWidget(StatefulWidget oldWidget) |
|
|
|
|
|
|
|
|
|
|
_calculateDiffs(((ChatList) oldWidget).items); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
private void _calculateDiffs(List<object> oldList) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item1 in widget.items) |
|
|
|
foreach (var item in widget.items) |
|
|
|
if (item1 is Dictionary<string, object> ) |
|
|
|
{ |
|
|
|
var message1 = ((Dictionary<string, object>)item1)["message"] as ChatComponents.Message; |
|
|
|
if(message1!=null) |
|
|
|
_listKey.currentState?.insertItem(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (item is Dictionary<string, object> ) |
|
|
|
{ |
|
|
|
var message1 = ((Dictionary<string, object>)item)["message"] as ChatComponents.Message; |
|
|
|
int test = widget.items.IndexOf(item); |
|
|
|
if (message1 != null) |
|
|
|
{ |
|
|
|
_listKey.currentState?.insertItem(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_oldData = new List<object>(widget.items); |
|
|
|
|
|
|
|
|
|
|
|