@@ -1,12 +1,12 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
<resources> | <resources> | ||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | |||||
<style name="LaunchTheme" parent="Theme.AppCompat.Light.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> | ||||
</style> | </style> | ||||
<!-- Base application theme. --> | <!-- Base application theme. --> | ||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> | |||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> | |||||
<item name="android:windowBackground">@drawable/normal_background</item> | <item name="android:windowBackground">@drawable/normal_background</item> | ||||
</style> | </style> | ||||
</resources> | </resources> |
@@ -8,6 +8,7 @@ import 'package:zhiying_base_widget/register.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'package:flutter_localizations/flutter_localizations.dart'; | import 'package:flutter_localizations/flutter_localizations.dart'; | ||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; | import 'package:pull_to_refresh/pull_to_refresh.dart'; | ||||
import 'package:zhiying_comm/util/update/app_update_util.dart'; | |||||
import 'util/localizations_delegate.dart'; | import 'util/localizations_delegate.dart'; | ||||
@@ -44,6 +45,8 @@ class _MyAppState extends State<MyApp> { | |||||
FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | ||||
print("白川" + '${result.errorCode} ${result.errorMessage}'); | print("白川" + '${result.errorCode} ${result.errorMessage}'); | ||||
}); | }); | ||||
// app更新插件 | |||||
AppUpdateUtil.initXUpdate(); | |||||
} | } | ||||
@override | @override | ||||
@@ -1,5 +1,6 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart'; | import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
// loading弹窗 | // loading弹窗 | ||||
class Loading { | class Loading { | ||||
@@ -14,7 +15,7 @@ class Loading { | |||||
return GestureDetector( | return GestureDetector( | ||||
onTap: dismiss, | onTap: dismiss, | ||||
child: Container( | child: Container( | ||||
color: Colors.black.withOpacity(0.5), | |||||
color: Colors.black.withOpacity(0.3), | |||||
child: LoadingDialog( | child: LoadingDialog( | ||||
message: msg, | message: msg, | ||||
), | ), | ||||
@@ -22,12 +23,20 @@ class Loading { | |||||
); | ); | ||||
}); | }); | ||||
//插入到 Overlay中显示 OverlayEntry | |||||
Overlay.of(context).insert(_overlayEntry); | |||||
try { | |||||
//插入到 Overlay中显示 OverlayEntry | |||||
Overlay.of(context).insert(_overlayEntry); | |||||
}catch(e, s){ | |||||
Logger.error(e, s); | |||||
} | |||||
} | } | ||||
static dismiss() { | static dismiss() { | ||||
_overlayEntry?.remove(); | |||||
_overlayEntry = null; | |||||
try { | |||||
_overlayEntry?.remove(); | |||||
_overlayEntry = null; | |||||
}catch(e, s){ | |||||
Logger.error(e, s); | |||||
} | |||||
} | } | ||||
} | } |
@@ -21,17 +21,17 @@ class LoadingDialog extends StatelessWidget { | |||||
child: Container( | child: Container( | ||||
padding: EdgeInsets.all(10), | padding: EdgeInsets.all(10), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
color: Colors.white, borderRadius: BorderRadius.circular(8)), | |||||
color: Colors.transparent, borderRadius: BorderRadius.circular(8)), | |||||
child: Column( | child: Column( | ||||
crossAxisAlignment: CrossAxisAlignment.center, | crossAxisAlignment: CrossAxisAlignment.center, | ||||
mainAxisAlignment: MainAxisAlignment.center, | mainAxisAlignment: MainAxisAlignment.center, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Container( | Container( | ||||
width: 80, | |||||
height: 80, | |||||
width: 40, | |||||
height: 40, | |||||
child: LoadingIndicator( | child: LoadingIndicator( | ||||
indicatorType: Indicator.ballSpinFadeLoader, | indicatorType: Indicator.ballSpinFadeLoader, | ||||
color: Colors.redAccent, | |||||
color: Colors.white, | |||||
), | ), | ||||
), | ), | ||||
message == null || message == '' | message == null || message == '' | ||||
@@ -3,6 +3,7 @@ import 'package:zhiying_base_widget/pages/about_us_page/about_us_page_sk.dart'; | |||||
import 'package:zhiying_base_widget/pages/about_us_page/bloc/about_us_bloc.dart'; | import 'package:zhiying_base_widget/pages/about_us_page/bloc/about_us_bloc.dart'; | ||||
import 'package:zhiying_base_widget/pages/about_us_page/bloc/about_us_repository.dart'; | import 'package:zhiying_base_widget/pages/about_us_page/bloc/about_us_repository.dart'; | ||||
import 'package:zhiying_base_widget/pages/about_us_page/model/about_us_model.dart'; | import 'package:zhiying_base_widget/pages/about_us_page/model/about_us_model.dart'; | ||||
import 'package:zhiying_comm/util/update/app_update_util.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'package:flutter_bloc/flutter_bloc.dart'; | import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
import 'bloc/about_us_bloc.dart'; | import 'bloc/about_us_bloc.dart'; | ||||
@@ -34,8 +35,9 @@ class _AboutUsPageContainer extends StatefulWidget { | |||||
class __AboutUsPageContainerState extends State<_AboutUsPageContainer> { | class __AboutUsPageContainerState extends State<_AboutUsPageContainer> { | ||||
/// 检查更新 | /// 检查更新 | ||||
void _onClickCheckUpdate() { | |||||
void _onClickCheckUpdate() async{ | |||||
Logger.log('点击了更新'); | Logger.log('点击了更新'); | ||||
// AppUpdateUtil.updateApp(context); | |||||
} | } | ||||
/// 给个评价 | /// 给个评价 | ||||
@@ -2,6 +2,9 @@ import 'dart:convert'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
class GoodsDetailsPageRepository { | class GoodsDetailsPageRepository { | ||||
String _parentGoodsCoverImg; | |||||
/// 获取上个页面传进来的数据 | /// 获取上个页面传进来的数据 | ||||
Future<List<Map<String, dynamic>>> fetchParentPageData(final Map<String, dynamic> model) async { | Future<List<Map<String, dynamic>>> fetchParentPageData(final Map<String, dynamic> model) async { | ||||
try { | try { | ||||
@@ -10,19 +13,7 @@ class GoodsDetailsPageRepository { | |||||
String goodId = model['good_id']?.toString(); | String goodId = model['good_id']?.toString(); | ||||
if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId)) { | if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId)) { | ||||
Map<String, dynamic> detailData = model['detail_data']; | Map<String, dynamic> detailData = model['detail_data']; | ||||
return _baseDataProcess(goodId, provider, detailData); | |||||
// Logger.log('商品类型 = $provider, 商品ID = $goodId'); | |||||
// List<Map<String, dynamic>> _pageData = []; | |||||
// List<dynamic> modLists = detailData['mod_list']; | |||||
// for (int i = 0; i < modLists.length; i++) { | |||||
// Map<String, dynamic> item = modLists[i]; | |||||
// Map<String, dynamic> data = item['data']; | |||||
// Map<String, dynamic> baseData = {'provider': provider, 'good_id': goodId}; | |||||
// data.addAll(baseData); | |||||
// item['data'] = data; | |||||
// _pageData.add(item); | |||||
// } | |||||
// return _pageData; | |||||
return _baseDataProcess(true, goodId, provider, detailData); | |||||
} | } | ||||
} | } | ||||
} catch (e, s) { | } catch (e, s) { | ||||
@@ -40,30 +31,7 @@ class GoodsDetailsPageRepository { | |||||
Logger.log('商品类型 = $provider, 商品ID = $goodId'); | Logger.log('商品类型 = $provider, 商品ID = $goodId'); | ||||
var result = await NetUtil.post('/api/v1/detail/$provider/$goodId', method: NetMethod.GET); | var result = await NetUtil.post('/api/v1/detail/$provider/$goodId', method: NetMethod.GET); | ||||
if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { | if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { | ||||
return _baseDataProcess(goodId, provider, result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | |||||
// List<Map<String, dynamic>> _pageData = []; | |||||
/// 合并数据 | |||||
// List<dynamic> modLists = result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list']; | |||||
// for (int i = 0; i < modLists.length; i++) { | |||||
// Map<String, dynamic> item = modLists[i]; | |||||
// Map<String, dynamic> data = item['data']; | |||||
// Map<String, dynamic> style = jsonDecode(item['style']); | |||||
// | |||||
// Map<String, dynamic> baseData = {'provider': provider, 'good_id': goodId}; | |||||
// style.addAll(baseData); | |||||
// | |||||
// if (!EmptyUtil.isEmpty(data)) { | |||||
// style.addAll(data); | |||||
// item['data'] = jsonEncode(style); | |||||
// _pageData.add(item); | |||||
// } else { | |||||
// item['data'] = jsonEncode(style); | |||||
// _pageData.add(item); | |||||
// } | |||||
// } | |||||
// | |||||
// return _pageData; | |||||
return _baseDataProcess(false, goodId, provider, result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | |||||
} | } | ||||
} | } | ||||
} catch (e, s) { | } catch (e, s) { | ||||
@@ -73,7 +41,7 @@ class GoodsDetailsPageRepository { | |||||
} | } | ||||
/// 数据处理 | /// 数据处理 | ||||
List<Map<String, dynamic>> _baseDataProcess(String goodId, String provider, final Map<String, dynamic> model) { | |||||
List<Map<String, dynamic>> _baseDataProcess(bool parentInput,String goodId, String provider, final Map<String, dynamic> model) { | |||||
if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId) && !EmptyUtil.isEmpty(model)) { | if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId) && !EmptyUtil.isEmpty(model)) { | ||||
try { | try { | ||||
List<Map<String, dynamic>> _pageData = []; | List<Map<String, dynamic>> _pageData = []; | ||||
@@ -81,9 +49,34 @@ class GoodsDetailsPageRepository { | |||||
List<dynamic> modLists = model['mod_list']; | List<dynamic> modLists = model['mod_list']; | ||||
for (int i = 0; i < modLists.length; i++) { | for (int i = 0; i < modLists.length; i++) { | ||||
Map<String, dynamic> item = modLists[i]; | Map<String, dynamic> item = modLists[i]; | ||||
// ⚠️这里之所以要判断是否是String类型,是因为修改的是父亲页面传进来的model -> data 类型了。把dynamic变成了String | |||||
Map<String, dynamic> data = item['data'] is String ? jsonDecode(item['data']) : item['data']; | |||||
Map<String, dynamic> style = jsonDecode(item['style']); | |||||
// ⚠️ 这里之所以要判断是否是String类型,是因为修改的是父亲页面传进来的model -> data 类型了。把dynamic变成了String | |||||
Map<String, dynamic> data = !EmptyUtil.isEmpty(item['data']) ? item['data'] is String ? jsonDecode(item['data']) : item['data'] : new Map<String, dynamic>(); | |||||
// ⚠️ 为了商品详情的轮播图能够快速加载,故把上一个页面传进来的第一张图片插入到轮播图集合的第一个图片中 | |||||
if(item['mod_name'] == 'product_detail_carousel') { | |||||
if (parentInput) { | |||||
try { | |||||
var imageList = data['image_list']; | |||||
if (!EmptyUtil.isEmpty(imageList)) { | |||||
_parentGoodsCoverImg = imageList[0]; | |||||
} | |||||
} catch (e, s) { | |||||
Logger.error(e, s); | |||||
} | |||||
} else { | |||||
try { | |||||
if (!EmptyUtil.isEmpty(_parentGoodsCoverImg) && !EmptyUtil.isEmpty(data) && !EmptyUtil.isEmpty(data['image_list'])) { | |||||
if(data['image_list'][0] != _parentGoodsCoverImg) { | |||||
data['image_list'].insert(0, _parentGoodsCoverImg); | |||||
} | |||||
} | |||||
}catch(e, s){ | |||||
Logger.error(e, s); | |||||
} | |||||
} | |||||
} | |||||
Map<String, dynamic> style =!EmptyUtil.isEmpty(item['style']) ? jsonDecode(item['style']) : new Map<String, dynamic>(); | |||||
style.addAll(baseData); | style.addAll(baseData); | ||||
if (!EmptyUtil.isEmpty(data)) { | if (!EmptyUtil.isEmpty(data)) { | ||||
@@ -103,61 +96,4 @@ class GoodsDetailsPageRepository { | |||||
return null; | return null; | ||||
} | } | ||||
///【弃用】获取mod数据 把子mod数据塞在data中 | |||||
// Future<List<Map<String, dynamic>>> fetchModData(final Map<String, dynamic> model) async{ | |||||
// String provider = model['provider']; | |||||
// String goodId = model['good_id']; | |||||
// try { | |||||
// if (!EmptyUtil.isEmpty(provider) && !EmptyUtil.isEmpty(goodId)) { | |||||
// Logger.log('商品类型 = $provider, 商品ID = $goodId'); | |||||
// var result = await NetUtil.post('/api/v1/detail/$provider/$goodId', method: NetMethod.GET); | |||||
// if(NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { | |||||
// for (int i = 0; i < _pageData.length; i++) { | |||||
// //result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list'][i]; | |||||
// Map<String, dynamic> resultData = result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list'][i]; | |||||
// Map<String, dynamic> data = jsonDecode(_pageData[i]['data']); | |||||
// if(!EmptyUtil.isEmpty(data)){ | |||||
// data.addAll(resultData); | |||||
// _pageData[i]['data'] = jsonEncode(data); | |||||
// }else{ | |||||
// _pageData[i]['data'] = (null != resultData && resultData.length > 0) ? jsonEncode(resultData) : ''; | |||||
// } | |||||
// } | |||||
// return _pageData; | |||||
// } | |||||
// } | |||||
// }catch(e){ | |||||
// Logger.log(e); | |||||
// } | |||||
// return null; | |||||
// } | |||||
// | |||||
// ///【弃用】初始化 | |||||
// Future<List<Map<String, dynamic>>> fetchInitData(Map<String, dynamic> model) async { | |||||
// int id = 13; | |||||
// var result = await NetUtil.post('/api/v1/mod', method: NetMethod.POST, params: {'ids': [id]}); | |||||
// try { | |||||
// if(NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { | |||||
// return _loadData(id, result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]); | |||||
// } | |||||
// } catch (e) { | |||||
// Logger.log(e); | |||||
// } | |||||
// return null; | |||||
// } | |||||
// | |||||
// ///【弃用】处理数据 | |||||
// List<Map<String, dynamic>> _loadData(int id, dynamic data) { | |||||
// String key = id.toString(); | |||||
// Map<String, dynamic> json = Map<String, dynamic>.from(data); | |||||
// if (json.containsKey(key)) { | |||||
// List<dynamic> list = json[key]; | |||||
// _pageData = list.map((item) { | |||||
// return Map<String, dynamic>.from(item); | |||||
// }).toList(); | |||||
// return _pageData; | |||||
// } | |||||
// return null; | |||||
// } | |||||
} | } |
@@ -124,6 +124,10 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | |||||
builder: (context, state) { | builder: (context, state) { | ||||
print('GoodsDetailsPage currente state = $state'); | print('GoodsDetailsPage currente state = $state'); | ||||
if (state is GoodsDetailsPageLoadedState) { | if (state is GoodsDetailsPageLoadedState) { | ||||
int length = state?.model?.length ?? 0; | |||||
if(length == 0){ | |||||
return GoodsDetailsPageSkeleton(); | |||||
} | |||||
return _getMainWidget(state?.model); | return _getMainWidget(state?.model); | ||||
} | } | ||||
return GoodsDetailsPageSkeleton(); | return GoodsDetailsPageSkeleton(); | ||||
@@ -143,7 +147,7 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | |||||
controller: _controller, | controller: _controller, | ||||
slivers: _createContent(context, datas ?? []), | slivers: _createContent(context, datas ?? []), | ||||
), | ), | ||||
Align(alignment: Alignment.topCenter, child: GoodsDetailsAppBarWidget()), | |||||
Align(alignment: Alignment.topCenter, child: GoodsDetailsAppBarWidget(datas[0])), | |||||
], | ], | ||||
)), | )), | ||||
@@ -156,7 +160,7 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | |||||
List<Widget> list = List(); | List<Widget> list = List(); | ||||
/// datas.length - 1 为最后一个在底部 | /// datas.length - 1 为最后一个在底部 | ||||
for (int i = 0; i < datas.length - 1; i++) { | |||||
for (int i = 1; i < datas.length - 1; i++) { | |||||
WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | ||||
print('item.modName ${item.modName}'); | print('item.modName ${item.modName}'); | ||||
@@ -8,6 +8,7 @@ import 'package:zhiying_base_widget/utils/contants.dart'; | |||||
import 'package:zhiying_comm/models/base/base_tab_model.dart'; | import 'package:zhiying_comm/models/base/base_tab_model.dart'; | ||||
import 'package:zhiying_comm/util/image_util.dart'; | import 'package:zhiying_comm/util/image_util.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'package:zhiying_comm/util/update/app_update_util.dart'; | |||||
class HomePage extends StatefulWidget { | class HomePage extends StatefulWidget { | ||||
HomePage({Key key}) : super(key: key); | HomePage({Key key}) : super(key: key); | ||||
@@ -33,6 +34,7 @@ class _HomePageState extends State<HomePage> { | |||||
Logger.error(error); | Logger.error(error); | ||||
} | } | ||||
Constants.isShowIntellectDialog = false; | Constants.isShowIntellectDialog = false; | ||||
// AppUpdateUtil.updateApp(context); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@@ -133,9 +133,11 @@ class _SearchPageContianerState extends State<SearchPageContianer> { | |||||
/// 骨架屏幕? | /// 骨架屏幕? | ||||
list.add(Container( | list.add(Container( | ||||
height: 200, | height: 200, | ||||
child: Center( | |||||
child: Text('暂时无数据哦~'), | |||||
), | |||||
width: double.infinity, | |||||
color: Colors.white, | |||||
// child: Center( | |||||
// child: Text('暂时无数据哦~'), | |||||
// ), | |||||
)); | )); | ||||
} else { | } else { | ||||
for (int i = 0; i < datas.length; i++) { | for (int i = 0; i < datas.length; i++) { | ||||
@@ -1,24 +1,47 @@ | |||||
import 'dart:convert'; | |||||
import 'dart:ui'; | import 'dart:ui'; | ||||
import 'package:provider/provider.dart'; | import 'package:provider/provider.dart'; | ||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart'; | import 'package:zhiying_base_widget/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart'; | ||||
import 'package:zhiying_base_widget/widgets/goods_details/appbar/model/goods_details_appbar_model.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
class GoodsDetailsAppBarWidget extends StatefulWidget { | class GoodsDetailsAppBarWidget extends StatefulWidget { | ||||
final Map<String, dynamic> data; | |||||
GoodsDetailsAppBarModel model; | |||||
GoodsDetailsAppBarWidget(this.data, {Key key}) : super(key: key){ | |||||
try{ | |||||
model = GoodsDetailsAppBarModel.fromJson(jsonDecode(data['data'])); | |||||
}catch(e, s){ | |||||
Logger.error(e, s); | |||||
} | |||||
} | |||||
@override | @override | ||||
_GoodsDetailsAppBarWidgetState createState() => _GoodsDetailsAppBarWidgetState(); | _GoodsDetailsAppBarWidgetState createState() => _GoodsDetailsAppBarWidgetState(); | ||||
} | } | ||||
class _GoodsDetailsAppBarWidgetState extends State<GoodsDetailsAppBarWidget> { | class _GoodsDetailsAppBarWidgetState extends State<GoodsDetailsAppBarWidget> { | ||||
Color _starColor = Colors.transparent; | |||||
Color _starColor; | |||||
Color _endBgColor = HexColor.fromHex('#FF4242'); | Color _endBgColor = HexColor.fromHex('#FF4242'); | ||||
Color _endTextColor = HexColor.fromHex('#FFFFFF'); | Color _endTextColor = HexColor.fromHex('#FFFFFF'); | ||||
Color _bgColor = Colors.transparent; | Color _bgColor = Colors.transparent; | ||||
Color _textColor = Colors.transparent; | Color _textColor = Colors.transparent; | ||||
@override | |||||
void initState() { | |||||
_starColor = Colors.transparent; | |||||
_endTextColor = HexColor.fromHex(widget?.model?.appBarNameColor ?? '#FFFFFF' ); | |||||
_endBgColor = HexColor.fromHex(widget?.model?.appBarBgColor ?? '#FF4242'); | |||||
super.initState(); | |||||
} | |||||
@override | @override | ||||
void didChangeDependencies() { | void didChangeDependencies() { | ||||
GoodsDetailsAppBarColorNotifier notifier = Provider.of<GoodsDetailsAppBarColorNotifier>(context); | GoodsDetailsAppBarColorNotifier notifier = Provider.of<GoodsDetailsAppBarColorNotifier>(context); | ||||
@@ -41,29 +64,25 @@ class _GoodsDetailsAppBarWidgetState extends State<GoodsDetailsAppBarWidget> { | |||||
crossAxisAlignment: CrossAxisAlignment.center, | crossAxisAlignment: CrossAxisAlignment.center, | ||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Padding( | |||||
padding: const EdgeInsets.only(left: 12.5), | |||||
child: SizedBox( | |||||
width: 40, | |||||
height: 40, | |||||
child: IconButton( | |||||
icon: Icon( | |||||
Icons.arrow_back_ios, | |||||
size: 22, | |||||
color: HexColor.fromHex('#FFFFFF'), | |||||
), | |||||
onPressed: () => Navigator.maybePop(context), | |||||
), | |||||
)), | |||||
GestureDetector( | |||||
onTap: ()=> Navigator.maybePop(context), | |||||
child: Padding( | |||||
padding: const EdgeInsets.only(left: 12.5), | |||||
child: SizedBox( | |||||
width: 25 + 12.5, | |||||
height: 25, | |||||
child: CachedNetworkImage(imageUrl: widget?.model?.appBarBackupIcon ?? '', ), | |||||
)), | |||||
), | |||||
Text( | Text( | ||||
'商品详情', | |||||
widget?.model?.appBarName ?? '商品详情', | |||||
style: TextStyle(color: _textColor, fontSize: 15, fontWeight: FontWeight.bold), | style: TextStyle(color: _textColor, fontSize: 15, fontWeight: FontWeight.bold), | ||||
), | ), | ||||
Padding( | Padding( | ||||
padding: const EdgeInsets.only(right: 12.5), | padding: const EdgeInsets.only(right: 12.5), | ||||
child: SizedBox( | child: SizedBox( | ||||
width: 40, | |||||
height: 40, | |||||
width: 25 + 12.5, | |||||
height: 25, | |||||
child: Container( | child: Container( | ||||
height: double.infinity, | height: double.infinity, | ||||
width: double.infinity, | width: double.infinity, | ||||
@@ -0,0 +1,27 @@ | |||||
class GoodsDetailsAppBarModel { | |||||
String appBarName; | |||||
String appBarNameColor; | |||||
String appBarBgImg; | |||||
String appBarBgColor; | |||||
String appBarBackupIcon; | |||||
GoodsDetailsAppBarModel({this.appBarName, this.appBarNameColor, this.appBarBgImg, this.appBarBgColor, this.appBarBackupIcon}); | |||||
GoodsDetailsAppBarModel.fromJson(Map<String, dynamic> json) { | |||||
appBarName = json['app_bar_name']; | |||||
appBarNameColor = json['app_bar_name_color']; | |||||
appBarBgImg = json['app_bar_bg_img']; | |||||
appBarBgColor = json['app_bar_bg_color']; | |||||
appBarBackupIcon = json['app_bar_backup_icon']; | |||||
} | |||||
Map<String, dynamic> toJson() { | |||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||||
data['app_bar_name'] = this.appBarName; | |||||
data['app_bar_name_color'] = this.appBarNameColor; | |||||
data['app_bar_bg_img'] = this.appBarBgImg; | |||||
data['app_bar_bg_color'] = this.appBarBgColor; | |||||
data['app_bar_backup_icon'] = this.appBarBackupIcon; | |||||
return data; | |||||
} | |||||
} |
@@ -1,9 +1,13 @@ | |||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'dart:io'; | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart'; | import 'package:zhiying_base_widget/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart'; | ||||
import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'package:flutter_alibc/flutter_alibc.dart'; | |||||
import 'package:flutter_alibc/alibc_model.dart'; | |||||
import 'package:provider/provider.dart'; | |||||
/// | /// | ||||
/// 商品详情评价Widget | /// 商品详情评价Widget | ||||
@@ -20,20 +24,49 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget { | |||||
} | } | ||||
} | } | ||||
UserInfoModel _user; | |||||
/// 点击查看更多 | /// 点击查看更多 | ||||
void _openLookMore() {} | |||||
void _openLookMore(BuildContext context) async { | |||||
if (_user?.token == null || _user.token == '') { | |||||
print('need login...'); | |||||
RouterUtil.goLogin(context); | |||||
return; | |||||
} | |||||
bool isAuth = await TaobaoAuth.isAuth(); | |||||
if (!isAuth) { | |||||
TaobaoAuth.auth(context); | |||||
return; | |||||
} | |||||
TradeResult result; | |||||
if (!EmptyUtil.isEmpty(_modell?.comment_url)) { | |||||
if (Platform.isAndroid) { | |||||
result = await FlutterAlibc.openByUrl(url: _modell?.comment_url, backUrl: "alisdk://"); | |||||
} else if (Platform.isIOS) { | |||||
result = await FlutterAlibc.openByUrl(url: _modell?.comment_url); | |||||
} | |||||
Logger.debug('${result.errorCode} ${result.errorMessage} '); | |||||
} | |||||
} | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return GestureDetector( | |||||
onTap: () => _openLookMore(), | |||||
behavior: HitTestBehavior.opaque, | |||||
child: Container( | |||||
color: Colors.white, | |||||
margin: const EdgeInsets.only(top: 6), | |||||
width: double.infinity, | |||||
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5, right: 12.5), | |||||
child: getMainWidget(_modell), | |||||
_user = Provider.of<UserInfoNotifier>(context).userInfo; | |||||
return Visibility( | |||||
visible: !EmptyUtil.isEmpty(_modell?.comment_url), | |||||
child: GestureDetector( | |||||
onTap: () => _openLookMore(context), | |||||
behavior: HitTestBehavior.opaque, | |||||
child: Container( | |||||
color: Colors.white, | |||||
margin: const EdgeInsets.only(top: 6), | |||||
width: double.infinity, | |||||
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5, right: 12.5), | |||||
child: getMainWidget(_modell), | |||||
), | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
@@ -49,9 +82,8 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget { | |||||
); | ); | ||||
} | } | ||||
/// 左边图标加文字 | /// 左边图标加文字 | ||||
Widget getLeftWidget(GoodsDetailsEvaluateModel model){ | |||||
Widget getLeftWidget(GoodsDetailsEvaluateModel model) { | |||||
return Row( | return Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
CachedNetworkImage( | CachedNetworkImage( | ||||
@@ -63,5 +95,4 @@ class GoodsDetailsEvaluateWidget extends StatelessWidget { | |||||
], | ], | ||||
); | ); | ||||
} | } | ||||
} | } |
@@ -28,16 +28,22 @@ class _HomeAuthState extends State<HomeAuth> { | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
TaobaoAuth.isAuth().then((isAuth) { | TaobaoAuth.isAuth().then((isAuth) { | ||||
_isAuth = isAuth; | |||||
setState(() {}); | |||||
setState(() => this._isAuth = isAuth); | |||||
}); | }); | ||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@override | @override | ||||
Widget build(BuildContext context) { | |||||
void didChangeDependencies() { | |||||
_user = Provider.of<UserInfoNotifier>(context).userInfo; | _user = Provider.of<UserInfoNotifier>(context).userInfo; | ||||
_isAuth = _user.isTBAuth; | |||||
super.didChangeDependencies(); | |||||
} | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
if (_isAuth) { | if (_isAuth) { | ||||
// 授权过,不显示 | // 授权过,不显示 | ||||
return Container(); | return Container(); | ||||
@@ -151,7 +151,7 @@ class _MarqueeWidgetState extends State<MarqueeWidget> { | |||||
void initState() { | void initState() { | ||||
super.initState(); | super.initState(); | ||||
if (widget.count > 1) { | |||||
if (widget.count > 0) { | |||||
_controller = PageController(); | _controller = PageController(); | ||||
_timer = Timer.periodic(Duration(seconds: 5), (timer) { | _timer = Timer.periodic(Duration(seconds: 5), (timer) { | ||||
// 如果当前位于最后一页,则直接跳转到第一页,两者内容相同,跳转时视觉上无感知 | // 如果当前位于最后一页,则直接跳转到第一页,两者内容相同,跳转时视觉上无感知 | ||||
@@ -7,6 +7,7 @@ import 'package:provider/provider.dart'; | |||||
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart'; | import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart'; | ||||
import 'package:zhiying_base_widget/pages/message_notice_page/message_notice_page.dart'; | import 'package:zhiying_base_widget/pages/message_notice_page/message_notice_page.dart'; | ||||
import 'package:zhiying_base_widget/pages/team_details_page/team_details_page.dart'; | import 'package:zhiying_base_widget/pages/team_details_page/team_details_page.dart'; | ||||
import 'package:zhiying_base_widget/pages/vip_center_page/vip_center_page.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'bloc/bloc.dart'; | import 'bloc/bloc.dart'; | ||||
@@ -49,11 +50,6 @@ class _HomeSlideBannerContainerState extends State<HomeSlideBannerContainer> { | |||||
void _itemOnClick(IndexCarousel model) { | void _itemOnClick(IndexCarousel model) { | ||||
print('点击了 $model'); | print('点击了 $model'); | ||||
RouterUtil.route(model, model.toJson(), context); | RouterUtil.route(model, model.toJson(), context); | ||||
// Navigator.push(context, CupertinoPageRoute( | |||||
// builder: (_) => PageFactory.create('goods_details', null) | |||||
// )); | |||||
// Navigator.push(context, CupertinoPageRoute(builder: (_)=> TeamPage())); | |||||
// Navigator.push(context, CupertinoPageRoute(builder: (_) => VipCenterPage(null))); | // Navigator.push(context, CupertinoPageRoute(builder: (_) => VipCenterPage(null))); | ||||
} | } | ||||