@@ -107,34 +107,34 @@ android { | |||||
} | } | ||||
// 应用信息配置 | |||||
// productFlavors { | |||||
// // 智夜生活 | |||||
// zhiying { | |||||
// applicationId "cn.zhios.zhiying" | |||||
// versionCode 22 | |||||
// dimension "app" | |||||
// versionName '1.2.2' | |||||
// // 签名信息 | |||||
// signingConfig signingConfigs.zhiying | |||||
// } | |||||
// } | |||||
// | |||||
// // 打包脚本 | |||||
// android.applicationVariants.all { variant -> | |||||
// if (variant.buildType.name != "debug") { | |||||
// variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") | |||||
// } | |||||
// | |||||
// variant.outputs.all { output -> | |||||
// def outputFile = output.outputFile | |||||
// if (outputFile != null && outputFile.name.endsWith('.apk')) { | |||||
// //这里修改apk文件名 | |||||
// def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" | |||||
// outputFileName = fileName | |||||
// } | |||||
// } | |||||
// } | |||||
//应用信息配置 | |||||
productFlavors { | |||||
// 智夜生活 | |||||
zhiying { | |||||
applicationId "cn.zhios.zhiying" | |||||
versionCode 23 | |||||
dimension "app" | |||||
versionName '1.2.3' | |||||
// 签名信息 | |||||
signingConfig signingConfigs.zhiying | |||||
} | |||||
} | |||||
// 打包脚本 | |||||
android.applicationVariants.all { variant -> | |||||
if (variant.buildType.name != "debug") { | |||||
variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") | |||||
} | |||||
variant.outputs.all { output -> | |||||
def outputFile = output.outputFile | |||||
if (outputFile != null && outputFile.name.endsWith('.apk')) { | |||||
//这里修改apk文件名 | |||||
def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" | |||||
outputFileName = fileName | |||||
} | |||||
} | |||||
} | |||||
configurations.all { | configurations.all { | ||||
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | resolutionStrategy.eachDependency { DependencyResolveDetails details -> | ||||
@@ -90,7 +90,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN | |||||
Map map = new HashMap(); | Map map = new HashMap(); | ||||
map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); | map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); | ||||
// map.put("domain", "http://192.168.0.113:5000"); | // map.put("domain", "http://192.168.0.113:5000"); | ||||
map.put("master_id", "123456"); | |||||
map.put("master_id", "963258"); | |||||
map.put("secret_key", "123456"); | map.put("secret_key", "123456"); | ||||
// map.put("token", "123465"); | // map.put("token", "123465"); | ||||
return map; | return map; | ||||
@@ -1,6 +1,7 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
<resources> | <resources> | ||||
<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |||||
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> | |||||
<!-- Show a splash screen on the activity. Automatically removed when | <!-- Show a splash screen on the activity. Automatically removed when | ||||
Flutter draws its first frame --> | Flutter draws its first frame --> | ||||
<item name="android:windowBackground">@drawable/launch_background</item> | <item name="android:windowBackground">@drawable/launch_background</item> | ||||
@@ -1,12 +1,15 @@ | |||||
import 'dart:async'; | |||||
import 'dart:convert' as convert; | import 'dart:convert' as convert; | ||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'dart:io'; | import 'dart:io'; | ||||
import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||
import 'package:connectivity/connectivity.dart'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/foundation.dart'; | import 'package:flutter/foundation.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||
import 'package:flutter/widgets.dart'; | |||||
import 'package:moblink/moblink.dart'; | import 'package:moblink/moblink.dart'; | ||||
import 'package:mobpush_plugin/mobpush_custom_message.dart'; | import 'package:mobpush_plugin/mobpush_custom_message.dart'; | ||||
import 'package:mobpush_plugin/mobpush_notify_message.dart'; | import 'package:mobpush_plugin/mobpush_notify_message.dart'; | ||||
@@ -16,6 +19,7 @@ import 'package:zhiying_base_widget/dialog/global_dialog/activity_dialog/activit | |||||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart'; | import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart'; | ||||
import 'package:zhiying_base_widget/dialog/global_dialog/notification_setting_dialog/notification_setting_dialog.dart'; | import 'package:zhiying_base_widget/dialog/global_dialog/notification_setting_dialog/notification_setting_dialog.dart'; | ||||
import 'package:zhiying_base_widget/dialog/global_dialog/policy_dialog/policy_dialog.dart'; | import 'package:zhiying_base_widget/dialog/global_dialog/policy_dialog/policy_dialog.dart'; | ||||
import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart'; | |||||
import 'package:zhiying_base_widget/utils/contants.dart'; | import 'package:zhiying_base_widget/utils/contants.dart'; | ||||
import 'package:zhiying_base_widget/utils/mob_push_util.dart'; | import 'package:zhiying_base_widget/utils/mob_push_util.dart'; | ||||
import 'package:zhiying_comm/models/base/base_tab_model.dart'; | import 'package:zhiying_comm/models/base/base_tab_model.dart'; | ||||
@@ -28,6 +32,7 @@ import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
import 'package:zhiying_comm/util/event_util/login_success_event.dart'; | import 'package:zhiying_comm/util/event_util/login_success_event.dart'; | ||||
import 'package:zhiying_comm/util/event_util/event_util.dart'; | import 'package:zhiying_comm/util/event_util/event_util.dart'; | ||||
import 'package:zhiying_comm/util/event_util/log_out.dart'; | import 'package:zhiying_comm/util/event_util/log_out.dart'; | ||||
import 'package:package_info/package_info.dart'; | |||||
class HomePage extends StatefulWidget { | class HomePage extends StatefulWidget { | ||||
HomePage({Key key}) : super(key: key); | HomePage({Key key}) : super(key: key); | ||||
@@ -36,63 +41,107 @@ class HomePage extends StatefulWidget { | |||||
_HomePageState createState() => _HomePageState(); | _HomePageState createState() => _HomePageState(); | ||||
} | } | ||||
class _HomePageState extends State<HomePage> with WidgetsBindingObserver { | |||||
class _HomePageState extends State<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin { | |||||
int _currentIndex = 0; | int _currentIndex = 0; | ||||
List<Map<String, dynamic>> _data = List(); | List<Map<String, dynamic>> _data = List(); | ||||
static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); | static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); | ||||
AnimationController animationController; | |||||
Animation<double> scaleAnimation; | |||||
Animation<double> opacityAnimation; | |||||
double opacity = 1.0; | |||||
bool initFinish = false; | |||||
double maxRatio = 5.0; | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
WidgetsBinding.instance.addObserver(this); | |||||
String data = BaseSettingModel.setting.tab['data']; | |||||
try { | |||||
List list = convert.jsonDecode(data); | |||||
_data = list.map((item) { | |||||
return Map<String, dynamic>.from(item); | |||||
}).toList(); | |||||
Logger.debug(_data); | |||||
} catch (error) { | |||||
Logger.error(error); | |||||
} | |||||
Constants.isShowIntellectDialog = false; | |||||
animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 500)); | |||||
CurvedAnimation curvedAnimation = CurvedAnimation(parent: animationController, curve: Curves.ease); | |||||
scaleAnimation = Tween<double>(begin: 1.0, end: maxRatio).animate(curvedAnimation); | |||||
opacityAnimation = Tween<double>(begin: 0.7, end: 0).animate(curvedAnimation); | |||||
animationController.addListener(() { | |||||
print(scaleAnimation.value); | |||||
if (scaleAnimation.value == maxRatio) { | |||||
// 动画结束后显示弹窗 | |||||
_showPolicy(); | |||||
setState(() {}); | |||||
} | |||||
}); | |||||
TaobaoAuth.initAuth(context); | |||||
///初始化一些数据 | |||||
initAsync(); | |||||
// 弹窗 | |||||
_showPolicy(); | |||||
///打开动画 | |||||
Timer(Duration(milliseconds: 0), () { | |||||
animationController.forward(); | |||||
}); | |||||
Moblink.uploadPrivacyPermissionStatus(1, (bool success) {}); | |||||
SharesdkPlugin.uploadPrivacyPermissionStatus(1, (bool success) {}); | |||||
// 是安卓系统,Android场景还原的实现 | |||||
/*if (defaultTargetPlatform == TargetPlatform.android) { | |||||
///打开动画 | |||||
Timer(Duration(milliseconds: 1000), () { | |||||
initFinish = true; | |||||
setState(() {}); | |||||
}); | |||||
}*/ | |||||
setState(() {}); | |||||
super.initState(); | |||||
} | |||||
//app后台杀死时候的还原 | |||||
Moblink.restoreScene(_restore); | |||||
// 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) | |||||
_eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); | |||||
MobPushUtil.addPushReceiver(); | |||||
EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { | |||||
UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; | |||||
var setting = await NativeUtil.getSetting(); | |||||
String masterId = setting['master_id']; | |||||
Logger.log("我的Alias: " + masterId + "_" + userInfo?.userId); | |||||
if (!EmptyUtil.isEmpty(userInfo.userId) && !EmptyUtil.isEmpty(masterId)) { | |||||
MobPushUtil.setAlias(masterId + "_" + userInfo.userId); | |||||
///初始化各种监听 | |||||
initAsync() async { | |||||
try { | |||||
WidgetsBinding.instance.addObserver(this); | |||||
String data = BaseSettingModel.setting.tab['data']; | |||||
try { | |||||
List list = convert.jsonDecode(data); | |||||
_data = list.map((item) { | |||||
return Map<String, dynamic>.from(item); | |||||
}).toList(); | |||||
Logger.debug(_data); | |||||
} catch (error) { | |||||
Logger.error(error); | |||||
} | } | ||||
}); | |||||
Constants.isShowIntellectDialog = false; | |||||
EventUtil.instance.on<LogOut>().listen((event) { | |||||
MobPushUtil.deleteAlias(); | |||||
}); | |||||
super.initState(); | |||||
TaobaoAuth.initAuth(context); | |||||
Moblink.uploadPrivacyPermissionStatus(1, (bool success) {}); | |||||
SharesdkPlugin.uploadPrivacyPermissionStatus(1, (bool success) {}); | |||||
// 是安卓系统,Android场景还原的实现 | |||||
/*if (defaultTargetPlatform == TargetPlatform.android) { | |||||
}*/ | |||||
//app后台杀死时候的还原 | |||||
Moblink.restoreScene(_restore); | |||||
// 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) | |||||
_eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); | |||||
MobPushUtil.addPushReceiver(); | |||||
EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { | |||||
UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; | |||||
var setting = await NativeUtil.getSetting(); | |||||
String masterId = setting['master_id']; | |||||
Logger.log("我的Alias: " + masterId + "_" + userInfo?.userId); | |||||
if (!EmptyUtil.isEmpty(userInfo.userId) && !EmptyUtil.isEmpty(masterId)) { | |||||
MobPushUtil.setAlias(masterId + "_" + userInfo.userId); | |||||
} | |||||
}); | |||||
EventUtil.instance.on<LogOut>().listen((event) { | |||||
MobPushUtil.deleteAlias(); | |||||
}); | |||||
} catch (e, s) { | |||||
print(e); | |||||
print(s); | |||||
} | |||||
} | } | ||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
WidgetsBinding.instance.removeObserver(this); | WidgetsBinding.instance.removeObserver(this); | ||||
animationController.dispose(); | |||||
super.dispose(); | super.dispose(); | ||||
} | } | ||||
@@ -106,6 +155,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver { | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
ScreenUtil.init(context, width: 750, height: 1334); | ScreenUtil.init(context, width: 750, height: 1334); | ||||
Logger.debug('home_page build'); | Logger.debug('home_page build'); | ||||
List<Map<String, dynamic>> tabs = _data; | List<Map<String, dynamic>> tabs = _data; | ||||
if (tabs == null || tabs.length == 0) { | if (tabs == null || tabs.length == 0) { | ||||
@@ -120,13 +170,45 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver { | |||||
_currentIndex = 0; | _currentIndex = 0; | ||||
} | } | ||||
return Scaffold( | |||||
body: IndexedStack( | |||||
index: _currentIndex, | |||||
children: contentWidgets, | |||||
), | |||||
//底部导航栏 | |||||
bottomNavigationBar: createBottomNavigationBar(tabs), | |||||
// return Scaffold( | |||||
// body: IndexedStack( | |||||
// index: _currentIndex, | |||||
// children: contentWidgets, | |||||
// ), | |||||
// //底部导航栏 | |||||
// bottomNavigationBar: createBottomNavigationBar(tabs), | |||||
// ); | |||||
return Stack( | |||||
alignment: Alignment.topCenter, | |||||
children: <Widget>[ | |||||
Scaffold( | |||||
body: IndexedStack( | |||||
index: _currentIndex, | |||||
children: contentWidgets, | |||||
), | |||||
//底部导航栏 | |||||
bottomNavigationBar: createBottomNavigationBar(tabs), | |||||
), | |||||
(scaleAnimation.value != maxRatio || !initFinish) | |||||
? ScaleTransition( | |||||
scale: scaleAnimation, | |||||
child: FadeTransition( | |||||
// opacity: 1.0 - (scaleAnimation.value-1 / maxRatio), | |||||
opacity: opacityAnimation, | |||||
child: Container( | |||||
height: initFinish?0:null, | |||||
width: double.infinity, | |||||
child: Image.asset( | |||||
'assets/images/launch_image/launch_image.png', | |||||
package: 'zhiying_base_widget', | |||||
fit: BoxFit.cover, | |||||
), | |||||
), | |||||
), | |||||
) | |||||
: Container(width: 0 | |||||
,height: 0,) | |||||
], | |||||
); | ); | ||||
} | } | ||||
@@ -177,14 +259,13 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver { | |||||
BaseTabModel model = BaseTabModel.fromJson(tabs[index]); | BaseTabModel model = BaseTabModel.fromJson(tabs[index]); | ||||
if (await _checkLimit(model)) { | if (await _checkLimit(model)) { | ||||
///避免同一个页面多次点击多次重绘 | ///避免同一个页面多次点击多次重绘 | ||||
if(_currentIndex==index){ | |||||
if (_currentIndex == index) { | |||||
return; | return; | ||||
}else{ | |||||
} else { | |||||
setState(() { | setState(() { | ||||
_currentIndex = index; | _currentIndex = index; | ||||
}); | }); | ||||
} | } | ||||
} | } | ||||
}), | }), | ||||
//底部导航栏 | //底部导航栏 | ||||
@@ -235,7 +316,6 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver { | |||||
await AppUpdateUtil.updateApp(context); | await AppUpdateUtil.updateApp(context); | ||||
IntellectCreate.checkAndCreateFirst(context); | IntellectCreate.checkAndCreateFirst(context); | ||||
} | } | ||||
// 场景还原,记录邀请码 | // 场景还原,记录邀请码 | ||||
@@ -288,8 +368,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver { | |||||
void showAlert(String text, BuildContext context) { | void showAlert(String text, BuildContext context) { | ||||
showDialog( | showDialog( | ||||
context: context, | context: context, | ||||
builder: (BuildContext context) => | |||||
CupertinoAlertDialog(title: new Text("提示"), content: new Text(text), actions: <Widget>[ | |||||
builder: (BuildContext context) => CupertinoAlertDialog(title: new Text("提示"), content: new Text(text), actions: <Widget>[ | |||||
new FlatButton( | new FlatButton( | ||||
child: new Text("OK"), | child: new Text("OK"), | ||||
onPressed: () { | onPressed: () { | ||||
@@ -20,7 +20,6 @@ import 'package:zhiying_base_widget/utils/contants.dart'; | |||||
import 'package:zhiying_comm/util/shared_prefe_util.dart'; | import 'package:zhiying_comm/util/shared_prefe_util.dart'; | ||||
import 'package:package_info/package_info.dart'; | import 'package:package_info/package_info.dart'; | ||||
// 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题 | // 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题 | ||||
class LaunchPage extends StatefulWidget { | class LaunchPage extends StatefulWidget { | ||||
final WidgetBuilder builder; | final WidgetBuilder builder; | ||||
@@ -31,28 +30,29 @@ class LaunchPage extends StatefulWidget { | |||||
_LaunchPageState createState() => _LaunchPageState(); | _LaunchPageState createState() => _LaunchPageState(); | ||||
} | } | ||||
class _LaunchPageState extends State<LaunchPage> { | |||||
class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | |||||
final GlobalKey navigatorKey = new GlobalKey(); | final GlobalKey navigatorKey = new GlobalKey(); | ||||
///闪屏动画 | |||||
AnimationController animationController; | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
animationController = AnimationController(vsync: this); | |||||
Connectivity().checkConnectivity().then((connectivityResult) async { | Connectivity().checkConnectivity().then((connectivityResult) async { | ||||
if (connectivityResult == ConnectivityResult.mobile || | |||||
connectivityResult == ConnectivityResult.wifi) { | |||||
if (connectivityResult == ConnectivityResult.mobile || connectivityResult == ConnectivityResult.wifi) { | |||||
// I am connected to a wifi network. | // I am connected to a wifi network. | ||||
Logger.debug('ConnectivityResult.wifi'); | Logger.debug('ConnectivityResult.wifi'); | ||||
print('ConnectivityResult.wifi'); | print('ConnectivityResult.wifi'); | ||||
Application.init().then((_) async { | Application.init().then((_) async { | ||||
PackageInfo packageInfo = await PackageInfo.fromPlatform(); | PackageInfo packageInfo = await PackageInfo.fromPlatform(); | ||||
String versionNumber = | |||||
await SharedPreferencesUtil.getStringValue(Constants.versionNumber); | |||||
String currentVersionCode = | |||||
packageInfo.buildNumber?.toString() ?? ''; | |||||
String versionNumber = await SharedPreferencesUtil.getStringValue(Constants.versionNumber); | |||||
String currentVersionCode = packageInfo.buildNumber?.toString() ?? ''; | |||||
if (versionNumber == null || versionNumber == '' || versionNumber != currentVersionCode) { | if (versionNumber == null || versionNumber == '' || versionNumber != currentVersionCode) { | ||||
await _showGuideImage(); | await _showGuideImage(); | ||||
SharedPreferencesUtil.setStringValue(Constants.versionNumber, currentVersionCode); | SharedPreferencesUtil.setStringValue(Constants.versionNumber, currentVersionCode); | ||||
} | } | ||||
if (widget.builder != null) { | if (widget.builder != null) { | ||||
Navigator.of(context).pushReplacement(CupertinoPageRoute(builder: widget.builder)); | Navigator.of(context).pushReplacement(CupertinoPageRoute(builder: widget.builder)); | ||||
} else { | } else { | ||||
@@ -61,15 +61,23 @@ class _LaunchPageState extends State<LaunchPage> { | |||||
Navigator.of(context).pushReplacementNamed('/homePage'); | Navigator.of(context).pushReplacementNamed('/homePage'); | ||||
} | } | ||||
}).catchError((err) async { | }).catchError((err) async { | ||||
if(err.toString().contains("BaseSettingModel")){ | |||||
await showDialog(context: context,child: TipDialog(content: "基本配置加载失败!请检查网络是否可用后再启动应用!",)); | |||||
SystemNavigator.pop(); | |||||
} | |||||
if (err.toString().contains("BaseSettingModel")) { | |||||
await showDialog( | |||||
context: context, | |||||
child: TipDialog( | |||||
content: "基本配置加载失败!请检查网络是否可用后再启动应用!", | |||||
)); | |||||
SystemNavigator.pop(); | |||||
} | |||||
Logger.error(err); | Logger.error(err); | ||||
}); | }); | ||||
} else { | } else { | ||||
///在无网络情况下提示用户打开网络 | ///在无网络情况下提示用户打开网络 | ||||
await showDialog(context: context,child: TipDialog(content: "无法连接网络!请打开移动网络/连接WIFI后再尝试",)); | |||||
await showDialog( | |||||
context: context, | |||||
child: TipDialog( | |||||
content: "无法连接网络!请打开移动网络/连接WIFI后再尝试", | |||||
)); | |||||
Logger.error('未知网络,APP初始化失败'); | Logger.error('未知网络,APP初始化失败'); | ||||
print('unknow'); | print('unknow'); | ||||
SystemNavigator.pop(); | SystemNavigator.pop(); | ||||
@@ -79,33 +87,62 @@ class _LaunchPageState extends State<LaunchPage> { | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
Future _showGuideImage() async { | |||||
// 引导页 | |||||
AppConfigGuideModel guide = AppConfigModel.getConfig()?.guideImage; | |||||
if (guide != null && guide.images.length > 0) { | |||||
Dio dio = Dio(); | |||||
// validateInit()async{ | |||||
// PackageInfo packageInfo = await PackageInfo.fromPlatform(); | |||||
// String versionNumber = | |||||
// await SharedPreferencesUtil.getStringValue(Constants.versionNumber); | |||||
// String currentVersionCode = | |||||
// packageInfo.buildNumber?.toString() ?? ''; | |||||
// if (versionNumber == null || versionNumber == '' || versionNumber != currentVersionCode) { | |||||
// await _showGuideImage(); | |||||
// SharedPreferencesUtil.setStringValue(Constants.versionNumber, currentVersionCode); | |||||
// }else{ | |||||
// Navigator.of(context).pushReplacement( | |||||
// CupertinoPageRoute(builder: (context) => HomePage())); | |||||
// Navigator.of(context).pushReplacementNamed('/homePage'); | |||||
// } | |||||
// } | |||||
List<Uint8List> guideImages = List(); | |||||
for (int i = 0; i < guide.images.length; i++) { | |||||
Response response = await dio.get(guide.images[i], options: Options(responseType: ResponseType.bytes)); | |||||
if (response.statusCode == 200) { | |||||
Uint8List data = Uint8List.fromList(response.data); | |||||
guideImages.add(data); | |||||
Future _showGuideImage() async { | |||||
try { | |||||
// 引导页 | |||||
AppConfigGuideModel guide = AppConfigModel | |||||
.getConfig() | |||||
?.guideImage; | |||||
if (guide != null && guide.images.length > 0) { | |||||
Dio dio = Dio(); | |||||
print("加载图片"); | |||||
List<Uint8List> guideImages = List(); | |||||
for (int i = 0; i < guide.images.length; i++) { | |||||
Response response = await dio.get(guide.images[i], options: Options(responseType: ResponseType.bytes)); | |||||
if (response.statusCode == 200) { | |||||
Uint8List data = Uint8List.fromList(response.data); | |||||
guideImages.add(data); | |||||
} | |||||
} | } | ||||
} | |||||
await Navigator.of(context).push( | |||||
CupertinoPageRoute(builder: (context) => GuidePage(guide, guideImages))); | |||||
await Navigator.of(context).push(CupertinoPageRoute(builder: (context) => GuidePage(guide, guideImages))); | |||||
} | |||||
}catch(e){ | |||||
throw "引导图加载失败"; | |||||
} | } | ||||
} | } | ||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Image.asset( | |||||
'assets/images/launch_image/launch_image.png', | |||||
package: 'zhiying_base_widget', | |||||
fit: BoxFit.fill, | |||||
return Stack( | |||||
alignment: Alignment.topCenter, | |||||
children: <Widget>[ | |||||
Container( | |||||
color: Colors.white, | |||||
width: double.infinity, | |||||
child: Image.asset( | |||||
'assets/images/launch_image/launch_image.png', | |||||
package: 'zhiying_base_widget', | |||||
fit: BoxFit.cover, | |||||
), | |||||
), | |||||
], | |||||
); | ); | ||||
} | } | ||||
} | } |
@@ -1,3 +1,4 @@ | |||||
import 'package:event_bus/event_bus.dart'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||
@@ -7,6 +8,8 @@ import 'package:zhiying_base_widget/pages/withdraw_page/models/withdraw_model.da | |||||
import 'package:zhiying_base_widget/pages/withdraw_page/withdraw_page_sk.dart'; | import 'package:zhiying_base_widget/pages/withdraw_page/withdraw_page_sk.dart'; | ||||
import 'package:zhiying_base_widget/utils/contants.dart'; | import 'package:zhiying_base_widget/utils/contants.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | import 'package:zhiying_comm/util/base_bloc.dart'; | ||||
import 'package:zhiying_comm/util/event_util/event_util.dart'; | |||||
import 'package:zhiying_comm/util/event_util/login_success_event.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
/*提现页面*/ | /*提现页面*/ | ||||
@@ -62,9 +65,14 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { | |||||
_bloc.loadWithdrawData(); | _bloc.loadWithdrawData(); | ||||
_bloc.getAlipayStatus(); | _bloc.getAlipayStatus(); | ||||
} | } | ||||
EventUtil.instance.on<LoginSuccessEvent>().listen((event) { | |||||
reload(); | |||||
}); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
reload() { | reload() { | ||||
_bloc.loadData(widget.data['skip_identifier']); | _bloc.loadData(widget.data['skip_identifier']); | ||||
_bloc.loadWithdrawData(); | _bloc.loadWithdrawData(); | ||||
@@ -106,7 +114,10 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { | |||||
// 导航栏 | // 导航栏 | ||||
Widget _createNav(WithdrawModel model) { | Widget _createNav(WithdrawModel model) { | ||||
return CupertinoNavigationBar( | |||||
return AppBar( | |||||
elevation: 1, | |||||
brightness: Brightness.light, | |||||
backgroundColor: HexColor.fromHex(model?.appBarBgColor??""), | |||||
leading: Navigator.canPop(context) | leading: Navigator.canPop(context) | ||||
? GestureDetector( | ? GestureDetector( | ||||
child: Container( | child: Container( | ||||
@@ -123,23 +134,29 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { | |||||
}, | }, | ||||
) | ) | ||||
: Container(), | : Container(), | ||||
middle: Text( | |||||
centerTitle: true, | |||||
title: Text( | |||||
model.appBarName, | model.appBarName, | ||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 15, | fontSize: 15, | ||||
color: HexColor.fromHex(model.appBarNameColor), | color: HexColor.fromHex(model.appBarNameColor), | ||||
), | ), | ||||
), | ), | ||||
trailing: GestureDetector( | |||||
child: Text( | |||||
model.appBarRightText, | |||||
style: TextStyle(fontSize: 13, color: Color(0xff333333)), | |||||
actions:<Widget>[ GestureDetector( | |||||
child: Center( | |||||
child: Padding( | |||||
padding: EdgeInsets.only(right: 16), | |||||
child: Text( | |||||
model.appBarRightText, | |||||
style: TextStyle(fontSize: 13, color: HexColor.fromHex(model?.appBarNameColor??"")), | |||||
), | |||||
), | |||||
), | ), | ||||
onTap: () { | onTap: () { | ||||
RouterUtil.route( | RouterUtil.route( | ||||
model.detailSkipModel, model.detailSkipModel.toJson(), context); | model.detailSkipModel, model.detailSkipModel.toJson(), context); | ||||
}, | }, | ||||
), | |||||
)], | |||||
); | ); | ||||
} | } | ||||
@@ -155,7 +155,7 @@ class BaseWidgetRegister { | |||||
// 延迟一秒 | // 延迟一秒 | ||||
Application.addMethod(() async { | Application.addMethod(() async { | ||||
return Future.delayed(Duration(seconds: 1)); | |||||
// return Future.delayed(Duration(seconds: 1)); | |||||
}); | }); | ||||
} | } | ||||
@@ -42,6 +42,8 @@ dependencies: | |||||
intl: 0.16.1 | intl: 0.16.1 | ||||
loading_indicator: ^1.2.0 | loading_indicator: ^1.2.0 | ||||
zhiying_comm: | |||||
path: ../zhiying_comm | |||||
mobpush_plugin: | mobpush_plugin: | ||||
dev_dependencies: | dev_dependencies: | ||||