Flutter 仿微博客戶端

Flutter開發(fā)的微博客戶端,同時支持Android和iOS。與官方微博x9.99%相似度體驗,離線模式,多語言支持,主題隨心換,超乎想象的流暢度,各種驚喜的細節(jié)等待你一一發(fā)現(xiàn)。

支持功能:

查看微博動態(tài)、正文、評論
查看熱門話題、微博、熱搜
支持話題、@、表情、全文
離線模式
國際化
主題色

項目動態(tài)

應(yīng)用于2020.05.06提交至微博開發(fā)平臺,目前還在審核中,暫無法申請微博授權(quán)!
ps:作者也不清楚是否能通過審核,何時通過審核,但大家還是可以本地體驗相關(guān)功能。
目前運動和消息板塊未開發(fā),運動板塊暫時放的實時疫情,消息板塊展示九宮格示例。

分享內(nèi)容

1、九宮格圖片控件 NineGridView

類似微博動態(tài),微信朋友圈,微信群組,釘釘群組,支持單張大圖預(yù)覽。

NineGridView(
  margin: EdgeInsets.all(12),
  padding: EdgeInsets.all(5),
  space: 5,
  type: NineGridType.weChatGp,
  itemCount: itemCount,
  itemBuilder: (BuildContext context, int index) {},
);

2、拖拽九宮格圖片控件 DragSortView

類似微博/微信發(fā)布動態(tài)九宮格,支持按壓放大效果,拖拽排序,拖拽到指定位置刪除。

DragSortView(
  imageList,
  space: 5,
  margin: EdgeInsets.all(20),
  padding: EdgeInsets.all(0),
  itemBuilder: (BuildContext context, int index) {},
  initBuilder: (BuildContext context) {},
  onDragListener: (MotionEvent event, double itemWidth) {
    /// 判斷拖動到指定位置刪除
    /// return true;
    if (event.globalY > 600) {
      return true;
    }
    return false;
  },
);     

3、獲取圖片尺寸 ImageUtil

大圖功能必備工具。

Image image = Image(image: CachedNetworkImageProvider("Url"));
Image imageAsset = Image.asset("");
Image imageFile = Image.file(File("path"));
Image imageNetwork = Image.network("url");
Image imageMemory = Image.memory(null);

ImageUtil imageUtil = ImageUtil();
Rect rect = await imageUtil.getImageSize(image: image);  
ImageUtil().getImageSize(image: image).then((Rect rect) {
  print("rect: " + rect.toString();
});

4、簡單加解密 EncryptUtil

異或?qū)ΨQ加解密 + Base64加解密

const String key = '11, 22, 33, 44, 55, 66';
String value = 'Sky24n';
String encode = EncryptUtil.xorBase64Encode(value, key); // WH1YHgMs
String decode = EncryptUtil.xorBase64Decode(encode, key); // Sky24n

5、JsonUtil

簡單封裝json字符串轉(zhuǎn)對象。

String objStr = "{\"name\":\"成都市\(zhòng)"}";
City hisCity = JsonUtil.getObj(objStr, (v) => City.fromJson(v));

String listStr = "[{\"name\":\"成都市\(zhòng)"}, {\"name\":\"北京市\(zhòng)"}]";
List<City> cityList = JsonUtil.getObjList(listStr, (v) => City.fromJson(v));

6、時間格式化 DateUtil

格式化時間戳。

/// year -> yyyy/yy   month -> MM/M    day -> dd/d
/// hour -> HH/H      minute -> mm/m   second -> ss/s

DateUtil.formatDateMs(DateTime.now().millisecondsSinceEpoch, format: DataFormats.full); // 2019-07-09 16:51:14
DateUtil.formatDateStr("2019-07-09 16:51:14", format: "yyyy/M/d HH:mm:ss"); // 2019/7/9 16:51:14
DateUtil.formatDate(DateTime.now(), format: "yyyy/MM/dd HH:mm:ss");  // 2019/07/09 16:51:14
DateUtil.formatDateMs(ms, format: "yyyy年MM月dd日 HH時mm分ss秒");  // 2019年07月09日 16時51分14秒

7、時間軸 TimelineUtil

類似微信朋友圈,微博動態(tài)時間線。

enum DayFormat {
  ///(less than 10s->just now)、x minutes、x hours、(Yesterday)、x days.
  ///(小于10s->剛剛)、x分鐘、x小時、(昨天)、x天.
  Simple,

  ///(less than 10s->just now)、x minutes、x hours、[This year:(Yesterday/a day ago)、(two days age)、MM-dd ]、[past years: yyyy-MM-dd]
  ///(小于10s->剛剛)、x分鐘、x小時、[今年: (昨天/1天前)、(2天前)、MM-dd],[往年: yyyy-MM-dd].
  Common,

  ///日期 + HH:mm
  ///(less than 10s->just now)、x minutes、x hours、[This year:(Yesterday HH:mm/a day ago)、(two days age)、MM-dd HH:mm]、[past years: yyyy-MM-dd HH:mm]
  ///小于10s->剛剛)、x分鐘、x小時、[今年: (昨天 HH:mm/1天前)、(2天前)、MM-dd HH:mm],[往年: yyyy-MM-dd HH:mm].
  Full,
}

TimelineUtil.format(timeMillis, locale: Localizations.localeOf(context).languageCode, dayFormat: DayFormat.Common);

Screenshots

首頁 探索 我的
微博發(fā)布 微博正文 個人頁面
授權(quán) 設(shè)置 圖片

關(guān)于App

個人項目,暫未開源!
GitHub ???: Fitness

關(guān)于作者

GitHub : Sky24n
簡書 ????: Sky24n
掘金 ????: Sky24n

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容