Skip to content

Commit

Permalink
feat: 添加字体、完成公众号页面,文章页
Browse files Browse the repository at this point in the history
  • Loading branch information
mietl committed Aug 20, 2024
1 parent 41ce717 commit 1f55ff8
Show file tree
Hide file tree
Showing 38 changed files with 686 additions and 101 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.


## 感谢
- [玩Android API](https://link.juejin.cn/?target=https%3A%2F%2Fwww.wanandroid.com%2Fblog%2Fshow%2F2): 感谢提供API
- [flutter_wanandroid](https://github.com/coder-pig/flutter_wanandroid): 教程写的非常棒
Binary file added assets/fonts/Dosis-Bold.woff2
Binary file not shown.
Binary file added assets/fonts/Dosis-ExtraBold.woff2
Binary file not shown.
Binary file added assets/fonts/Dosis-SemiBold.woff2
Binary file not shown.
Binary file added assets/fonts/ResourceHanRoundedCN-Bold.woff2
Binary file not shown.
Binary file added assets/fonts/ResourceHanRoundedCN-Medium.woff2
Binary file not shown.
11 changes: 11 additions & 0 deletions bruno/wan_flutter/article/获取公众号文章.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: 获取公众号文章
type: http
seq: 2
}

get {
url: {{baseUrl}}/wxarticle/list/409/1/json
body: none
auth: none
}
11 changes: 11 additions & 0 deletions bruno/wan_flutter/article/获取公众号章节.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: 获取公众号章节
type: http
seq: 1
}

get {
url: {{baseUrl}}/wxarticle/chapters/json
body: none
auth: none
}
3 changes: 3 additions & 0 deletions bruno/wan_flutter/environments/dev.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
baseUrl: https://www.wanandroid.com
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
meta {
name: article
name: 首页文章
type: http
seq: 4
seq: 2
}

get {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
meta {
name: banner
name: 首页轮播图
type: http
seq: 3
seq: 1
}

get {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
meta {
name: login
name: 登录
type: http
seq: 2
seq: 1
}

post {
Expand Down
13 changes: 13 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ PODS:
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)

EXTERNAL SOURCES:
Flutter:
Expand All @@ -25,12 +32,18 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

Expand Down
9 changes: 5 additions & 4 deletions lib/common/api/home_api.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:wan_flutter/common/models/home/article_list.dart';
import 'package:wan_flutter/common/models/app/article_list.dart';
import 'package:wan_flutter/common/models/home/banner.dart';
import 'package:wan_flutter/common/models/wan_response.dart';
import 'package:wan_flutter/common/models/app/wan_response.dart';
import 'package:wan_flutter/common/utils/api_constant.dart';
import 'package:wan_flutter/common/utils/http_util.dart';

Expand All @@ -13,11 +13,12 @@ class HomeApi {
return banner.data ?? [];
}

static Future<ArticleListData> requestArticleList(int pageNumber) async {
var response = await WanHttpUtil().get('/article/list/$pageNumber/json');
static Future<ArticleListData> requestArticleList(int currentPage) async {
var response = await WanHttpUtil().get('/article/list/$currentPage/json');

var article = ObjectResponse<ArticleListData>.fromJson(response.data,(json)=>ArticleListData.fromJson(json));

// TODO data 为空问题
return article.data!;
}
}
2 changes: 1 addition & 1 deletion lib/common/api/user_api.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:dio/dio.dart';
import 'package:wan_flutter/common/models/user/coin.dart';
import 'package:wan_flutter/common/models/wan_response.dart';
import 'package:wan_flutter/common/models/app/wan_response.dart';
import 'package:wan_flutter/common/utils/api_constant.dart';
import 'package:wan_flutter/common/utils/http_util.dart';

Expand Down
22 changes: 22 additions & 0 deletions lib/common/api/wx_article_api.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:wan_flutter/common/models/app/wan_response.dart';
import 'package:wan_flutter/common/models/wx_article/wx_article_chapter.dart';
import 'package:wan_flutter/common/utils/http_util.dart';
import 'package:wan_flutter/common/models/app/article_list.dart';

class WxArticleApi {
static Future<List<WxArticleChapter>> getWxArticleChapters() async {
var response = await WanHttpUtil().get('/wxarticle/chapters/json');

var chapters = ListResponse<WxArticleChapter>.fromJson(response.data,(json)=>WxArticleChapter.fromJson(json));

return chapters.data ?? [];
}

static Future<ArticleListData> getWxArticleList(int chapterId,int currentPage) async {
var response = await WanHttpUtil().get('/wxarticle/list/$chapterId/$currentPage/json');

var article = ObjectResponse<ArticleListData>.fromJson(response.data,(json)=>ArticleListData.fromJson(json));

return article.data!;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 66 additions & 0 deletions lib/common/models/wx_article/wx_article_chapter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import 'package:json_annotation/json_annotation.dart';

part 'wx_article_chapter.g.dart';

@JsonSerializable()
class WxArticleChapter {
WxArticleChapter({
required this.articleList,
required this.author,
required this.children,
required this.courseId,
required this.cover,
required this.desc,
required this.id,
required this.lisense,
required this.lisenseLink,
required this.name,
required this.order,
required this.parentChapterId,
required this.type,
required this.userControlSetTop,
required this.visible,
});

final List<dynamic>? articleList;
final String author;
final List<dynamic>? children;
final int courseId;
final String cover;
final String desc;
final int id;
final String lisense;
final String lisenseLink;
final String name;
final int order;
final int parentChapterId;
final int type;
final bool userControlSetTop;
final int visible;

factory WxArticleChapter.fromJson(Map<String, dynamic> json) => _$WxArticleChapterFromJson(json);

Map<String, dynamic> toJson() => _$WxArticleChapterToJson(this);

}

/*
[
{
"articleList": [],
"author": "",
"children": [],
"courseId": 13,
"cover": "",
"desc": "",
"id": 408,
"lisense": "",
"lisenseLink": "",
"name": "鸿洋",
"order": 190000,
"parentChapterId": 407,
"type": 0,
"userControlSetTop": false,
"visible": 1
}
]*/
45 changes: 45 additions & 0 deletions lib/common/models/wx_article/wx_article_chapter.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/common/utils/http_util.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:io';
import 'package:wan_flutter/common/models/wan_response.dart';
import 'package:wan_flutter/common/models/app/wan_response.dart';

import 'package:dio/dio.dart';
import 'package:dio/io.dart';
Expand Down
Loading

0 comments on commit 1f55ff8

Please sign in to comment.