Skip to content

Commit

Permalink
update version 0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky.Zhang committed Sep 18, 2019
1 parent 70391c2 commit bb9c132
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 40 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@


## 0.1.4

- 适配Flutter新版本(1.9-1.10)
- 加入LeanCloud API云服务
- 移除之前屏幕适配方案,对NativeView影响过大
- 移除修复首页黑屏问题的代码(官方已修复)
- 修复版本更新导致的AppBar中进度条颜色与背景色不明显的问题
- 部分代码优化
- 重构Http使用方式,解耦性更好
- 首页banner高度调整
- **Android加入版本更新**
- Android状态栏透明

## 0.1.3

Expand Down
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Language: [English](https://github.com/phoenixsky/fun_android_flutter/blob/maste
[![Get it from iTunes](https://lisk.io/assets/svg/download_on_the_app_store_badge.svg)](https://apps.apple.com/cn/app/id1477299503)
> 为了通过审核,将`android`等相关文字替换为了`iOS`,以及关闭了详情功能.在`2019年9月3日9点30分`后可正常使用.
* 代码编译:
* Flutter SDK (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G87, locale zh-Hans-CN)
* 如果要查看运行效果,一定要使用Release模式,流畅程度差距非常大
> Flutter的`Debug``Release`的编译模式不同,下分别是 `JIT``AOT`.`Debug`模式支持`hot reload`.
* iOS运行在splash页面卡住,需要检查当前的scheme,如果为`release`,需在命令行执行`flutter build ios`
![image.png](https://upload-images.jianshu.io/upload_images/581515-70d9efec3827e019.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000)
# 代码编译:
* Flutter SDK (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G87, locale zh-Hans-CN)
* 如果要查看运行效果,一定要使用Release模式,流畅程度差距非常大
> Flutter的`Debug``Release`的编译模式不同,下分别是 `JIT``AOT`.`Debug`模式支持`hot reload`.
* iOS运行在splash页面卡住,需要检查当前的scheme,如果为`release`,需在命令行执行`flutter build ios`
![image.png](https://upload-images.jianshu.io/upload_images/581515-70d9efec3827e019.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000)



Expand All @@ -50,6 +50,18 @@ Language: [English](https://github.com/phoenixsky/fun_android_flutter/blob/maste

# 更新

## 2019-09-18 V0.1.4

- 适配Flutter新版本(1.9-1.10)
- 加入LeanCloud API云服务
- 移除之前屏幕适配方案,对NativeView影响过大
- 移除修复首页黑屏问题的代码(官方已修复)
- 修复版本更新导致的AppBar中进度条颜色与背景色不明显的问题
- 重构Http使用方式,解耦性更好
- 首页banner高度调整
- **Android加入版本更新**
- Android状态栏透明

## 2019-09-10

- flutter版本更新
Expand Down Expand Up @@ -197,6 +209,7 @@ Language: [English](https://github.com/phoenixsky/fun_android_flutter/blob/maste
# 关于作者
* [Github](https://github.com/phoenixsky)
* [个人博客](http://blog.phoenixsky.cn/)
* [掘金](https://juejin.im/user/567fe97c60b25aa3dcd4bcc0)
* [简书](https://www.jianshu.com/u/145e6297cb26)
* Email: moran.fc@gmail.com

Expand Down
32 changes: 6 additions & 26 deletions lib/config/net/wan_android_api.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:convert';

import 'package:cookie_jar/cookie_jar.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -35,37 +33,19 @@ class ApiInterceptor extends InterceptorsWrapper {

@override
onResponse(Response response) {
var statusCode = response.statusCode;
if (statusCode != 200) {
/// 非200会在http的onError()中
RespData respData = RespData.fromJson(response.data);
if (respData.success) {
response.data = respData.data;
return http.resolve(response);
} else {
// debugPrint('---api-response--->resp----->${response.data}');
if (response.data is Map) {
RespData respData = RespData.fromJson(response.data);
if (respData.success) {
response.data = respData.data;
return http.resolve(response);
} else {
return handleFailed(respData);
}
} else {
/// WanAndroid API 如果报错,返回的数据类型存在问题
/// eg: 没有登录的返回的值为'{"errorCode":-1001,"errorMsg":"请先登录!"}'
/// 虽然是json样式,但是[response.headers.contentType?.mimeType]的值为'text/html'
/// 导致dio没有解析为json对象.两种解决方案:
/// 1.在post/get方法前加入泛型(Map),让其强制转换
/// 2.在这里统一处理再次解析
debugPrint('---api-response--->error--not--map---->$response');
RespData respData = RespData.fromJson(json.decode(response.data));
return handleFailed(respData);
}
return handleFailed(respData);
}
}

Future<Response> handleFailed(RespData respData) {
debugPrint('---api-response--->error---->$respData');
if (respData.code == -1001) {
// 由于cookie过期,所以需要清除本地存储的登录信息
// 如果cookie过期,需要清除本地存储的登录信息
// StorageManager.localStorage.deleteItem(UserModel.keyUser);
// 需要登录
throw const UnAuthorizedException();
Expand Down
2 changes: 1 addition & 1 deletion lib/service/wan_android_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WanAndroidRepository {

// 文章
static Future fetchArticles(int pageNum, {int cid}) async {
await Future.delayed(Duration(seconds: 1));
// await Future.delayed(Duration(seconds: 1));
var response = await http.get('article/list/$pageNum/json',
queryParameters: (cid != null ? {'cid': cid} : null));
return response.data['datas']
Expand Down
8 changes: 4 additions & 4 deletions lib/ui/page/tab/user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class _UserPageState extends State<UserPage>
ProviderWidget<LoginModel>(
model: LoginModel(Provider.of(context)),
builder: (context, model, child) {
if(model.busy){
if (model.busy) {
return Padding(
padding: const EdgeInsets.only(right:15.0),
padding: const EdgeInsets.only(right: 15.0),
child: AppBarIndicator(),
);
}
if(model.userModel.hasUser){
if (model.userModel.hasUser) {
return IconButton(
tooltip: S.of(context).logout,
icon: Icon(Icons.exit_to_app),
Expand Down Expand Up @@ -134,7 +134,7 @@ class UserCoin extends StatelessWidget {
onModelReady: (model) => model.initData(),
builder: (context, model, child) {
if (model.busy) {
return CupertinoActivityIndicator(radius: 8);
return AppBarIndicator(radius: 8);
}
var textStyle = Theme.of(context).textTheme.body1.copyWith(
color: Colors.white.withAlpha(200),
Expand Down
6 changes: 5 additions & 1 deletion lib/ui/widget/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import 'package:flutter/material.dart';
/// 由于app不管明暗模式,都是有底色
/// 所以将indicator颜色为亮色
class AppBarIndicator extends StatelessWidget {
final double radius;

AppBarIndicator({this.radius:10});

@override
Widget build(BuildContext context) {
return Theme(
data: ThemeData(
cupertinoOverrideTheme:
CupertinoThemeData(brightness: Brightness.dark)),
child: CupertinoActivityIndicator());
child: CupertinoActivityIndicator(radius: radius));
}
}

0 comments on commit bb9c132

Please sign in to comment.