简体   繁体   English

Flutter- 实现 Instagram 等视频功能的最佳小部件

[英]Flutter- best widget to implement video feature like Instagram

I want to implement feature like Instagram story.我想实现像 Instagram 故事这样的功能。 I was wondering what widget comes into play in this situation.我想知道在这种情况下什么小部件会起作用。 What I was thinking is horizontal list view or dismissible.我在想的是水平列表视图或可关闭。 But since each video has to be initialized before playing and I want go to next video or go back to previous video and play it as quick as possible.但是由于每个视频都必须在播放前初始化,我想转到下一个视频或返回上一个视频并尽可能快地播放。 So, I want to ask what is the possibly best way to do this.所以,我想问一下什么是最好的方法来做到这一点。 Can someone please share your thoughts?有人可以分享您的想法吗? Any help is highly appreciated!任何帮助表示高度赞赏!

When I started learning flutter, the first app I wrote was this one .当我开始学习 flutter 时,我写的第一个应用就是这个 The step-by-step of how to create this app is in the flutter website.如何创建此应用程序的分步说明位于 flutter 网站中。

This app use the english_words package to generate random Startup names.这个应用程序使用english_words包来生成随机启动名称。 There's a logic in the middle of the code that load the rest of content when certain quantity of lines is processed.代码中间有一个逻辑,可以在处理一定数量的行时加载其余内容。

  Widget _buildSuggestions() {
    return ListView.builder(
      padding: const EdgeInsets.all(16.0),
      // The itemBuilder callback is called once per suggested word pairing,
      // and places each suggestion into a ListTile row.
      // For even rows, the function adds a ListTile row for the word pairing.
      // For odd rows, the function adds a Divider widget to visually
      // separate the entries. Note that the divider may be difficult
      // to see on smaller devices.
      itemBuilder: (context, i) {
        // Add a one-pixel-high divider widget before each row in theListView.
        if (i.isOdd) return Divider();

        // The syntax "i ~/ 2" divides i by 2 and returns an integer result.
        // For example: 1, 2, 3, 4, 5 becomes 0, 1, 1, 2, 2.
        // This calculates the actual number of word pairings in the ListView,
        // minus the divider widgets.
        final index = i ~/ 2;
        // If you've reached the end of the available word pairings...
        if (index >= _suggestions.length) {
          // ...then generate 10 more and add them to the suggestions list.
          _suggestions.addAll(generateWordPairs().take(10));
        }
        return _buildRow(_suggestions[index]);
      }
    );
  }

It will make the app generate new lines when the user get to end of list.当用户到达列表末尾时,它将使应用程序生成新行。 You could maybe take a look at this how-to.你也许可以看看这个操作方法。 You could implement the logic for play/stop video on that part of code.您可以在该部分代码上实现播放/停止视频的逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在颤振中实现像 Instagram 这样的“保存帖子”功能 - How can I implement "Save post" feature like of Instagram in flutter 颤抖 - 到目前为止,使用Algolia在Firestore中实现搜索功能是不可能的? - Flutter- Is it impossible to implement search feature in Firestore with Algolia as of yet? Flutter 设计 Instagram 像气球/工具提示小部件 - Flutter design Instagram like balloons / tooltip widget Flutter-向 OutlinedButton 小部件添加 Padding - Flutter- Adding Padding to OutlinedButton widget Flutter-在另一个小部件中将 MaterialPageRoute 作为参数传递 - Flutter- pass MaterialPageRoute as parameter in another widget Flutter- Firebase Storage上传视频 - Flutter- Firebase Storage upload video 在 flutter 中,制作我自己设计和形状的卡片,就像 instagram 功能的卡片一样 - In flutter, make cards of my own design and shape like that of instagram feature 如何在抖音或 instagram 等 Flutter 中应用视频滤镜? - How to apply video filters in flutter like tiktok or instagram? 在 Flutter 中实现视频馈送的最佳方法是什么? - What is the best way to implement a video feed in Flutter? 如何在 Flutter 中实现类似视频流和视频滚动的 Tiktok - How to implement Tiktok like video streaming and video scrolling in Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM