admin
2021-11-10 ef43946e123a2e7d4c616e0dc02c89970b71d900
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import 'dart:ui';
 
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:fluwx_no_pay/fluwx_no_pay.dart' as fluwx;
import 'package:shared_preferences/shared_preferences.dart';
 
class UserUtil {
  static const _loginMessageChannel =
      const BasicMessageChannel('ThirdLogin', StandardMessageCodec());
 
  //是否同意了用户协议
  static Future<bool> isAgreeProtocol() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    bool? agree = prefs.getBool("agree_protocol");
    if (agree == null) {
      return false;
    }
    return agree;
  }
 
  //设置已同意用户协议
  static Future<bool> setAgreeProtocol() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    return prefs.setBool("agree_protocol", true);
  }
 
  ///微信登录
  static void loginWX() async {
    fluwx
        .sendWeChatAuth(scope: "snsapi_userinfo", state: "wechat_sdk_demo_test")
        .then((value) {});
  }
 
  static Future<Map> loginQQ() async {
    Map value = await _loginMessageChannel.send({"method": "loginQQ"}) as Map;
    return value;
  }
}