朋友圈集赞APP——个人开源项目分享 | 青训营

127 阅读2分钟

新的美味餐厅开业,集赞228个就有霸王餐可以吃?

但是你好友甚至没有228个?

特别想要的抽奖资格,特别想去的校园歌手大赛…需要转发推文才能获得资格?

但是你觉得经常转发推文是一件非常麻烦的事情?

领导要求把全是废话的会议精神推文转发到朋友圈并截图打卡?

但是你不想让它污染你的TimeLine?

Is It Worth the Time?

“如果有任何事情要花费他超过90秒的时间,他一定会写一个脚本来实现那件事情的自动化”

我们致力于将用户从无意义的时间消磨中解放出来,我们更希望你拿这些时间去做一些真正有意义的事情

于是我和小伙伴一起写了一个模拟微信朋友圈的APP,你可以在这个APP中自定义朋友圈的赞数、发布时间,而我们会为你提供随机生成的用户名和头像,帮助用户的到一个目标赞数的朋友圈,以此来解决各种需要朋友圈集赞的活动。

开源地址github.com/Luxe7/BaoZa…

本项目在Flutter框架下编写完成,在学习过程中了解到了很多关于Flutter框架中Widget的相关知识,顺便在这里分享给大家。

1. Slider

我们使用滑块小部件来更改值。因此,需要将值存储在变量中。这个小部件有一个滑块类,它需要 onChanged ()函数。当我们改变滑块位置时,这个函数将被调用。

  Slider(
      value: _value.toDouble(),
      min: 1.0,
      max: 20.0,
      divisions: 10,
      activeColor: AppColors.mainColor,
      inactiveColor: Colors.grey.shade400,
      label: 'Set volume value',
      onChanged: (double newValue) {
        setState(() {
          _value = newValue.round();
        });
      },
      semanticFormatterCallback: (double newValue) {
        return '${newValue.round()} dollars';
      })),

2. Range Slider

它是一个高度可定制的组件,可以从一系列值中选择一个值。它可以从一组连续的或离散的值中进行选择。

  RangeSlider(
    values: _currentRangeValues,
    min: 0,
    max: 100,
    activeColor: AppColors.mainColor,
    inactiveColor: Colors.grey.shade400,
    divisions: 10,
    labels: RangeLabels(
      _currentRangeValues.start.round().toString(),
      _currentRangeValues.end.round().toString(),
    ),
    onChanged: (RangeValues values) {
      setState(() {
        _currentRangeValues = values;
      });
    },

3. Single Chip

芯片是一个 Material 设计小部件,内置 Flutter 。它可以简单地描述为一个包含图标和文本(通常是背景中的圆角矩形)的紧凑元素。它可以有很多用途,比如它可以简单地用作一个按钮,用 CircleAvatar 和文本表示用户,或者在博客文章中使用主题标签等等

  Chip(
    padding:
        const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
    avatar: const CircleAvatar(
      backgroundColor: AppColors.mainColor,
      child: Text("D"),
    ),
    label: const Text("Dev"),
    onDeleted: () {},
  ),

4. Multiple Chip

我们可以使用小部件芯片(过滤,显示多个芯片,选择或删除芯片,等等)。

GridView.count(
    shrinkWrap: true,
    physics: const NeverScrollableScrollPhysics(),
    crossAxisCount: 3,
    childAspectRatio: 4,
    crossAxisSpacing: 5.0,
    mainAxisSpacing: 5.0,
    children: List.generate(nameList.length, (index) {
      return Chip(
        padding: const EdgeInsets.symmetric(
            horizontal: 12, vertical: 6),
        avatar: CircleAvatar(
          backgroundColor: AppColors.mainColor,
          child: Text(nameList[index].substring(0, 1)),
        ),
        label: Text(nameList[index]),
        onDeleted: () {
          setState(() {
            nameList.removeAt(index);
          });
        },
      );
    })),
```
```