@@ -680,7 +680,7 @@ | |||
"languageVersion": "2.1" | |||
} | |||
], | |||
"generated": "2020-09-11T11:58:25.076408Z", | |||
"generated": "2020-09-14T01:30:48.161905Z", | |||
"generator": "pub", | |||
"generatorVersion": "2.7.2" | |||
} |
@@ -80,7 +80,6 @@ | |||
3CF5E07C1CDF5F802B057127 /* Pods-Runner.release.xcconfig */, | |||
E03B6CB558D0A26B049E0718 /* Pods-Runner.profile.xcconfig */, | |||
); | |||
name = Pods; | |||
path = Pods; | |||
sourceTree = "<group>"; | |||
}; | |||
@@ -392,9 +391,9 @@ | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/Flutter", | |||
); | |||
PRODUCT_BUNDLE_IDENTIFIER = cn.shengfen.Fm; | |||
PRODUCT_BUNDLE_IDENTIFIER = cn.zhios.zhiying; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
PROVISIONING_PROFILE_SPECIFIER = shengFenFMTest; | |||
PROVISIONING_PROFILE_SPECIFIER = cn.zhios.zhiying_dev; | |||
VERSIONING_SYSTEM = "apple-generic"; | |||
}; | |||
name = Profile; | |||
@@ -525,9 +524,9 @@ | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/Flutter", | |||
); | |||
PRODUCT_BUNDLE_IDENTIFIER = cn.shengfen.Fm; | |||
PRODUCT_BUNDLE_IDENTIFIER = cn.zhios.zhiying; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
PROVISIONING_PROFILE_SPECIFIER = shengFenFMTest; | |||
PROVISIONING_PROFILE_SPECIFIER = cn.zhios.zhiying_dev; | |||
VERSIONING_SYSTEM = "apple-generic"; | |||
}; | |||
name = Debug; | |||
@@ -551,9 +550,9 @@ | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/Flutter", | |||
); | |||
PRODUCT_BUNDLE_IDENTIFIER = cn.shengfen.Fm; | |||
PRODUCT_BUNDLE_IDENTIFIER = cn.zhios.zhiying; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
PROVISIONING_PROFILE_SPECIFIER = shengFenFMTest; | |||
PROVISIONING_PROFILE_SPECIFIER = cn.zhios.zhiying_dev; | |||
VERSIONING_SYSTEM = "apple-generic"; | |||
}; | |||
name = Release; | |||
@@ -27,8 +27,6 @@ | |||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | |||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | |||
shouldUseLaunchSchemeArgsEnv = "YES"> | |||
<Testables> | |||
</Testables> | |||
<MacroExpansion> | |||
<BuildableReference | |||
BuildableIdentifier = "primary" | |||
@@ -38,11 +36,11 @@ | |||
ReferencedContainer = "container:Runner.xcodeproj"> | |||
</BuildableReference> | |||
</MacroExpansion> | |||
<AdditionalOptions> | |||
</AdditionalOptions> | |||
<Testables> | |||
</Testables> | |||
</TestAction> | |||
<LaunchAction | |||
buildConfiguration = "Debug" | |||
buildConfiguration = "Release" | |||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | |||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | |||
launchStyle = "0" | |||
@@ -61,8 +59,6 @@ | |||
ReferencedContainer = "container:Runner.xcodeproj"> | |||
</BuildableReference> | |||
</BuildableProductRunnable> | |||
<AdditionalOptions> | |||
</AdditionalOptions> | |||
</LaunchAction> | |||
<ProfileAction | |||
buildConfiguration = "Profile" | |||
@@ -1,9 +1,16 @@ | |||
import 'package:flutter/foundation.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:zhiying_base_widget/pages/home_page/home_page.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 { | |||
@override | |||
@@ -11,14 +18,28 @@ class MyApp extends StatefulWidget { | |||
} | |||
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 | |||
void initState() { | |||
super.initState(); | |||
print('初始化~~~~'); | |||
BaseWidgetRegister.init(); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
ErrorWidget.builder = (FlutterErrorDetails errorDetails) { | |||
return getErrorWidget(context, errorDetails); | |||
}; | |||
return MaterialApp( | |||
home: HomePage(), | |||
); | |||
@@ -97,7 +97,7 @@ class _MainPageContainerState extends State<_MainPageContainer> { | |||
removeTop: true, | |||
context: context, | |||
child: SmartRefresher( | |||
enablePullDown: false, | |||
enablePullDown: true, | |||
enablePullUp: false, | |||
header: WaterDropHeader(), | |||
controller: _refreshController, | |||
@@ -132,12 +132,24 @@ class _MainPageContainerState extends State<_MainPageContainer> { | |||
WidgetModel item = | |||
WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | |||
print('item.modName ${item.modName}'); | |||
list.addAll(WidgetFactory.create( | |||
item.modName, | |||
isSliver: true, | |||
model: datas[i], | |||
)); | |||
} | |||
print('生成列表widget个数 ${list.length}'); | |||
if (list.length <= 0) { | |||
list.add(SliverToBoxAdapter( | |||
child: Container( | |||
height: 200, | |||
child: Center( | |||
child: Text('暂时无数据哦~'), | |||
), | |||
), | |||
)); | |||
} | |||
return list; | |||
} | |||
} |
@@ -1,34 +1,37 @@ | |||
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/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; | |||
} | |||
} |