| | |
| | | import 'package:locations/api/http.dart'; |
| | | import 'package:locations/model/user/user_info.dart'; |
| | | import 'package:locations/ui/common/browser.dart'; |
| | | import 'package:locations/ui/map/travel.dart'; |
| | | import 'package:locations/ui/mine/advice.dart'; |
| | | import 'package:locations/ui/mine/login.dart'; |
| | | import 'package:locations/ui/mine/permission.dart'; |
| | | import 'package:locations/ui/mine/settings.dart'; |
| | | import 'package:locations/ui/mine/share_to_friends.dart'; |
| | | import 'package:locations/ui/mine/try_functions.dart'; |
| | | import 'package:locations/utils/ad_util.dart'; |
| | | import 'package:locations/utils/config_util.dart'; |
| | | import 'package:locations/utils/pageutils.dart'; |
| | | import 'package:locations/utils/string_util.dart'; |
| | | import 'package:locations/utils/ui_constant.dart'; |
| | | import 'package:locations/utils/ui_utils.dart'; |
| | | import 'package:locations/utils/user_util.dart'; |
| | |
| | | bool isLogin = false; |
| | | bool isVIP = false; |
| | | List<Widget> list = []; |
| | | Widget? adView; |
| | | bool adDeleted = false; |
| | | final List<Functions> data = [ |
| | | Functions("assets/images/mine/icon_mine_permission.png", "权限设置", |
| | | "permission", false), |
| | | Functions("assets/images/mine/icon_mine_kefu.png", "在线客服", "kefu", false), |
| | | Functions( |
| | | "assets/images/mine/icon_mine_permission.png", "权限设置", "permission"), |
| | | Functions("assets/images/mine/icon_mine_kefu.png", "在线客服", "kefu"), |
| | | Functions("assets/images/mine/icon_mine_footmark.png", "轨迹足迹", "footmark"), |
| | | "assets/images/mine/icon_mine_footmark.png", "轨迹足迹", "footmark", true), |
| | | Functions("assets/images/mine/icon_mine_functions.png", "功能使用", "functions", |
| | | true), |
| | | Functions( |
| | | "assets/images/mine/icon_mine_functions.png", "功能使用", "functions"), |
| | | Functions("assets/images/mine/icon_mine_course.png", "使用教程", "course"), |
| | | Functions("assets/images/mine/icon_mine_share.png", "分享好友", "share"), |
| | | Functions("assets/images/mine/icon_mine_advice.png", "意见反馈", "advice"), |
| | | Functions("assets/images/mine/icon_mine_protocol.png", "用户协议", "protocol"), |
| | | Functions("assets/images/mine/icon_mine_privacy.png", "隐私政策", "privacy"), |
| | | Functions("assets/images/mine/icon_mine_setting.png", "更多设置", "setting"), |
| | | "assets/images/mine/icon_mine_course.png", "使用教程", "course", false), |
| | | Functions("assets/images/mine/icon_mine_share.png", "分享好友", "share", false), |
| | | Functions( |
| | | "assets/images/mine/icon_mine_advice.png", "意见反馈", "advice", false), |
| | | Functions( |
| | | "assets/images/mine/icon_mine_protocol.png", "用户协议", "protocol", false), |
| | | Functions( |
| | | "assets/images/mine/icon_mine_privacy.png", "隐私政策", "privacy", false), |
| | | Functions( |
| | | "assets/images/mine/icon_mine_setting.png", "更多设置", "setting", false), |
| | | ]; |
| | | |
| | | void _onClick(Functions function) { |
| | | void _onClick(Functions function) async { |
| | | if (function.needLogin) { |
| | | bool login = await UserUtil.isLogin(); |
| | | if (!login) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, LoginPage(title: ""), (data) {}); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | int? uid = await UserUtil.getUid(); |
| | | |
| | | switch (function.key) { |
| | | case "permission": |
| | | Navigator.of(context).push(CustomRouteSlide(PermissionPage(title: ""))); |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, PermissionPage(title: ""), (data) {}); |
| | | break; |
| | | case "kefu": |
| | | ConfigUtil.getConfig(ConfigKey.kefu).then((value) { |
| | | if (!StringUtil.isNullOrEmpty(value)) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, BrowserPage(title: "在线客服", url: value!), (data) {}); |
| | | } |
| | | }); |
| | | break; |
| | | case "footmark": |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, MyTravelPage(uid: uid!), (data) {}); |
| | | break; |
| | | case "functions": |
| | | Navigator.of(context) |
| | | .push(CustomRouteSlide(TryFunctionsPage(title: ""))); |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, TryFunctionsPage(title: ""), (data) {}); |
| | | break; |
| | | case "course": |
| | | ConfigUtil.getConfig(ConfigKey.course).then((value) { |
| | | if (!StringUtil.isNullOrEmpty(value)) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, BrowserPage(title: "使用教程", url: value!), (data) {}); |
| | | } |
| | | }); |
| | | break; |
| | | case "share": |
| | | Navigator.of(context) |
| | | .push(CustomRouteSlide(ShareToFriendsPage(title: ""))); |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, ShareToFriendsPage(title: ""), (data) {}); |
| | | break; |
| | | case "advice": |
| | | Navigator.of(context).push(CustomRouteSlide(AdvicePage(title: ""))); |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, AdvicePage(title: ""), (data) {}); |
| | | break; |
| | | case "protocol": |
| | | Navigator.of(context).push(CustomRouteSlide(BrowserPage(title: ""))); |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | BrowserPage( |
| | | title: "用户协议", |
| | | url: Constant.PROTOCOL_URL, |
| | | ), |
| | | (data) {}); |
| | | break; |
| | | case "privacy": |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | BrowserPage( |
| | | title: "隐私政策", |
| | | url: Constant.PRIVACY_URL, |
| | | ), |
| | | (data) {}); |
| | | break; |
| | | case "setting": |
| | | NavigatorUtil.navigateToNextPage(context, SettingPage(title: ""), |
| | |
| | | void _login() { |
| | | NavigatorUtil.navigateToNextPage(context, LoginPage(title: ""), (data) { |
| | | _getUserInfo(); |
| | | }); |
| | | } |
| | | |
| | | void _loadAd() async { |
| | | if (adView != null) { |
| | | return; |
| | | } |
| | | if (adDeleted) { |
| | | return; |
| | | } |
| | | |
| | | Widget ad = CSJAdUtil.loadExpress( |
| | | "947239180", MediaQuery.of(context).size.width - 20, 200, |
| | | (success, msg) { |
| | | adDeleted = true; |
| | | setState(() { |
| | | adView = null; |
| | | }); |
| | | }); |
| | | |
| | | setState(() { |
| | | adView = ad; |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | @override |
| | | Widget build(BuildContext context) { |
| | | _loadAd(); |
| | | return Scaffold( |
| | | backgroundColor: Colors.white, |
| | | body: SingleChildScrollView( |
| | |
| | | } |
| | | }); |
| | | }, |
| | | child: Container( |
| | | width: 99, |
| | | height: 26, |
| | | alignment: Alignment.center, |
| | | child: Text( |
| | | isVIP ? "查看详情" : "立即开通", |
| | | style: const TextStyle( |
| | | color: Color(0xFFD4A880)), |
| | | ), |
| | | decoration: const BoxDecoration( |
| | | color: Color(0xFFFAEAB9), |
| | | borderRadius: BorderRadius.only( |
| | | topLeft: Radius.circular(13), |
| | | bottomLeft: Radius.circular(13)), |
| | | boxShadow: [ |
| | | BoxShadow( |
| | | color: Color(0x4D0E96FF), |
| | | blurRadius: 2.0, |
| | | offset: |
| | | Offset(0.0, 3.0), //阴影y轴偏移量 |
| | | spreadRadius: 0 //阴影扩散程度 |
| | | ) |
| | | ], |
| | | )))) |
| | | child: InkWell( |
| | | onTap: () { |
| | | UserUtil.isLogin().then((value) { |
| | | if (!value) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | LoginPage(title: ""), |
| | | (data) {}); |
| | | return; |
| | | } |
| | | |
| | | ConfigUtil.getConfig( |
| | | ConfigKey.vipLink) |
| | | .then((value) { |
| | | if (!StringUtil.isNullOrEmpty( |
| | | value)) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | BrowserPage( |
| | | title: "会员", url: value!), |
| | | (data) {}); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | child: Container( |
| | | width: 99, |
| | | height: 26, |
| | | alignment: Alignment.center, |
| | | child: Text( |
| | | isVIP ? "查看详情" : "立即开通", |
| | | style: const TextStyle( |
| | | color: Color(0xFFD4A880)), |
| | | ), |
| | | decoration: const BoxDecoration( |
| | | color: Color(0xFFFAEAB9), |
| | | borderRadius: BorderRadius.only( |
| | | topLeft: Radius.circular(13), |
| | | bottomLeft: |
| | | Radius.circular(13)), |
| | | boxShadow: [ |
| | | BoxShadow( |
| | | color: Color(0x4D0E96FF), |
| | | blurRadius: 2.0, |
| | | offset: Offset(0.0, 3.0), |
| | | //阴影y轴偏移量 |
| | | spreadRadius: 0 //阴影扩散程度 |
| | | ) |
| | | ], |
| | | ))))) |
| | | ], |
| | | ), |
| | | decoration: const BoxDecoration( |
| | |
| | | ], |
| | | ), |
| | | ), |
| | | |
| | | Container( |
| | | child: adView ?? Container(), |
| | | margin: EdgeInsets.only(left: 10, right: 10), |
| | | ), |
| | | //广告 |
| | | |
| | | //功能区域 |
| | | Container( |
| | | height: 340, |
| | |
| | | } |
| | | |
| | | class Functions { |
| | | Functions(this.icon, this.name, this.key); |
| | | Functions(this.icon, this.name, this.key, this.needLogin); |
| | | |
| | | String icon; |
| | | String name; |
| | | String key; |
| | | bool needLogin; |
| | | } |