Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否可以通过添加配置 loop = true,设置弹幕循环滚动 #18

Open
EdmodoYunjiang opened this issue Jan 7, 2021 · 7 comments

Comments

@EdmodoYunjiang
Copy link

RT

@Wing-Li
Copy link

Wing-Li commented Jan 14, 2021

同求

@Wing-Li
Copy link

Wing-Li commented Jan 14, 2021

目前可以在页面设置一个 计时器,然后使用 barrageWallController.send([]) ,动态添加方法,不断的添加。

Random random = new Random();
Timer.periodic(Duration(seconds: 2), (timer) {
  int ran = random.nextInt(60000);

  barrageWallController.send([
    Bullet(
      child: Container(
        padding: EdgeInsets.only(left: 6, top: 4, bottom: 4, right: 12),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(26)),
          border: Border.all(color: Color(0xFF6F7177), width: 0.5),
        ),
        child: Text('$ran$ran$ran$ran$ran$ran$ran$ran$ran$ran$ran'),
      ),
    )
  ]);
});

@danielwii
Copy link
Owner

@Wing-Li @EdmodoYunjiang 能否再详细描述下需求,比如在什么样的场景,是否需要固定位置等。

@Wing-Li
Copy link

Wing-Li commented Jan 15, 2021

@danielwii

  1. 页面一打开,数据请求一次;
  2. 然后把数据全部设置给弹幕;
  3. 弹幕随机从设置的列表获取数据进行展示,然后无限轮播。

@danielwii
Copy link
Owner

@Wing-Li 为什么是随机获取?这样的目的是什么?

@Wing-Li
Copy link

Wing-Li commented Jan 15, 2021

@danielwii
滚动显示各种信息,比如:当前xxx注册了;当前xxx购买了VIP;当前xxx评论了;xxx上线了。

这种信息,不可能时时都有。
所以在很长一段时间都不会有新数据进来,就加载一次,然后轮播显示就可以了。

或者,对某个信息的评论。
就是一种列表的展现形式,滚动展示,样式更好看。

@seemelala
Copy link

目前可以在页面设置一个 计时器,然后使用 barrageWallController.send([]) ,动态添加方法,不断的添加。

Random random = new Random();
Timer.periodic(Duration(seconds: 2), (timer) {
  int ran = random.nextInt(60000);

  barrageWallController.send([
    Bullet(
      child: Container(
        padding: EdgeInsets.only(left: 6, top: 4, bottom: 4, right: 12),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(26)),
          border: Border.all(color: Color(0xFF6F7177), width: 0.5),
        ),
        child: Text('$ran$ran$ran$ran$ran$ran$ran$ran$ran$ran$ran'),
      ),
    )
  ]);
});

使用过程中会闪屏,debug模式下不会,打包正式版本就会出现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants