From 097b361882145c94f8152f9a0fcd17d51014584d Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Fri, 11 Mar 2022 14:45:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=81=94=E7=B3=BB=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mine_view/mine_item.dart | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) 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'; + } + } }