Commit dfd4d15d7221ca6f4db2d99d4c9e365b2a64e1ac

Authored by xiaoyu
1 parent de2a6c02

添加联系客服功能

ios/Runner/Info.plist
@@ -22,15 +22,6 @@ @@ -22,15 +22,6 @@
22 <string>$(MARKETING_VERSION)</string> 22 <string>$(MARKETING_VERSION)</string>
23 <key>CFBundleSignature</key> 23 <key>CFBundleSignature</key>
24 <string>????</string> 24 <string>????</string>
25 - <key>LSApplicationQueriesSchemes</key>  
26 - <array>  
27 - <string>wechat</string>  
28 - <string>weixin</string>  
29 - <string>weixinULAPI</string>  
30 - <string>weixinURLParamsAPI</string>  
31 - <string>alipay</string>  
32 - <string>alipayshare</string>  
33 - </array>  
34 <key>CFBundleURLTypes</key> 25 <key>CFBundleURLTypes</key>
35 <array> 26 <array>
36 <dict> 27 <dict>
@@ -68,6 +59,16 @@ @@ -68,6 +59,16 @@
68 <string>$(CURRENT_PROJECT_VERSION)</string> 59 <string>$(CURRENT_PROJECT_VERSION)</string>
69 <key>LSApplicationCategoryType</key> 60 <key>LSApplicationCategoryType</key>
70 <string></string> 61 <string></string>
  62 + <key>LSApplicationQueriesSchemes</key>
  63 + <array>
  64 + <string>tel</string>
  65 + <string>wechat</string>
  66 + <string>weixin</string>
  67 + <string>weixinULAPI</string>
  68 + <string>weixinURLParamsAPI</string>
  69 + <string>alipay</string>
  70 + <string>alipayshare</string>
  71 + </array>
71 <key>LSRequiresIPhoneOS</key> 72 <key>LSRequiresIPhoneOS</key>
72 <true/> 73 <true/>
73 <key>NSAppTransportSecurity</key> 74 <key>NSAppTransportSecurity</key>
lib/pages/user/user_page.dart
@@ -14,6 +14,7 @@ import &#39;package:wow_english/models/user_entity.dart&#39;; @@ -14,6 +14,7 @@ import &#39;package:wow_english/models/user_entity.dart&#39;;
14 import 'package:wow_english/pages/user/bloc/user_bloc.dart'; 14 import 'package:wow_english/pages/user/bloc/user_bloc.dart';
15 import 'package:wow_english/route/route.dart'; 15 import 'package:wow_english/route/route.dart';
16 import 'package:wow_english/utils/image_util.dart'; 16 import 'package:wow_english/utils/image_util.dart';
  17 +import 'package:url_launcher/url_launcher.dart';
17 18
18 class UserPage extends StatelessWidget { 19 class UserPage extends StatelessWidget {
19 const UserPage({super.key}); 20 const UserPage({super.key});
@@ -190,6 +191,17 @@ class _UserView extends StatelessWidget { @@ -190,6 +191,17 @@ class _UserView extends StatelessWidget {
190 12.verticalSpace, 191 12.verticalSpace,
191 OutlinedButton( 192 OutlinedButton(
192 onPressed: () { 193 onPressed: () {
  194 + String phone ='tel:+8618856084180';
  195 + _launchPhone(phone);
  196 + },
  197 + style: normalButtonStyle,
  198 + child: Text(
  199 + "联系客服",
  200 + style: textStyle21sp,
  201 + )),
  202 + 12.verticalSpace,
  203 + OutlinedButton(
  204 + onPressed: () {
193 pushNamed(AppRouteName.setting); 205 pushNamed(AppRouteName.setting);
194 }, 206 },
195 style: normalButtonStyle, 207 style: normalButtonStyle,
@@ -246,4 +258,12 @@ class _UserView extends StatelessWidget { @@ -246,4 +258,12 @@ class _UserView extends StatelessWidget {
246 )); 258 ));
247 }, 259 },
248 ); 260 );
  261 +
  262 + void _launchPhone(String phone) async {
  263 + if (await canLaunchUrl(Uri.parse(phone))) {
  264 + await launchUrl(Uri.parse(phone));
  265 + } else {
  266 + throw 'Could not phone $phone';
  267 + }
  268 + }
249 } 269 }