mirror of
https://github.com/Colin-XKL/Colinx-Blog.git
synced 2026-01-11 18:21:28 +08:00
new posts
This commit is contained in:
82
content/posts/Colin's 实验室 - 2021春.md
Normal file
82
content/posts/Colin's 实验室 - 2021春.md
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
title: Colin's实验室 - 2021春
|
||||
date: 2021-02-25
|
||||
lastmod: 2021-03-30
|
||||
description: 小玩具及他们的demo
|
||||
categories:
|
||||
- 杂记
|
||||
tags:
|
||||
- 技术
|
||||
- Python
|
||||
- Github
|
||||
- Flutter
|
||||
---
|
||||
|
||||
# Colin's实验室 - 2021春
|
||||
|
||||
> 小玩具及他们的demo
|
||||
>
|
||||
>
|
||||
|
||||
## 英语文本智能查词(Project Sweeper)
|
||||
|
||||
> 自动分割给定的英文文本,提取词元后在数据库中搜索,根据给定的词汇量和难度等级进行筛选,只能提取阅读障碍词汇并高亮当前备考项目(如四级)的重点单词
|
||||
|
||||

|
||||
|
||||
## 知乎爬虫及JS逆向
|
||||
|
||||
> 日常用RSS订阅知乎的一些高质量专栏。但由于知乎本事并不支持RSS,内容大多通过RSShub来的,其本质是个爬虫,经常会受到前端页面结构变更的影响。为了应对这个变化,RSShub中对于知乎相关页面的爬取规则必须得重写。
|
||||
>
|
||||
> 分析了一通知乎的页面,发现有个接口可以直接请求,但是会检验header。header里面有几项特殊的自定义参数,`x-zse-83` 和 `x-zse-86`等。为了搞清楚这里面的数值怎么来的,就必须对知乎前端页面资源中的一个js文件进行逆向分析。
|
||||
>
|
||||
> 逆向折腾了大半天,就快要成功提取核心加密函数的时候,发现知乎的前端页面为了SEO有加入一页的文章列表数据,可以直接用上。考虑到逆向的工作量和潜在的法律问题,遂放弃原本的方案。
|
||||
>
|
||||
> 新的方案完成后,已向RSShub提交PR并已被合并。
|
||||
|
||||
|
||||
|
||||
## MC服务器搭建与极限优化
|
||||
|
||||
> 1核2G学生机,从2人联机频频崩溃到8人挖矿毫无压力,学习了JVM GC种种,对服务端程序的一些参数也渐渐熟悉。优化效果喜人,总有还能压榨的性能,就像资本家看手下的骡子一样hhh
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## 洞洞板/冰箱贴/CVPRO/(...没想好名字)
|
||||
|
||||
> 一款跨平台的灵感素材收集与简易管理App,基于Flutter构建,跨平台,颜值在线。
|
||||
|
||||

|
||||
|
||||
> 持续开发中,附roadmap
|
||||
>
|
||||
> version 1.0
|
||||
>
|
||||
> [x] Text support
|
||||
> [x] Key shortcut support
|
||||
> [x] About Page
|
||||
> [ ] Content editing
|
||||
> [x] List item dismiss
|
||||
> [x] List Sorting
|
||||
>
|
||||
> Future - Key functions
|
||||
>
|
||||
> [ ] Data Storage
|
||||
> [ ] Pic support
|
||||
> [ ] Trashbin
|
||||
> [ ] File support
|
||||
> [ ] Multiple List
|
||||
>
|
||||
> Future - Key features
|
||||
>
|
||||
> [ ] Grid view
|
||||
> [ ] Drag and Drop support
|
||||
> [ ] Card resize
|
||||
>
|
||||
> Future - Extra
|
||||
>
|
||||
> [ ] Text reformat, delete useless spaces etc.
|
||||
> [ ] Pic OCR support
|
||||
> [ ] WebDav support and automatically upload files<10M
|
||||
119
content/posts/Flutter 拖动排序列表与跨平台优化实践.md
Normal file
119
content/posts/Flutter 拖动排序列表与跨平台优化实践.md
Normal file
@@ -0,0 +1,119 @@
|
||||
---
|
||||
title: Flutter 拖动排序列表与跨平台优化实践
|
||||
date: 2021-03-30
|
||||
lastmod: 2021-03-30
|
||||
description: Flutter 拖动排序列表与跨平台优化实践
|
||||
categories:
|
||||
- 教程
|
||||
tags:
|
||||
- 技术
|
||||
- Flutter
|
||||
---
|
||||
|
||||
# Flutter 拖动排序列表与跨平台优化实践
|
||||
|
||||
|
||||
|
||||
Flutter中实现拖动排序的列表非常简单,试用官方的`ReorderableListView`替代原本的`ListView`即可,`ListView.builder`同理。
|
||||
|
||||
|
||||
|
||||
```dart
|
||||
return ReorderableListView(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
children: <Widget>[
|
||||
for (int index = 0; index < _items.length; index++)
|
||||
ListTile(
|
||||
key: Key('$index'),
|
||||
tileColor: _items[index].isOdd ? oddItemColor : evenItemColor,
|
||||
title: Text('Item ${_items[index]}'),
|
||||
),
|
||||
],
|
||||
onReorder: (int oldIndex, int newIndex) {
|
||||
setState(() {
|
||||
if (oldIndex < newIndex) {
|
||||
newIndex -= 1;
|
||||
}
|
||||
final int item = _items.removeAt(oldIndex);
|
||||
_items.insert(newIndex, item);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
上面是官方给的demo,简洁明了。[官方介绍视频](https://www.youtube.com/watch?v=yll3SNXvQCw)下面的评论里,人家直呼比原生Android写的过瘾的多。
|
||||
|
||||
阅读文档后我给我的App的界面也加上了可拖动排序的功能。效果如下图
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
虽然可以实现拖动了,但是右边有一个按钮很碍眼。不过这个是用来控制拖动的,鼠标移上去才能触发拖动。
|
||||
|
||||
翻了翻文档发现,这个地方`ReorderableListView`在移动端和桌面端的处理是不一样的,上图(桌面macos)右边会出现一个dragHandler,而移动端则是靠长按列表项触发拖动。
|
||||
|
||||
要把这个碍眼的图标去掉,有两个方案:
|
||||
|
||||
- 找到定义这个图标的地方,更换一个合适的图标,并在外面包裹一层,仅在鼠标hover时将图标显示以进行拖动,其他情况下隐藏
|
||||
- 将拖动的实现定义为和移动端相同,即都通过长按列表项触发拖动
|
||||
|
||||
|
||||
|
||||
针对方案一,以`ReorderableListView` 和`Icon`为关键词搜索,很遗憾的是并没有这方面的资料,又翻了翻源码,并没有找到可以自定义右边这个拖拽按钮的实现。
|
||||
|
||||
在Flutter官方的Github仓库中,https://github.com/flutter/flutter/issues/66080#issuecomment-771123430 的issue对相关问题做了阐述,并有提案对`ReorderableListView`进行了改进。该issue对应的pr已经被合并到stable channel,查阅相关API后了解到可以使用`buildDefaultDragHandles: false`,关闭默认的拖拽触发实现,再使用`ReorderableDelayedDragStartListener`包裹原先的`ListTile`即可实现桌面端和移动端都通过长按列表项触发拖拽排序。
|
||||
|
||||
不过相应的,ListTile的`onLongPress`就不能再有响应了。刚好今天完成了滑动删除的实现,现在列表也的删除、排序已经高度可用且多平台统一了。
|
||||
|
||||

|
||||
|
||||
附相关代码实现:
|
||||
|
||||
|
||||
|
||||
```dart
|
||||
body: ReorderableListView.builder(
|
||||
buildDefaultDragHandles: false,
|
||||
onReorder: (int oldIndex, int newIndex) {
|
||||
setState(() {
|
||||
if (oldIndex < newIndex) newIndex -= 1;
|
||||
var temp = l.removeAt(oldIndex);
|
||||
l.insert(newIndex, temp);
|
||||
});
|
||||
},
|
||||
itemCount: l.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = l[index];
|
||||
return Dismissible(
|
||||
key: item.key,
|
||||
background: listTileBackground(),
|
||||
onDismissed: (direction) {
|
||||
setState(() {
|
||||
lastDeleted = item;
|
||||
l.removeAt(index);
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(msgDeleted);
|
||||
},
|
||||
child: ReorderableDelayedDragStartListener(
|
||||
key: item.key,
|
||||
index: index,
|
||||
child: ListTile(
|
||||
title: Text(item.title),
|
||||
subtitle: Text(item.content),
|
||||
contentPadding: EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
onTap: () {
|
||||
//your function here
|
||||
},
|
||||
// onLongPress: () {
|
||||
// lastDeleted = item;
|
||||
// l.removeAt(index);
|
||||
// setState(() {});
|
||||
// ScaffoldMessenger.of(context)
|
||||
// .showSnackBar(msgDeleted);
|
||||
// },
|
||||
)));
|
||||
})));
|
||||
```
|
||||
|
||||
75
content/posts/Minecraft上云笔记 - MC自定义皮肤并支持联机.md
Normal file
75
content/posts/Minecraft上云笔记 - MC自定义皮肤并支持联机.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
title: Minecraft上云笔记 - MC自定义皮肤并支持联机
|
||||
date: 2021-02-22
|
||||
lastmod: 2021-02-22
|
||||
description: Minecraft上云笔记 - MC自定义皮肤并支持联机
|
||||
categories:
|
||||
- 教程
|
||||
- 指南
|
||||
tags:
|
||||
- Java
|
||||
- MC
|
||||
- MC服务器
|
||||
- Minecraft
|
||||
- 我的世界
|
||||
- 游戏
|
||||
- 服务器
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
# Minecraft上云笔记 - MC自定义皮肤并支持联机
|
||||
|
||||
|
||||
|
||||
方案概述:
|
||||
|
||||
* 仪表盘 - 红石皮肤站
|
||||
https://mcskin.cn/user
|
||||
* [CSL] 万用皮肤补丁 (CustomSkinLoader) - MC 百科 | 最大的 Minecraft 中文 MOD 百科
|
||||
https://www.mcmod.cn/class/883.html
|
||||
* 全员安装皮肤mod,即可保证所有人都可以看见对方的皮肤
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
使用:
|
||||
|
||||
1. 安装好forge
|
||||
|
||||
2. 安装好皮肤补丁的mod
|
||||
|
||||
3. 启动一次MC,让他自动生成配置文件
|
||||
|
||||
4. 在皮肤站注册,并建立与游戏中角色名字相同的角色并设定皮肤
|
||||
|
||||
5. 修改`".minecraft\CustomSkinLoader\CustomSkinLoader.json"`
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "14.12",
|
||||
"loadlist": [
|
||||
{
|
||||
"name": "红石皮肤站",
|
||||
"root": "https://mcskin.cn/csl/",
|
||||
"type": "CustomSkinAPI"
|
||||
},
|
||||
{
|
||||
"name": "Mojang",
|
||||
"type": "MojangAPI"
|
||||
},
|
||||
......
|
||||
```
|
||||
|
||||
> **注意:**
|
||||
>
|
||||
> 自定义皮肤站最好排在Mojang API的前面,不然的话如果有正版用户起的角色名字和你的一样,就会默认载入他的皮肤(巨坑+1)
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user