Просмотр исходного кода

1231 底部导航栏隐藏控制字段对接

tags/0.0.3+2^0
23028876916@qq.com 3 лет назад
Родитель
Сommit
adbcf0024b
3 измененных файлов: 76 добавлений и 65 удалений
  1. +1
    -1
      lib/pages/goods_details_page/goods_details_page.dart
  2. +28
    -35
      lib/pages/home_page/home_page.dart
  3. +47
    -29
      lib/widgets/goods_details/store/store_widget.dart

+ 1
- 1
lib/pages/goods_details_page/goods_details_page.dart Просмотреть файл

@@ -164,7 +164,7 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> {
for (int i = 1; i < datas.length - 1; i++) {
WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i]));

print('item.modName ${item.modName}');
print('我的item.modName ${item.modName}');
list.addAll(WidgetFactory.create(
item.modName,
isSliver: true,


+ 28
- 35
lib/pages/home_page/home_page.dart Просмотреть файл

@@ -31,8 +31,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
int _currentIndex = 0;
List<Map<String, dynamic>> _data = List();
static const EventChannel _eventChannel =
const EventChannel('JAVA_TO_FLUTTER');
static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER');

@override
void initState() {
@@ -55,7 +54,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
_showPolicy();

Moblink.uploadPrivacyPermissionStatus(1, (bool success) {});
SharesdkPlugin.uploadPrivacyPermissionStatus( 1 , (bool success) {});
SharesdkPlugin.uploadPrivacyPermissionStatus(1, (bool success) {});
// 是安卓系统,Android场景还原的实现
/*if (defaultTargetPlatform == TargetPlatform.android) {

@@ -121,23 +120,22 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
String textColor = model.fontColor;
String chooseColor = model.chooseColor ?? textColor;

items.add(BottomNavigationBarItem(
icon: Container(
width: 24,
height: 24,
margin: EdgeInsets.only(bottom: 4),
child: CachedNetworkImage(
imageUrl: _currentIndex == i ? selectedIcon : icon,
fit: BoxFit.fitWidth,
if (model.isShow == "1") {
items.add(BottomNavigationBarItem(
icon: Container(
width: 24,
height: 24,
margin: EdgeInsets.only(bottom: 4),
child: CachedNetworkImage(
imageUrl: _currentIndex == i ? selectedIcon : icon,
fit: BoxFit.fitWidth,
),
),
),
title: Text(
model.name,
style: TextStyle(
fontSize: 11,
color: HexColor.fromHex(
_currentIndex == i ? chooseColor : textColor)),
)));
title: Text(
model.name,
style: TextStyle(fontSize: 11, color: HexColor.fromHex(_currentIndex == i ? chooseColor : textColor)),
)));
}
}

if (items.length < 2) {
@@ -169,9 +167,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {

Future<bool> _checkLimit(BaseTabModel model) async {
if (model.requiredLogin == '1') {
UserInfoModel user =
await Provider.of<UserInfoNotifier>(context, listen: false)
.getUserInfoModel();
UserInfoModel user = await Provider.of<UserInfoNotifier>(context, listen: false).getUserInfoModel();
print(user.toString());
if (user?.token == null || user.token == '') {
print('need login...');
@@ -201,8 +197,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
}

// 通知弹窗
String isShowNotiPermission = await SharedPreferencesUtil.getStringValue(
Constants.isShowNotiPermission);
String isShowNotiPermission = await SharedPreferencesUtil.getStringValue(Constants.isShowNotiPermission);
if (isShowNotiPermission == null || isShowNotiPermission != '1') {
await NotificationSettingDialog.show(context);
await SharedPreferencesUtil.setStringValue(Constants.isShowNotiPermission, "1");
@@ -264,16 +259,14 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
void showAlert(String text, BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
title: new Text("提示"),
content: new Text(text),
actions: <Widget>[
new FlatButton(
child: new Text("OK"),
onPressed: () {
Navigator.of(context).pop();
},
)
]));
builder: (BuildContext context) =>
CupertinoAlertDialog(title: new Text("提示"), content: new Text(text), actions: <Widget>[
new FlatButton(
child: new Text("OK"),
onPressed: () {
Navigator.of(context).pop();
},
)
]));
}
}

+ 47
- 29
lib/widgets/goods_details/store/store_widget.dart Просмотреть файл

@@ -49,7 +49,11 @@ class _StoreContainerState extends State<StoreContainer> {
void _onMoreClick() {}

/// 点击商家
void _onStoreClick() {}
void _onStoreClick() {
print("点击了_onStoreClick");
Logger.log(widget.model['data']);
// RouterUtil.openWebview(url, context);
}

@override
Widget build(BuildContext context) {
@@ -72,30 +76,35 @@ class _StoreContainerState extends State<StoreContainer> {

/// 主视图
Widget _getMianWidget(StoreModel model) {
return Container(
color: Colors.white,
width: double.infinity,
height: 50 + 20.0 + 18,
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 20, bottom: 18),
child: Row(
children: <Widget>[
/// 商家图片
_getStoreImgWidget(model),
const SizedBox(width: 7.5),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/// 商店名称与更多
_getStoreNameWidget(model),

/// 评分描述
_getEvaluateWidget(model),
],
return GestureDetector(
onTap: () {
_onStoreClick();
},
child: Container(
color: Colors.white,
width: double.infinity,
height: 50 + 20.0 + 18,
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 20, bottom: 18),
child: Row(
children: <Widget>[
/// 商家图片
_getStoreImgWidget(model),
const SizedBox(width: 7.5),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/// 商店名称与更多
_getStoreNameWidget(model),

/// 评分描述
_getEvaluateWidget(model),
],
),
),
),
],
],
),
),
);
}
@@ -120,10 +129,16 @@ class _StoreContainerState extends State<StoreContainer> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/// 商店名称
Text(model?.shop_name ?? '品胜京东自营旗舰店', style: TextStyle(color: HexColor.fromHex(model?.shop_name_color ?? '#333333'), fontSize: 13, fontWeight: FontWeight.bold)),
Text(model?.shop_name ?? '品胜京东自营旗舰店',
style: TextStyle(
color: HexColor.fromHex(model?.shop_name_color ?? '#333333'),
fontSize: 13,
fontWeight: FontWeight.bold)),

/// 更多 TODO 暂时隐藏,等后台有数据后再打开
Visibility(visible: false, child: Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))),
Visibility(
visible: false,
child: Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))),
],
);
}
@@ -134,13 +149,16 @@ class _StoreContainerState extends State<StoreContainer> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/// 宝贝描述 5.0
_getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.description_color ?? '#999999', model?.description_leve_icon ?? ''),
_getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.description_color ?? '#999999',
model?.description_leve_icon ?? ''),

/// 物流服务 5.0
_getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''),
_getCoustomWidet(
model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''),

/// 服务态度 1.0
_getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''),
_getCoustomWidet(
model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''),
],
);
}


Загрузка…
Отмена
Сохранить