Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ckken committed Sep 3, 2019
2 parents ea103ac + f376fe9 commit dead370
Show file tree
Hide file tree
Showing 37 changed files with 2,093 additions and 343 deletions.
24 changes: 14 additions & 10 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
15BE2897D1518D9BDD5AF970 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
3DB87B9B20AEA710C58FBCC8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
6F6754CA16FD7E3C9E4FCEB3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
Expand All @@ -60,7 +58,6 @@
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BEBBA521223FEA6600583D52 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
C1D6F379F6B3C85C2CC34999 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
D7BE9010C4F7FF033BA299B7 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
FDCB5E5FC17434D1FF8247D2 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -192,6 +189,7 @@
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 5K9P57YFSL;
ProvisioningStyle = Automatic;
};
};
};
Expand All @@ -200,6 +198,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -281,15 +280,11 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/flutter_downloader/FlutterDownloaderDatabase.bundle",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FlutterDownloaderDatabase.bundle",
);
Expand Down Expand Up @@ -404,6 +399,8 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5K9P57YFSL;
ENABLE_BITCODE = NO;
Expand All @@ -417,8 +414,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.flutter.beer;
PRODUCT_BUNDLE_IDENTIFIER = com.flutterken.ui;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
Expand Down Expand Up @@ -530,6 +528,8 @@
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5K9P57YFSL;
ENABLE_BITCODE = NO;
Expand All @@ -543,8 +543,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.flutter.beer;
PRODUCT_BUNDLE_IDENTIFIER = com.flutterken.ui;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
Expand All @@ -554,6 +555,8 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5K9P57YFSL;
ENABLE_BITCODE = NO;
Expand All @@ -567,8 +570,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.flutter.beer;
PRODUCT_BUNDLE_IDENTIFIER = com.flutterken.ui;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
Expand Down
40 changes: 36 additions & 4 deletions lib/components/widget_comp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class IndexState extends State<Index> {
backgroundImage: NetworkImage(
info.avatarUrl,
),
radius: 35,
radius: 30,
),
title: Text(
info.name,
Expand All @@ -75,10 +75,10 @@ class IndexState extends State<Index> {
this._bodyList.length = 0;
String mdText = await this.getMdFile(widget.mdUrl);
String nameKey = AuthorList.list[widget.title];
if (nameKey != null) {
/*if (nameKey != null) {
this._bodyList.add(authorTile(nameKey));
this._bodyList.add(Divider());
}
}*/
print('文档完成长度:${mdText.length}');
if (mdText.length > 30) {
this._bodyList.add(await markdown_comp.Index(mdText));
Expand Down Expand Up @@ -117,6 +117,29 @@ class IndexState extends State<Index> {
);
}

showCode(context) async {
/*if (Store.value<ConfigModel>(context).isPro) {
// 线上文档
FluroRouter.router.navigateTo(
context,
'webview?title=${widget.title}&url=${Uri.encodeComponent(Store.value<ConfigModel>(context).env.githubAssetOrigin+widget.mdUrl)}'
);
} else {*/
// 加载本地
String mdStr = await AssetUtils.readLocaleFile(widget.mdUrl);
Navigator.of(context).push(
MaterialPageRoute(builder: (BuildContext build) {
return Scaffold(
appBar: AppBar(title: Text(widget.title),),
body: ListView(
children: <Widget>[markdown_comp.Index(mdStr)],
),
);
})
);
//}
}

Future getMdFile(url) async {
// bool productionEnv = Store.value<ConfigModel>(context).isPro;
bool productionEnv = false;
Expand All @@ -129,6 +152,15 @@ class IndexState extends State<Index> {

getActions(context) {
return [
/*IconButton(
color: Color(AppTheme.blackColor),
icon: Icon(
Icons.code
),
onPressed: () async {
this.showCode(context);
},
),
IconButton(
color: Color(AppTheme.blackColor),
icon: Icon(
Expand All @@ -140,7 +172,7 @@ class IndexState extends State<Index> {
'/webview?title=${widget.title}&url=${Uri.encodeComponent(widget.originCodeUrl)}',
);
},
),
),*/
IconButton(
icon: Icon(Icons.share),
color: Color(AppTheme.blackColor),
Expand Down
1 change: 1 addition & 0 deletions lib/config/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import 'development.dart' as Development;
import 'production.dart' as Production;

const bool isPro = false;
const String owner_repo = 'efoxTeam/flutter-ui';

Object env = isPro ? Production.Config() : Development.Config();
2 changes: 1 addition & 1 deletion lib/config/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AppTheme {
static int blackColor = 0xFF000000;
static int lineColor = 0xFFEEEEEE;
static getThemeData(String theme) {
//print('==================================getThemeData=$theme');
print('==================================getThemeData=$theme');
mainColor = materialColor[theme];
ThemeData themData = ThemeData(
textTheme: TextTheme(
Expand Down
13 changes: 9 additions & 4 deletions lib/controller/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import 'package:efox_flutter/store/index.dart'

import 'package:efox_flutter/utils/appVersion.dart' show AppVersion;

void initState() {
void initState() async {
// 获取版本号
Store.valueNotCtx<ConfigModel>().getAppVersion();
Store.value<ConfigModel>().getAppVersion();
// 登录
Store.valueNotCtx<UserModel>().getLocalUserInfo();
/*Store.value<UserModel>().getLocalUserInfo().then((res) {
if (res) {
Store.value<UserModel>().getUserStar();
}
});*/
// Store.value<UserModel>().getFlutterUIStar();
Future.delayed(Duration(seconds: 3), () {
AppVersion().check(Store.widgetCtx);
AppVersion().check(Store.context);
});
}
18 changes: 12 additions & 6 deletions lib/http/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ Dio getDio({options, loading}) {
print("返回值 ${response.data}");
print('=========【请求成功】End============');
await AppLoading.afterResponse(response.request.uri, loading);
return response;
return response;
},
onError: (DioError e) async {
await AppLoading.afterResponse(e.request.uri, loading);
print('e.request.uri=======================${e.request}');
if (e.request != null && e.request.uri != null)
await AppLoading.afterResponse(e.request.uri, loading);
dynamic msg = e.message;
dynamic code = 0; // 错误码
dynamic status = e.type; // http请求状态
Expand All @@ -60,24 +62,28 @@ Dio getDio({options, loading}) {
status = e.response.statusCode;
}
print('========【请求失败 Start】=============');
print("请求地址 ${e.request.uri}");
print("请求地址 ${e.request}");
print("状态码 ${status}");
print("返回msg ${msg}");
print('=========【请求失败 End】============');
return dio.reject({'msg': msg, 'code': code, 'status': status});
},
));
dio.interceptors.add(LogInterceptor(responseBody: false)); //开启请求日志

return dio;
}

Future<dynamic> get({url, data = const {}, options, loading}) async {
return getDio(options: options, loading: loading ?? Map())
.get(url);
return getDio(options: options, loading: loading ?? Map()).get(url);
}

Future post({url, data = const {}, options, loading}) async {
return getDio(options: options, loading: loading ?? Map())
.post(url, data: data);
}

Future put({url, data = const {}, options, loading}) async {
return getDio(options: options, loading: loading ?? Map())
.put(url, data: data);
}
4 changes: 2 additions & 2 deletions lib/http/loading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void beforeRequest(uri, Map<dynamic, dynamic> options) {
void afterResponse(uri, Map<dynamic, dynamic> options) {
dict.remove(uri);
if (dict.length == 0 && loading == true) {
Navigator.of(Store.widgetCtx, rootNavigator: true).pop('close dialog');
Navigator.of(Store.context, rootNavigator: true).pop('close dialog');
loading = false;
}
}
Expand All @@ -31,7 +31,7 @@ void showAppLoading(Map<dynamic, dynamic> options) {
'text': options['text'] ?? 'loading...'
};
showDialog(
context: Store.widgetCtx,
context: Store.context,
builder: (context) {
return LoadingDialog(text: options['text']);
},
Expand Down
30 changes: 20 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import 'package:flutter_localizations/flutter_localizations.dart'; //语言包
import 'package:efox_flutter/lang/index.dart'
show AppLocalizationsDelegate, AppLocalizations;
import 'package:efox_flutter/lang/config.dart' show ConfigLanguage;
import 'package:efox_flutter/store/index.dart'
show Store, ConfigModel; //引用Store 层
import 'package:efox_flutter/store/index.dart'; //引用Store 层
import 'package:efox_flutter/router/index.dart' show FluroRouter; //路由
import 'package:efox_flutter/config/theme.dart' show AppTheme; //主题
import 'package:efox_flutter/utils/analytics.dart' as Analytics; //统计
import 'package:oktoast/oktoast.dart' show OKToast;
import 'package:efox_flutter/page/home.dart' as HomePage;

// import './mock/index.dart' as TestCase;
class MainApp extends StatefulWidget {
MainApp() {
Expand All @@ -18,6 +20,7 @@ class MainApp extends StatefulWidget {
@override
MainAppState createState() => MainAppState();
}

class MainAppState extends State<MainApp> {
// 定义全局 语言代理
AppLocalizationsDelegate _delegate;
Expand All @@ -26,19 +29,21 @@ class MainAppState extends State<MainApp> {
//实例化多语言
super.initState();
_delegate = AppLocalizationsDelegate();
Store.setStoreCtx(context); // 初始化数据层

Future.delayed(Duration.zero, () async {
Store.value<ConfigModel>().getTheme();
});
}

@override
Widget build(BuildContext context) {
Store.value<ConfigModel>(context).getTheme();

return Store.connect<ConfigModel>(
builder: (context, child, model) {
Store.of(context);
return Consumer<ConfigModel>(
builder: (context, configModel, child) {
return MaterialApp(
localeResolutionCallback: (deviceLocale, supportedLocales) {
print(
'deviceLocale=$deviceLocale supportedLocales=$supportedLocales');
'deviceLocale=$deviceLocale supportedLocales=$supportedLocales context=$context');
Locale _locale = supportedLocales.contains(deviceLocale)
? deviceLocale
: Locale('zh');
Expand All @@ -55,13 +60,18 @@ class MainAppState extends State<MainApp> {
_delegate,
],
supportedLocales: ConfigLanguage.supportedLocales,
theme: AppTheme.getThemeData(model.theme),
theme: AppTheme.getThemeData(configModel.theme),
onGenerateRoute: FluroRouter.router.generator,
// home: HomePage.Index(),
navigatorObservers: <NavigatorObserver>[Analytics.observer],
);
},
);
}
}

void main() => runApp(Store.init(child: MainApp()));
void main() => runApp(
Store.init(
child: MainApp(),
),
);
2 changes: 2 additions & 0 deletions lib/package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Flutter Packages for FLUTTER UI APP
> packages 为纯flutter 组件,沉淀通用组件,通用方法,通用模块
Empty file added lib/package/router/router.dart
Empty file.
Loading

0 comments on commit dead370

Please sign in to comment.