|
|
|
|
|
|
_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) |
|
|
|
|
|
|
int test = widget.items.IndexOf(item); |
|
|
|
if (message1 != null) |
|
|
|
{ |
|
|
|
_listKey.currentState?.insertItem(0); |
|
|
|
if (_oldIndex != null && !_oldIndex.Contains(message1.id)) |
|
|
|
{ |
|
|
|
_listKey.currentState?.insertItem(0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
List<string> _newIndex = 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; |
|
|
|
if (message1 != null) |
|
|
|
_newIndex.Add(message1.id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_oldIndex = _newIndex; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|