diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index fa49ca4a..108ee702 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -1,9 +1,11 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:url_launcher/url_launcher.dart'; class MineItem extends StatefulWidget { @override @@ -154,6 +156,16 @@ class _MineItem extends State { "assets/image/yao_q.webp", ), ),), + ///联系客服 + // Expanded(child: InkWell( + // onTap: () { + // showCallMobile(); + // }, + // child: mineItem( + // "联系客服", + // "assets/image/icon_mine_online_service.png", + // ), + // ),), Expanded(child:Container()), Expanded(child:Container()), Expanded(child:Container()) @@ -202,4 +214,41 @@ class _MineItem extends State { ), ); } + + showCallMobile() { + showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + title: Text(S.of(context).bodadianhua), + actions: [ + CupertinoActionSheetAction( + child: Text("15392949097"), + onPressed: () { + callMobile("15392949097"); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), + ], + cancelButton: CupertinoActionSheetAction( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(S.of(context).quxiao), + isDestructiveAction: true, + ), + ); + }); + } + + callMobile(mobile) async { + String url = "tel:$mobile"; + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + } }