浏览代码

Fix input

/DatePickerDemo
shiyun wen 3 年前
当前提交
5507c965
共有 2 个文件被更改,包括 27 次插入20 次删除
  1. 35
      AwesomeUIWidgets/Assets/Scripts/Widgets/chat_list.cs
  2. 12
      AwesomeUIWidgets/Assets/Scripts/Widgets/input.cs

35
AwesomeUIWidgets/Assets/Scripts/Widgets/chat_list.cs


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);

12
AwesomeUIWidgets/Assets/Scripts/Widgets/input.cs


{
public class NewLineIntent : Intent
{
public NewLineIntent(LocalKey key = null) : base(key)
public NewLineIntent(LocalKey key ) : base(key)
{
}
}

public SendMessageIntent(LocalKey key = null) : base(key)
public SendMessageIntent(LocalKey key ) : base(key)
{
}
}

public CallbackAction sendPress(){
return new CallbackAction(
intentKey: DoNothingAction.key,
onInvoke: (FocusNode node, Intent intent) => _handleSendPressed()
);
}

return new CallbackAction(
intentKey: DoNothingAction.key,
onInvoke: (FocusNode node, Intent intent) =>
{
var _newValue = $"{_textController.text}\r\n";

));
var shortCutsKey = new Dictionary<LogicalKeySet, Intent>
{
{new LogicalKeySet(LogicalKeyboardKey.enter), new SendMessageIntent()},
{new LogicalKeySet(LogicalKeyboardKey.enter), new SendMessageIntent(DoNothingAction.key)},
new NewLineIntent()
new NewLineIntent(DoNothingAction.key)
new NewLineIntent()
new NewLineIntent(DoNothingAction.key)
}
};
var actionKeys = new Dictionary<LocalKey, ActionFactory>

正在加载...
取消
保存