|
|
@@ -3,6 +3,7 @@ import 'dart:convert' as convert; |
|
|
|
import 'package:cached_network_image/cached_network_image.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:provider/provider.dart'; |
|
|
|
import 'package:zhiying_base_widget/utils/contants.dart'; |
|
|
|
import 'package:zhiying_comm/models/base/base_tab_model.dart'; |
|
|
|
import 'package:zhiying_comm/util/image_util.dart'; |
|
|
@@ -105,12 +106,30 @@ class _HomePageState extends State<HomePage> { |
|
|
|
unselectedFontSize: 11, |
|
|
|
currentIndex: _currentIndex, |
|
|
|
elevation: 0, |
|
|
|
onTap: ((index) { |
|
|
|
setState(() { |
|
|
|
_currentIndex = index; |
|
|
|
}); |
|
|
|
onTap: ((index) async { |
|
|
|
BaseTabModel model = BaseTabModel.fromJson(tabs[index]); |
|
|
|
if (await _checkLimit(model)) { |
|
|
|
setState(() { |
|
|
|
_currentIndex = index; |
|
|
|
}); |
|
|
|
} |
|
|
|
}), |
|
|
|
//底部导航栏 |
|
|
|
items: items); |
|
|
|
} |
|
|
|
|
|
|
|
Future<bool> _checkLimit(BaseTabModel model) async { |
|
|
|
if (model.requiredLogin == '1') { |
|
|
|
UserInfoModel user = |
|
|
|
await Provider.of<UserInfoNotifier>(context, listen: false) |
|
|
|
.getUserInfoModel(); |
|
|
|
print(user.toString()); |
|
|
|
if (user?.token == null || user.token == '') { |
|
|
|
print('need login...'); |
|
|
|
RouterUtil.goLogin(context); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |