Skip to content

Commit

Permalink
v0.2.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
thl committed Nov 26, 2019
1 parent bd7cb99 commit e5d156f
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 79 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# 更新说明
### v0.2.5 (2019.11.16)
1.基础库升级。
2.一些优化~

### v0.2.2 (2019.07.02)
1.基础库升级。
2.修复OPPO R15详情页问题。
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOGS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# 更新说明
### v0.2.5 (2019.11.16)
1.基础库升级。
2.一些优化~

### v0.2.2 (2019.07.02)
1.基础库升级。
2.修复OPPO R15详情页问题。
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
有关项目最新动态,可以关注App内第一条Hot Item信息。

### 运行本项目注意!!!
本项目运行环境要求!
本项目运行环境要求! Flutter Version (beta v1.10.7)
```
ps:作者Futter版本
[✓] Flutter (Channel beta, v1.6.3, locale zh-Hans-CN)
[✓] Flutter (Channel beta, v1.10.7, locale zh-Hans-CN)
ps:以上是最低支持版本,如不是,请自行升级!
Expand Down Expand Up @@ -46,6 +46,10 @@ flutter run --release
另外附送[login_demo](https://github.com/Sky24n/FlutterRepos/tree/master/login_demo)示例!关于App启动时,未登录跳登录页,已登录进主页。

### [更新说明](./CHANGELOGS.md)
### v0.2.5 (2019.11.16)
1.基础库升级。
2.一些优化~

### v0.2.2 (2019.07.02)
1.基础库升级。
2.修复OPPO R15详情页问题。
Expand Down Expand Up @@ -85,9 +89,9 @@ flutter run --release
<img src="https://gitee.com/uploads/images/2019/0506/004900_5e0bd537_506864.png" width="240"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_wanandroid/splash_video.gif" width="240"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_wanandroid/upgrade_download.gif" width="240">

### 安卓Apk
点击下载 [新版v0.2.2](https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppStore/flutter_wanandroid.apk)
点击下载 [新版v0.2.5](https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppStore/flutter_wanandroid.apk)

扫码下载 新版v0.2.2
扫码下载 新版v0.2.5
![flutter_wanandroid](https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_wanandroid/qrcode.png)

### iOS:请自行clone项目代码运行。
Expand Down Expand Up @@ -437,22 +441,22 @@ double adapterSize = ScreenUtil.getAdapterSizeCtx(context, 100)
[Streams-Block-Reactive-Programming-in-Flutter](https://github.com/boeledi/Streams-Block-Reactive-Programming-in-Flutter)

### 开源库
1. Dart常用工具类库[common_utils][common_utils_github](作者)
1. Dart常用工具类库[common_utils][common_utils_github]
该库包含TimerUtil(倒计时,定时任务),TimelineUtil(时间轴),DateUtil(日期格式化),RegexUtil(正则验证手机号,身份证,邮箱等等),RegexUtil(正则验证手机号,身份证,邮箱等等),NumUtil(保留x位小数, 精确加、减、乘、除, 防止精度丢失),MoneyUtil(元转分,分转元),ObjectUtil(判空),LogUtil(简单封装打印日志)。
如果你有不错的纯dart工具类或对已有对工具类有更好的优化建议,欢迎PR,大家一起维护~
2. Flutter常用工具类库[flustars][flustars_github](作者)
2. Flutter常用工具类库[flustars][flustars_github]
该库包含SpUtil(单例"同步" SharedPreferences 工具类),ScreenUtil(屏幕适配),WidgetUtil(Widget渲染监听,获取Widget宽高,在屏幕上的坐标)。
如果你有不错的Flutter工具类或对已有对工具类有更好的优化建议,欢迎PR,大家一起维护~
3. 汉字转拼音库[lpinyin](https://github.com/flutterchina/lpinyin)(作者)
4. 国际化/多语言库[fluintl](https://github.com/Sky24n/fluintl)(作者)
3. 汉字转拼音库[lpinyin](https://github.com/flutterchina/lpinyin)
4. 国际化/多语言库[fluintl](https://github.com/Sky24n/fluintl)
5. UI组件库[flukit](https://github.com/flutterchina/flukit)
6. 网络请求[dio](https://github.com/flutterchina/dio)
7. 图片加载[cached_network_image](https://github.com/renefloor/flutter_cached_network_image)
8. 上拉加载和下拉刷新[pull_to_refresh](https://github.com/peng8350/flutter_pulltorefresh)
9. [url_launcher](https://github.com/flutter/plugins/tree/master/packages/url_launcher)
10. 点赞效果[LikeButton](https://github.com/yumi0629/LikeButton)
11. 安卓webview增加滚动监听[webview_flutter](https://github.com/Sky24n/plugins/tree/master/packages/webview_flutter)
12. 城市列表[azlistview](https://github.com/flutterchina/azlistview)(作者)
12. 城市列表[azlistview](https://github.com/flutterchina/azlistview)

### 项目问题汇总
Q1:Flutter国际化系统切换iOS不生效问题?
Expand All @@ -467,10 +471,6 @@ Email &nbsp;&nbsp;: [email protected]
⭐⭐⭐ 如果您觉得本项目不错的话,来个star支持下作者吧! ⭐⭐⭐
关于项目任何问题请提交[issues](https://github.com/Sky24n/flutter_wanandroid/issues),私发QQ邮件将不再回复~

Flutter全局屏幕适配 [auto_size](https://github.com/flutterchina/auto_size)

[![GitHub stars](https://img.shields.io/github/stars/flutterchina/auto_size.svg?style=social&label=Star)](https://github.com/flutterchina/auto_size) [![GitHub forks](https://img.shields.io/github/forks/flutterchina/auto_size.svg?style=social&label=Fork)](https://github.com/flutterchina/auto_size) [![GitHub watchers](https://img.shields.io/github/watchers/flutterchina/auto_size.svg?style=social&label=Watch)](https://github.com/flutterchina/auto_size)

Flutter版玩安卓 [flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid)

[![GitHub stars](https://img.shields.io/github/stars/Sky24n/flutter_wanandroid.svg?style=social&label=Star)](https://github.com/Sky24n/flutter_wanandroid) [![GitHub forks](https://img.shields.io/github/forks/Sky24n/flutter_wanandroid.svg?style=social&label=Fork)](https://github.com/Sky24n/flutter_wanandroid) [![GitHub watchers](https://img.shields.io/github/watchers/Sky24n/flutter_wanandroid.svg?style=social&label=Watch)](https://github.com/Sky24n/flutter_wanandroid)
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

Expand Down
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
1 change: 1 addition & 0 deletions android/settings_aar.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':app'
10 changes: 10 additions & 0 deletions ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/thl/Library/Android/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/thl/AndroidStudioProjects/smzc workspace/flutter_wanandroid"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/thl/Library/Android/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=0.2.2"
export "FLUTTER_BUILD_NUMBER=0.2.2"
6 changes: 4 additions & 2 deletions lib/common/common.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'global.dart';

class Constant {
static const String keyLanguage = 'key_language';

Expand All @@ -17,8 +19,8 @@ class Constant {

class AppConfig {
static const String appName = 'flutter_wanandroid';
static const String version = '0.2.2';
static const bool isDebug = true;
static const String version = '0.2.5';
static const bool isDebug = Global.kReleaseMode;
}

class LoadStatus {
Expand Down
24 changes: 24 additions & 0 deletions lib/common/global.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flustars/flustars.dart';

class Global {
static const bool kReleaseMode =
bool.fromEnvironment('dart.vm.product', defaultValue: false);

//初始化全局信息
static Future init(VoidCallback callback) async {
WidgetsFlutterBinding.ensureInitialized();
await SpUtil.getInstance();
callback();
if (Platform.isAndroid) {
// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。
SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
}
}
28 changes: 3 additions & 25 deletions lib/common/sp_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SpHelper {
///
/// SpHelper.putObject(key, UserModel);
///
static void putObject<T>(String key, Object value) {
static void _putObject<T>(String key, Object value) {
switch (T) {
case int:
SpUtil.putInt(key, value);
Expand All @@ -40,30 +40,8 @@ class SpHelper {
}
}

static Object getObject<T>(String key) {
Map map = SpUtil.getObject(key);
if (map == null) return null;
Object obj;
switch (T) {
case SplashModel:
obj = SplashModel.fromJson(map);
break;
case LanguageModel:
obj = LanguageModel.fromJson(map);
break;
case VersionModel:
obj = VersionModel.fromJson(map);
break;
case UserModel:
obj = UserModel.fromJson(map);
break;
default:
break;
}
return obj;
}

static String getThemeColor() {
return SpUtil.getString(Constant.key_theme_color, defValue: 'deepPurpleAccent');
return SpUtil.getString(Constant.key_theme_color,
defValue: 'deepPurpleAccent');
}
}
19 changes: 11 additions & 8 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_wanandroid/common/component_index.dart';
import 'package:flutter_wanandroid/ui/pages/main_page.dart';
import 'package:flutter_wanandroid/ui/pages/page_index.dart';
import 'package:auto_size/auto_size.dart';

void main() => runAutoSizeApp(BlocProvider<ApplicationBloc>(
import 'common/global.dart';

void main() {
Global.init(() {
runApp(BlocProvider<ApplicationBloc>(
bloc: ApplicationBloc(),
child: BlocProvider(child: MyApp(), bloc: MainBloc()),
));
});
}

class MyApp extends StatefulWidget {
@override
Expand All @@ -26,8 +31,7 @@ class MyAppState extends State<MyApp> {
void initState() {
super.initState();
setLocalizedValues(localizedValues);
_initAsync();
_initListener();
init();
}

void _init() {
Expand All @@ -44,10 +48,9 @@ class MyAppState extends State<MyApp> {
DioUtil().setConfig(config);
}

void _initAsync() async {
await SpUtil.getInstance();
if (!mounted) return;
void init() {
_init();
_initListener();
_loadLocale();
}

Expand All @@ -61,7 +64,7 @@ class MyAppState extends State<MyApp> {
void _loadLocale() {
setState(() {
LanguageModel model =
SpHelper.getObject<LanguageModel>(Constant.keyLanguage);
SpUtil.getObj(Constant.keyLanguage, (v) => LanguageModel.fromJson(v));
if (model != null) {
_locale = new Locale(model.languageCode, model.countryCode);
} else {
Expand Down
6 changes: 4 additions & 2 deletions lib/ui/pages/language_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class _LanguagePageState extends State<LanguagePage> {
_list.add(LanguageModel(Ids.languageHK, 'zh', 'HK'));
_list.add(LanguageModel(Ids.languageEN, 'en', 'US'));

_currentLanguage = SpHelper.getObject<LanguageModel>(Constant.keyLanguage);
_currentLanguage =
SpUtil.getObj(Constant.keyLanguage, (v) => LanguageModel.fromJson(v));
;
if (ObjectUtil.isEmpty(_currentLanguage)) {
_currentLanguage = _list[0];
}
Expand Down Expand Up @@ -61,7 +63,7 @@ class _LanguagePageState extends State<LanguagePage> {
style: new TextStyle(fontSize: 12.0),
),
onPressed: () {
SpHelper.putObject(
SpUtil.putObject(
Constant.keyLanguage,
ObjectUtil.isEmpty(_currentLanguage.languageCode)
? null
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/pages/main_left_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class _MainLeftPageState extends State<MainLeftPage> {
if (Util.isLogin()) {
if (!_pageInfo.contains(loginOut)) {
_pageInfo.add(loginOut);
UserModel userModel =
SpHelper.getObject<UserModel>(BaseConstant.keyUserModel);
UserModel userModel = SpUtil.getObj(
BaseConstant.keyUserModel, (v) => UserModel.fromJson(v));
_userName = userModel?.username ?? "";
LogUtil.e("_userName : $_userName");
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/pages/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SettingPage extends StatelessWidget {
LogUtil.e("SettingPage build......");
final ApplicationBloc bloc = BlocProvider.of<ApplicationBloc>(context);
LanguageModel languageModel =
SpHelper.getObject<LanguageModel>(Constant.keyLanguage);
SpUtil.getObj(Constant.keyLanguage, (v) => LanguageModel.fromJson(v));
return new Scaffold(
appBar: AppBar(
title: Text(
Expand Down
14 changes: 7 additions & 7 deletions lib/ui/pages/splash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ class SplashPageState extends State<SplashPage> {
@override
void initState() {
super.initState();
_initAsync();
_init();
}

void _initAsync() async {
await SpUtil.getInstance();
void _init() {
_loadSplashData();
Observable.just(1).delay(new Duration(milliseconds: 500)).listen((_) {
// SpUtil.putBool(Constant.key_guide, false);
Expand All @@ -47,21 +46,22 @@ class SplashPageState extends State<SplashPage> {
}

void _loadSplashData() {
_splashModel = SpHelper.getObject<SplashModel>(Constant.key_splash_model);
_splashModel = SpUtil.getObj(
Constant.key_splash_model, (v) => SplashModel.fromJson(v));
if (_splashModel != null) {
setState(() {});
}
HttpUtils httpUtil = new HttpUtils();
httpUtil.getSplash().then((model) {
if (!ObjectUtil.isEmpty(model.imgUrl)) {
if (_splashModel == null || (_splashModel.imgUrl != model.imgUrl)) {
SpHelper.putObject(Constant.key_splash_model, model);
SpUtil.putObject(Constant.key_splash_model, model);
setState(() {
_splashModel = model;
});
}
} else {
SpHelper.putObject(Constant.key_splash_model, null);
SpUtil.putObject(Constant.key_splash_model, null);
}
});
}
Expand Down Expand Up @@ -244,6 +244,6 @@ class SplashPageState extends State<SplashPage> {
@override
void dispose() {
super.dispose();
if (_timerUtil != null) _timerUtil.cancel(); //记得中dispose里面把timer cancel。
if (_timerUtil != null) _timerUtil.cancel(); //记得在dispose里面把timer cancel。
}
}
2 changes: 1 addition & 1 deletion lib/ui/pages/user/user_login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LoginBody extends StatelessWidget {
TextEditingController _controllerPwd = new TextEditingController();
UserRepository userRepository = new UserRepository();
UserModel userModel =
SpHelper.getObject<UserModel>(BaseConstant.keyUserModel);
SpUtil.getObj(BaseConstant.keyUserModel, (v) => UserModel.fromJson(v));
_controllerName.text = userModel?.username ?? "";

void _userLogin() {
Expand Down
Loading

0 comments on commit e5d156f

Please sign in to comment.