@@ -680,7 +680,7 @@ | |||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
} | } | ||||
], | ], | ||||
"generated": "2020-09-11T11:58:25.076408Z", | |||||
"generated": "2020-09-14T01:30:48.161905Z", | |||||
"generator": "pub", | "generator": "pub", | ||||
"generatorVersion": "2.7.2" | "generatorVersion": "2.7.2" | ||||
} | } |
@@ -80,7 +80,6 @@ | |||||
3CF5E07C1CDF5F802B057127 /* Pods-Runner.release.xcconfig */, | 3CF5E07C1CDF5F802B057127 /* Pods-Runner.release.xcconfig */, | ||||
E03B6CB558D0A26B049E0718 /* Pods-Runner.profile.xcconfig */, | E03B6CB558D0A26B049E0718 /* Pods-Runner.profile.xcconfig */, | ||||
); | ); | ||||
name = Pods; | |||||
path = Pods; | path = Pods; | ||||
sourceTree = "<group>"; | sourceTree = "<group>"; | ||||
}; | }; | ||||
@@ -392,9 +391,9 @@ | |||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
); | ); | ||||
PRODUCT_BUNDLE_IDENTIFIER = cn.shengfen.Fm; | |||||
PRODUCT_BUNDLE_IDENTIFIER = cn.zhios.zhiying; | |||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
PROVISIONING_PROFILE_SPECIFIER = shengFenFMTest; | |||||
PROVISIONING_PROFILE_SPECIFIER = cn.zhios.zhiying_dev; | |||||
VERSIONING_SYSTEM = "apple-generic"; | VERSIONING_SYSTEM = "apple-generic"; | ||||
}; | }; | ||||
name = Profile; | name = Profile; | ||||
@@ -525,9 +524,9 @@ | |||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
); | ); | ||||
PRODUCT_BUNDLE_IDENTIFIER = cn.shengfen.Fm; | |||||
PRODUCT_BUNDLE_IDENTIFIER = cn.zhios.zhiying; | |||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
PROVISIONING_PROFILE_SPECIFIER = shengFenFMTest; | |||||
PROVISIONING_PROFILE_SPECIFIER = cn.zhios.zhiying_dev; | |||||
VERSIONING_SYSTEM = "apple-generic"; | VERSIONING_SYSTEM = "apple-generic"; | ||||
}; | }; | ||||
name = Debug; | name = Debug; | ||||
@@ -551,9 +550,9 @@ | |||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
); | ); | ||||
PRODUCT_BUNDLE_IDENTIFIER = cn.shengfen.Fm; | |||||
PRODUCT_BUNDLE_IDENTIFIER = cn.zhios.zhiying; | |||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
PROVISIONING_PROFILE_SPECIFIER = shengFenFMTest; | |||||
PROVISIONING_PROFILE_SPECIFIER = cn.zhios.zhiying_dev; | |||||
VERSIONING_SYSTEM = "apple-generic"; | VERSIONING_SYSTEM = "apple-generic"; | ||||
}; | }; | ||||
name = Release; | name = Release; | ||||
@@ -27,8 +27,6 @@ | |||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||||
shouldUseLaunchSchemeArgsEnv = "YES"> | shouldUseLaunchSchemeArgsEnv = "YES"> | ||||
<Testables> | |||||
</Testables> | |||||
<MacroExpansion> | <MacroExpansion> | ||||
<BuildableReference | <BuildableReference | ||||
BuildableIdentifier = "primary" | BuildableIdentifier = "primary" | ||||
@@ -38,11 +36,11 @@ | |||||
ReferencedContainer = "container:Runner.xcodeproj"> | ReferencedContainer = "container:Runner.xcodeproj"> | ||||
</BuildableReference> | </BuildableReference> | ||||
</MacroExpansion> | </MacroExpansion> | ||||
<AdditionalOptions> | |||||
</AdditionalOptions> | |||||
<Testables> | |||||
</Testables> | |||||
</TestAction> | </TestAction> | ||||
<LaunchAction | <LaunchAction | ||||
buildConfiguration = "Debug" | |||||
buildConfiguration = "Release" | |||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||||
launchStyle = "0" | launchStyle = "0" | ||||
@@ -61,8 +59,6 @@ | |||||
ReferencedContainer = "container:Runner.xcodeproj"> | ReferencedContainer = "container:Runner.xcodeproj"> | ||||
</BuildableReference> | </BuildableReference> | ||||
</BuildableProductRunnable> | </BuildableProductRunnable> | ||||
<AdditionalOptions> | |||||
</AdditionalOptions> | |||||
</LaunchAction> | </LaunchAction> | ||||
<ProfileAction | <ProfileAction | ||||
buildConfiguration = "Profile" | buildConfiguration = "Profile" | ||||
@@ -1,9 +1,16 @@ | |||||
import 'package:flutter/foundation.dart'; | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/pages/home_page/home_page.dart'; | import 'package:zhiying_base_widget/pages/home_page/home_page.dart'; | ||||
import 'package:zhiying_base_widget/register.dart'; | import 'package:zhiying_base_widget/register.dart'; | ||||
void main() => runApp(MyApp()); | |||||
void main() { | |||||
FlutterError.onError = (FlutterErrorDetails details) { | |||||
FlutterError.dumpErrorToConsole(details); | |||||
print(details.exceptionAsString()); | |||||
// if (kReleaseMode) exit(1); | |||||
}; | |||||
runApp(MyApp()); | |||||
} | |||||
class MyApp extends StatefulWidget { | class MyApp extends StatefulWidget { | ||||
@override | @override | ||||
@@ -11,14 +18,28 @@ class MyApp extends StatefulWidget { | |||||
} | } | ||||
class _MyAppState extends State<MyApp> { | class _MyAppState extends State<MyApp> { | ||||
Widget getErrorWidget(BuildContext context, FlutterErrorDetails error) { | |||||
return Center( | |||||
child: Text( | |||||
"走神了~\n${error.exceptionAsString()}", | |||||
style: | |||||
Theme.of(context).textTheme.title.copyWith(color: Colors.redAccent), | |||||
), | |||||
); | |||||
} | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
super.initState(); | super.initState(); | ||||
print('初始化~~~~'); | |||||
BaseWidgetRegister.init(); | BaseWidgetRegister.init(); | ||||
} | } | ||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
ErrorWidget.builder = (FlutterErrorDetails errorDetails) { | |||||
return getErrorWidget(context, errorDetails); | |||||
}; | |||||
return MaterialApp( | return MaterialApp( | ||||
home: HomePage(), | home: HomePage(), | ||||
); | ); | ||||
@@ -97,7 +97,7 @@ class _MainPageContainerState extends State<_MainPageContainer> { | |||||
removeTop: true, | removeTop: true, | ||||
context: context, | context: context, | ||||
child: SmartRefresher( | child: SmartRefresher( | ||||
enablePullDown: false, | |||||
enablePullDown: true, | |||||
enablePullUp: false, | enablePullUp: false, | ||||
header: WaterDropHeader(), | header: WaterDropHeader(), | ||||
controller: _refreshController, | controller: _refreshController, | ||||
@@ -132,12 +132,24 @@ class _MainPageContainerState extends State<_MainPageContainer> { | |||||
WidgetModel item = | WidgetModel item = | ||||
WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | ||||
print('item.modName ${item.modName}'); | |||||
list.addAll(WidgetFactory.create( | list.addAll(WidgetFactory.create( | ||||
item.modName, | item.modName, | ||||
isSliver: true, | isSliver: true, | ||||
model: datas[i], | model: datas[i], | ||||
)); | )); | ||||
} | } | ||||
print('生成列表widget个数 ${list.length}'); | |||||
if (list.length <= 0) { | |||||
list.add(SliverToBoxAdapter( | |||||
child: Container( | |||||
height: 200, | |||||
child: Center( | |||||
child: Text('暂时无数据哦~'), | |||||
), | |||||
), | |||||
)); | |||||
} | |||||
return list; | return list; | ||||
} | } | ||||
} | } |
@@ -1,34 +1,37 @@ | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:zhiying_base_widget/widgets/home_slide_banner/model/home_slide_banner_model.dart'; | |||||
import 'package:zhiying_comm/util/net_util.dart'; | |||||
import 'package:zhiying_base_widget/widgets/home/home_slide_banner/model/home_slide_banner_model.dart'; | |||||
import 'package:zhiying_comm/util/empty_util.dart'; | import 'package:zhiying_comm/util/empty_util.dart'; | ||||
import 'package:zhiying_comm/util/global_config.dart'; | import 'package:zhiying_comm/util/global_config.dart'; | ||||
import 'package:zhiying_comm/util/net_util.dart'; | |||||
class HomeSlideBannerRepository{ | |||||
/// 获取缓存数据 | |||||
Future<List<HomeSlideBannerModelItems>> fetchCachedDate({@required int id}) async{ | |||||
var cached = await NetUtil.getRequestCachedData('/api/v1/mod', params: {'ids': [id]}); | |||||
if(!EmptyUtil.isEmpty(cached)){ | |||||
HomeSlideBannerModel model = HomeSlideBannerModel.fromJson(cached); | |||||
if(null != model && !EmptyUtil.isEmpty(model.items)){ | |||||
return model.items; | |||||
} | |||||
class HomeSlideBannerRepository { | |||||
/// 获取缓存数据 | |||||
Future<List<HomeSlideBannerModelItems>> fetchCachedDate( | |||||
{@required int id}) async { | |||||
var cached = await NetUtil.getRequestCachedData('/api/v1/mod', params: { | |||||
'ids': [id] | |||||
}); | |||||
if (!EmptyUtil.isEmpty(cached)) { | |||||
HomeSlideBannerModel model = HomeSlideBannerModel.fromJson(cached); | |||||
if (null != model && !EmptyUtil.isEmpty(model.items)) { | |||||
return model.items; | |||||
} | } | ||||
return null; | |||||
} | } | ||||
return null; | |||||
} | |||||
/// 获取数据 | |||||
Future<List<HomeSlideBannerModelItems>> fetchData({@required int id}) async{ | |||||
var params = await NetUtil.post('/api/v1/mod', params: {'ids': [id]}); | |||||
if(NetUtil.isSuccess(params)){ | |||||
HomeSlideBannerModel model = HomeSlideBannerModel.fromJson(params[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | |||||
if(null != model && !EmptyUtil.isEmpty(model.items)){ | |||||
return model.items; | |||||
} | |||||
/// 获取数据 | |||||
Future<List<HomeSlideBannerModelItems>> fetchData({@required int id}) async { | |||||
var params = await NetUtil.post('/api/v1/mod', params: { | |||||
'ids': [id] | |||||
}); | |||||
if (NetUtil.isSuccess(params)) { | |||||
HomeSlideBannerModel model = HomeSlideBannerModel.fromJson( | |||||
params[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | |||||
if (null != model && !EmptyUtil.isEmpty(model.items)) { | |||||
return model.items; | |||||
} | } | ||||
return null; | |||||
} | } | ||||
return null; | |||||
} | |||||
} | } |