| | |
| | | <!-- </intent-filter>--> |
| | | <!-- </activity>--> |
| | | |
| | | <activity |
| | | android:name="com.yalantis.ucrop.UCropActivity" |
| | | android:screenOrientation="portrait" |
| | | android:theme="@style/Theme.AppCompat.Light.NoActionBar"/> |
| | | |
| | | |
| | | </application> |
| | | |
| | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.yeshi.makemoney.video.R; |
| | | import com.yeshi.makemoney.video.app.entity.eventbus.UpdateConfig; |
| | | import com.yeshi.makemoney.video.app.utils.AppConfigUtil; |
| | | import com.yeshi.makemoney.video.app.utils.Constant; |
| | | import com.yeshi.makemoney.video.app.utils.SettingUtil; |
| | | import com.yeshi.makemoney.video.app.utils.UserUtil; |
| | | import com.yeshi.makemoney.video.app.utils.api.HttpApiUtil; |
| | | import com.yeshi.makemoney.video.app.utils.ui.JumpPageUtil; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | |
| | | super.onCreate(); |
| | | application = this; |
| | | MultiDex.install(this); |
| | | if (UserUtil.isAgreeUserProtocol(application) || Constant.DEBUG) { |
| | | init(application, null); |
| | | } |
| | | // if (UserUtil.isAgreeUserProtocol(application) || Constant.DEBUG) { |
| | | // init(application, new InitListener() { |
| | | // @Override |
| | | // public void onFinish() { |
| | | // SettingUtil.initSettings(getApplicationContext()); |
| | | // } |
| | | // }); |
| | | // } |
| | | } |
| | | |
| | | public static void init(Application application, InitListener initListener) { |
| | | if (inited) { |
| | | if(initListener!=null) { |
| | | initListener.onFinish(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | initListener.onFinish(); |
| | | } |
| | | }); |
| | | } else { |
| | | initListener.onFinish(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return HttpApiUtil.getRequestParams(application.getApplicationContext(), ps); |
| | | } |
| | | |
| | | @Override |
| | | public String getConfig(String key) { |
| | | AppConfigUtil.ConfigKey configKey = null; |
| | | try { |
| | | configKey = AppConfigUtil.ConfigKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (configKey == null) { |
| | | EventBus.getDefault().post(new UpdateConfig()); |
| | | return null; |
| | | } |
| | | return AppConfigUtil.getConfig(configKey, application); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean getSetting(String key) { |
| | | SettingUtil.SettingKey settingKey = null; |
| | | try { |
| | | settingKey = SettingUtil.SettingKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (settingKey == null) { |
| | | return null; |
| | | } |
| | | return SettingUtil.getSetting(settingKey, application); |
| | | } |
| | | |
| | | @Override |
| | | public void setSetting(String key, boolean b) { |
| | | |
| | | SettingUtil.SettingKey settingKey = null; |
| | | try { |
| | | settingKey = SettingUtil.SettingKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (settingKey == null) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | SettingUtil.saveSetting(settingKey, b, application); |
| | | } |
| | | }); |
| | | //UI接口 |
| | | new UIMethodChannel(engine.getDartExecutor().getBinaryMessenger(), application.getApplicationContext(), new UIMethodChannel.DataListener() { |
New file |
| | |
| | | package com.yeshi.makemoney.video.app.entity.eventbus; |
| | | |
| | | public class UpdateConfig { |
| | | } |
| | |
| | | import com.demo.lib.common.dialog.DialogUtil; |
| | | import com.demo.lib.common.util.FragmentSwitchHelperV2; |
| | | import com.demo.lib.common.util.common.StringUtils; |
| | | import com.demo.library_ad.AdUtil; |
| | | import com.demo.library_flutter.FlutterCommonActivity; |
| | | import com.demo.library_flutter.FlutterMineFragment; |
| | | import com.demo.library_flutter.FlutterRecommendFragment; |
| | |
| | | import com.idlefish.flutterboost.containers.FlutterBoostFragment; |
| | | import com.jaeger.library.StatusBarUtil; |
| | | import com.yeshi.makemoney.video.R; |
| | | import com.yeshi.makemoney.video.app.MyApplication; |
| | | import com.yeshi.makemoney.video.app.entity.eventbus.UpdateConfig; |
| | | import com.yeshi.makemoney.video.app.push.PushOpenClickActivity; |
| | | import com.yeshi.makemoney.video.app.ui.dialog.ExitDialog; |
| | | import com.yeshi.makemoney.video.app.ui.main.DYNewsFragment; |
| | | import com.yeshi.makemoney.video.app.ui.main.HomeFragment; |
| | | import com.yeshi.makemoney.video.app.ui.main.MineFragment; |
| | | import com.yeshi.makemoney.video.app.ui.main.NovelFragment; |
| | | import com.yeshi.makemoney.video.app.utils.AppConfigUtil; |
| | | import com.yeshi.makemoney.video.app.utils.api.BasicTextHttpResponseHandler; |
| | | import com.yeshi.makemoney.video.app.utils.api.HttpApiUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_main); |
| | | EventBus.getDefault().register(this); |
| | | mAQuery = new AQuery(this); |
| | | rg_nav = findViewById(R.id.rg_nav); |
| | | initFragment(); |
| | |
| | | super.onResume(); |
| | | PushOpenClickActivity.resumeJumpActivity(this); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | |
| | | @Subscribe |
| | | public void onEventMainThread(UpdateConfig changeInfo) { |
| | | HttpApiUtil.getConfig(getApplicationContext(), new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getInt("code") == 0) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | JSONObject ad = data.optJSONObject("ad"); |
| | | for (Iterator<String> its = data.keys(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | AppConfigUtil.ConfigKey configKey = null; |
| | | try { |
| | | configKey = AppConfigUtil.ConfigKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (configKey != null) { |
| | | //保存配置文件 |
| | | AppConfigUtil.saveConfig(configKey, data.optString(configKey.name()), getApplicationContext()); |
| | | } |
| | | } |
| | | //保存广告配置 |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | import com.yeshi.makemoney.video.app.ui.dialog.UserProtocolDialog; |
| | | import com.yeshi.makemoney.video.app.utils.AppConfigUtil; |
| | | import com.yeshi.makemoney.video.app.utils.Constant; |
| | | import com.yeshi.makemoney.video.app.utils.SettingUtil; |
| | | import com.yeshi.makemoney.video.app.utils.UserUtil; |
| | | import com.demo.library_ad.AdUtil; |
| | | import com.demo.library_ad.SplashAdUtil; |
| | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | import com.yeshi.makemoney.video.app.utils.api.HttpApiUtil; |
| | | import com.yeshi.makemoney.video.app.utils.api.BasicTextHttpResponseHandler; |
| | | |
| | | import java.util.Iterator; |
| | | |
| | | import static android.content.pm.PackageManager.PERMISSION_DENIED; |
| | | import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
| | |
| | | MyApplication.init(MyApplication.application, new MyApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | toMainActivity(); |
| | | } |
| | | }); |
| | | |
| | | // if (1 > 0) { |
| | | // vg_ad.postDelayed(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // toMainActivity(); |
| | | // } |
| | | // },3000); |
| | | // |
| | | // return; |
| | | // } |
| | | |
| | | |
| | | int delayMs = 1; |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | HttpApiUtil.getConfig(getApplicationContext(), new BasicTextHttpResponseHandler() { |
| | | |
| | | SettingUtil.initSettings(getApplicationContext()); |
| | | int delayMs = 1; |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | JSONObject ad = data.optJSONObject("adNew"); |
| | | //浏览器外跳协议 |
| | | AppConfigUtil.saveBrowserJumpOutProtocolPrefix(getApplicationContext(), data.optString("jumpAppProtocolPrefix")); |
| | | //保存联系客服,注销链接 |
| | | AppConfigUtil.saveConcatUsLink(getApplicationContext(), data.optString("contactUsLink")); |
| | | AppConfigUtil.saveUnRegisterLink(getApplicationContext(), data.optString("unRegisterLink")); |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | MyApplication.initAd(MyApplication.application, new MyApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | public void run() { |
| | | HttpApiUtil.getConfig(getApplicationContext(), new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getInt("code") == 0) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | JSONObject ad = data.optJSONObject("ad"); |
| | | for (Iterator<String> its = data.keys(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | AppConfigUtil.ConfigKey configKey = null; |
| | | try { |
| | | configKey = AppConfigUtil.ConfigKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (configKey != null) { |
| | | //保存配置文件 |
| | | AppConfigUtil.saveConfig(configKey, data.optString(configKey.name()), getApplicationContext()); |
| | | } |
| | | } |
| | | //保存广告配置 |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | MyApplication.initAd(MyApplication.application, new MyApplication.InitListener() { |
| | | @Override |
| | | public void run() { |
| | | loadSplashAd(); |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | return; |
| | | } else { |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | return; |
| | | } else { |
| | | loadSplashAd(); |
| | | } |
| | | } |
| | | } |
| | | loadSplashAd(); |
| | | |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | }, delayMs); |
| | | } |
| | | }, delayMs); |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | private void loadSplashAd() { |
| | | |
| | | AdUtil.AD_TYPE splashType = AdUtil.getAdType(getApplicationContext(), ""); |
| | | AdUtil.AD_TYPE splashType = AdUtil.getAdType(getApplicationContext(), "splashAd"); |
| | | if (splashType == null) { |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | |
| | | if (url.startsWith("weixin://") || url.startsWith("alipay://")) { |
| | | |
| | | } else if (!url.startsWith("http")) { |
| | | if (jumpOutProtocolSet != null) { |
| | | for (String prefix : jumpOutProtocolSet) { |
| | | if (url.startsWith(prefix)) { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | startActivity(intent); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | |
| | | |
| | | private String wholeTitle; |
| | | |
| | | private Set<String> jumpOutProtocolSet; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | |
| | | progressBar.setProgressDrawable(this.getResources() |
| | | .getDrawable(R.drawable.color_progressbar)); |
| | | initX5WebView(); |
| | | jumpOutProtocolSet = AppConfigUtil.getBrowserJumpOutProtocolPrefix(getApplicationContext()); |
| | | webview.loadUrl(getIntent().getStringExtra("url")); |
| | | wholeTitle = getIntent().getStringExtra("title"); |
| | | if (!StringUtils.isEmpty(wholeTitle)) { |
| | |
| | | |
| | | public class AppConfigUtil { |
| | | |
| | | /** |
| | | * 浏览器外跳协议 |
| | | * |
| | | * @param context |
| | | * @param content |
| | | */ |
| | | public static void saveBrowserJumpOutProtocolPrefix(Context context, String content) { |
| | | saveConfig("jumpAppProtocolPrefix", content, context); |
| | | public enum ConfigKey { |
| | | kefu, |
| | | unRegister, |
| | | privacyComplain, |
| | | helpLink |
| | | } |
| | | |
| | | public static Set<String> getBrowserJumpOutProtocolPrefix(Context context) { |
| | | try { |
| | | String config = getConfig("jumpAppProtocolPrefix", context); |
| | | if (!StringUtils.isEmpty(config)) { |
| | | Type type = new TypeToken<Set<String>>() { |
| | | }.getType(); |
| | | return new Gson().fromJson(config, type); |
| | | } |
| | | } catch (Exception e) { |
| | | e.getMessage(); |
| | | } |
| | | return new HashSet<>(); |
| | | |
| | | public static void saveConfig(ConfigKey key, String value, Context context) { |
| | | saveConfig(key.name(), value, context); |
| | | } |
| | | |
| | | public static String getConfig(ConfigKey key, Context context) { |
| | | return getConfig(key.name(), context); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.yeshi.makemoney.video.app.utils; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.bytedance.sdk.dp.DPSdk; |
| | | import com.bytedance.sdk.dp.DPUpdate; |
| | | import com.demo.library_ad.AdUtil; |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | | |
| | | public class SettingUtil { |
| | | |
| | | public enum SettingKey { |
| | | //推送免打扰 |
| | | pushUnDisturb(false), |
| | | //广告推荐 |
| | | adRecommend(true), |
| | | //内容推荐 |
| | | contentRecommend(true); |
| | | |
| | | private boolean defaultValue; |
| | | |
| | | private SettingKey(boolean defaultValue) { |
| | | this.defaultValue = defaultValue; |
| | | } |
| | | |
| | | public boolean isDefaultValue() { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void saveSetting(SettingKey key, boolean value, Context context) { |
| | | SharedPreferences.Editor editor = context.getSharedPreferences("settings", Context.MODE_PRIVATE).edit(); |
| | | editor.putBoolean(key.name(), value); |
| | | editor.commit(); |
| | | initSetting(key, value, context); |
| | | } |
| | | |
| | | //初始化设置,在应用初始化完成后调用 |
| | | public static void initSettings(Context context) { |
| | | for (SettingKey key : SettingKey.values()) { |
| | | boolean value = getSetting(key, context); |
| | | initSetting(key, value, context); |
| | | } |
| | | } |
| | | |
| | | private static void initSetting(SettingKey key, boolean value, Context context) { |
| | | if (key == SettingKey.adRecommend) { |
| | | AdUtil.setPersonalRecommend(value); |
| | | } else if (key == SettingKey.contentRecommend) { |
| | | //穿山甲内容个性化 |
| | | DPUpdate.setPersonalRec(value); |
| | | } else if (key == SettingKey.pushUnDisturb) { |
| | | if (value) { |
| | | JPushInterface.setSilenceTime(context, 21, 0, 9, 0); |
| | | } else { |
| | | JPushInterface.setSilenceTime(context, 0, 0, 0, 1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static boolean getSetting(SettingKey key, Context context) { |
| | | SharedPreferences share = context.getSharedPreferences("settings", Context.MODE_PRIVATE); |
| | | return share.getBoolean(key.name(), key.isDefaultValue()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | public static void getConfig(Context context, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | commonPostWithFailture(context, BASE_URL + "xxx/xxx", params, handler); |
| | | commonPostWithFailture(context, BASE_URL + "config/getConfig", params, handler); |
| | | } |
| | | |
| | | |
| | |
| | | import com.yeshi.makemoney.video.app.entity.goldcorn.GoldCornTaskInfo; |
| | | import com.yeshi.makemoney.video.app.ui.dialog.GoldCornDoubleDialog; |
| | | import com.yeshi.makemoney.video.app.ui.subview.CircleProgressView; |
| | | import com.yeshi.makemoney.video.app.utils.AppConfigUtil; |
| | | import com.yeshi.makemoney.video.app.utils.UserUtil; |
| | | import com.yeshi.makemoney.video.app.utils.api.BasicTextHttpResponseHandler; |
| | | import com.yeshi.makemoney.video.app.utils.api.HttpApiUtil; |
| | |
| | | return; |
| | | } |
| | | |
| | | //TODO 去看广告 |
| | | LoadingDialogUtil.show(mActivity); |
| | | RewardAdUtil.loadAD(AdUtil.AD_TYPE.csj, "948550219", mActivity, new RewardAdUtil.RewardAdListener() { |
| | | AdUtil.AD_TYPE type = AdUtil.getAdType(mContext, "rewardAd"); |
| | | if (type == null) { |
| | | Toast.makeText(mContext, "广告配置文件加载失败,请稍后再试", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | String pid = null; |
| | | if (type == AdUtil.AD_TYPE.csj) { |
| | | pid = mContext.getResources().getString(R.string.ad_csj_pid_reward); |
| | | } else { |
| | | pid = mContext.getResources().getString(R.string.ad_gdt_pid_reward); |
| | | } |
| | | |
| | | |
| | | RewardAdUtil.loadAD(type, pid, mActivity, new RewardAdUtil.RewardAdListener() { |
| | | @Override |
| | | public void onADLoad() { |
| | | Log.i(TAG, "onADLoad"); |
| | |
| | | public void onReward() { |
| | | Log.i(TAG, "onReward"); |
| | | reward = true; |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | resetDubleTimer(); |
| | | VideoGoldCornUtil.setVideoPlayCircle(leftCircle, mContext); |
| | | setTotalGoldCornText(oldCircle, leftCircle); |
| | | //弹框消失 |
| | | if (mDialog != null) { |
| | | DialogUtil.dismiss(mDialog); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | <string name="umeng_key">625d3bd430a4f67780a84e5c</string> |
| | | <string name="wx_app_id">wx123123</string> |
| | | |
| | | <string name="ad_gdt_appid"></string> |
| | | <string name="ad_gdt_appid">1200542155</string> |
| | | <string name="ad_csj_appid">5290972</string> |
| | | |
| | | |
| | | <!--开屏广告 --> |
| | | <string name="ad_csj_pid_splash"></string> |
| | | <string name="ad_csj_pid_splash">887773595</string> |
| | | |
| | | <!--开屏广告 --> |
| | | <string name="ad_gdt_pid_splash"></string> |
| | | <string name="ad_gdt_pid_splash">8083637453353404</string> |
| | | |
| | | <!--激励视频广告 --> |
| | | <string name="ad_csj_pid_reward">948550219</string> |
| | | <string name="ad_gdt_pid_reward">8003432463255488</string> |
| | | |
| | | <string name="webview_java_interface_name">yestv</string> |
| | | </resources> |
| | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.bytedance.sdk.openadsdk.TTAdConfig; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.demo.lib.common.util.common.StringUtils; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.qq.e.comm.managers.GDTAdSdk; |
| | | import com.qq.e.comm.managers.setting.GlobalSetting; |
| | | |
| | | import org.json.JSONArray; |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class AdUtil { |
| | | |
| | |
| | | String config = share.getString("config", ""); |
| | | if (!StringUtils.isEmpty(config)) {//万一没设置起就用广点通 |
| | | try { |
| | | Type type = new TypeToken<List<TypeProbability>>() { |
| | | }.getType(); |
| | | |
| | | JSONObject object = new JSONObject(config); |
| | | return AD_TYPE.valueOf(object.optJSONObject(positionName).optString("type")); |
| | | JSONArray array = object.optJSONArray(positionName); |
| | | if (array == null) { |
| | | return null; |
| | | } |
| | | List<TypeProbability> typeList = new Gson().fromJson(array.toString(), type); |
| | | int count = 0; |
| | | Map<AD_TYPE, int[]> map = new HashMap<>(); |
| | | for (TypeProbability probability : typeList) { |
| | | int olcCount = count; |
| | | count += probability.getWeight(); |
| | | map.put(probability.getType(), new int[]{olcCount, count}); |
| | | } |
| | | int random = (int) (Math.random() * count); |
| | | |
| | | for (Iterator<AD_TYPE> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | AD_TYPE t = its.next(); |
| | | int[] space = map.get(t); |
| | | if (space[0] <= random && random < space[1]) { |
| | | return t; |
| | | } |
| | | } |
| | | return null; |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e1) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置个性化推荐广告 |
| | | * |
| | | * @param recommend |
| | | */ |
| | | public static void setPersonalRecommend(boolean recommend) { |
| | | setPersonalRecommendCSJ(recommend); |
| | | //广点通个性化广告关闭 |
| | | GlobalSetting.setPersonalizedState(recommend ? 0 : 1); |
| | | } |
| | | |
| | | //穿山甲 |
| | | private static void setPersonalRecommendCSJ(boolean recommend) { |
| | | String content = ""; |
| | | try { |
| | | JSONArray jsonArray = new JSONArray(); |
| | | JSONObject personalObject = new JSONObject(); |
| | | personalObject.put("name", "personal_ads_type"); |
| | | personalObject.put("value", recommend ? "1" : "0"); |
| | | jsonArray.put(personalObject); |
| | | content = jsonArray.toString(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | TTAdConfig ttAdConfig = new TTAdConfig.Builder() |
| | | .data(content) |
| | | .build(); |
| | | TTAdSdk.updateAdConfig(ttAdConfig); |
| | | } |
| | | |
| | | |
| | | class TypeProbability { |
| | | AD_TYPE type; |
| | | int weight; |
| | | |
| | | public AD_TYPE getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(AD_TYPE type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public int getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(int weight) { |
| | | this.weight = weight; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | api 'com.github.youlookwhat:ByRecyclerView:1.3.0' |
| | | |
| | | api 'org.greenrobot:eventbus:3.1.1' |
| | | |
| | | } |
| | | |
| | | android { |
| | |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("flutter", Context.MODE_PRIVATE); |
| | | result.success(sharedPreferences.getString("adConfig", "")); |
| | | break; |
| | | case "getConfig": { |
| | | String key = call.arguments + ""; |
| | | String value = dataListener.getConfig(key); |
| | | result.success(value); |
| | | } |
| | | break; |
| | | |
| | | case "getSetting": { |
| | | String key = call.arguments + ""; |
| | | Boolean value = dataListener.getSetting(key); |
| | | result.success(value); |
| | | } |
| | | break; |
| | | |
| | | case "setSetting": { |
| | | Map<String, Object> params = (Map<String, Object>) call.arguments; |
| | | String key = params.get("key") + ""; |
| | | boolean value = (Boolean) params.get("value"); |
| | | dataListener.setSetting(key, value); |
| | | result.success(true); |
| | | } |
| | | break; |
| | | |
| | | case "getBaseRequestParams": |
| | | //获取请求参数 |
| | | Map<String, String> params = (Map<String, String>) call.arguments; |
| | |
| | | |
| | | public interface DataListener { |
| | | public Map<String, String> getBaseRequestParams(Map<String, String> params); |
| | | |
| | | public String getConfig(String key); |
| | | |
| | | //获取设置 |
| | | public Boolean getSetting(String key); |
| | | |
| | | //设置 |
| | | public void setSetting(String key, boolean b); |
| | | } |
| | | } |
| | |
| | | params["uid"] = uid; |
| | | } |
| | | var result = await HttpUtil.baseRequest( |
| | | context, "/api/v1/goldcorn/getSignInInfo", params, () { |
| | | }); |
| | | context, "/api/v1/goldcorn/getSignInInfo", params, () {}); |
| | | if (result.success) { |
| | | return result.data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | ///签到 |
| | | static Future<Map<String, dynamic>?> signIn(BuildContext context) async { |
| | | Map<String, dynamic> params = {}; |
| | | params["uid"] = await UserUtil.getUid(); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | ///设置签到提醒 |
| | | static Future<Map<String, dynamic>?> setSignInNotify( |
| | | BuildContext context, bool notify) async { |
| | | Map<String, dynamic> params = {}; |
| | | params["uid"] = await UserUtil.getUid(); |
| | | params["notify"] = notify; |
| | | var result = await HttpUtil.baseRequest( |
| | | context, "/api/v1/goldcorn/setSignInNotify", params, () {}); |
| | | if (result.success) { |
| | | return result.data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | ///获取任务列表 |
| | | static Future<Map<String, dynamic>?> getTaskList(BuildContext context) async { |
| | | Map<String, dynamic> params = {}; |
| | | var uid = await UserUtil.getUid(); |
| | | if (uid != null) { |
| | | params["uid"] = uid; |
| | | } |
| | | var result = await HttpUtil.baseRequest( |
| | | context, "/api/v1/goldcorn/getTaskList", params, () {}); |
| | | if (result.success) { |
| | | return result.data; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | ///登录 |
| | | static Future<Map<String, dynamic>?> loginByWX( |
| | | BuildContext context, String code) async { |
| | | Map<String, dynamic> params = {}; |
| | | params["code"] = code; |
| | | |
| | | var result = |
| | | await HttpUtil.baseRequest(context, "/api/v1/user/loginWX", params, () { |
| | | showLoading(context); |
| | | }, notifyError: true); |
| | | dismissDialog(context); |
| | | if (result.success) { |
| | | return result.data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | static Future<Map<String, dynamic>?> loginByEmail( |
| | | BuildContext context, String email, String pwd) async { |
| | | Map<String, dynamic> params = {}; |
| | |
| | | return null; |
| | | } |
| | | |
| | | ///绑定微信 |
| | | static Future<Map<String, dynamic>?> bindWX( |
| | | BuildContext context, String code) async { |
| | | Map<String, dynamic> params = {}; |
| | | params["code"] = code; |
| | | params["uid"] = await UserUtil.getUid(); |
| | | var result = |
| | | await HttpUtil.baseRequest(context, "/api/v1/user/bindWX", params, () { |
| | | showLoading(context); |
| | | }, notifyError: true); |
| | | dismissDialog(context); |
| | | if (result.success) { |
| | | return result.data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | ///绑定电话 |
| | | static Future<Map<String, dynamic>?> bindPhone( |
| | | BuildContext context, String? phone, String? vcode, String? token) async { |
| | | Map<String, dynamic> params = {}; |
| | | if (phone != null) { |
| | | params["phone"] = phone; |
| | | } |
| | | |
| | | if (vcode != null) { |
| | | params["vcode"] = vcode; |
| | | } |
| | | |
| | | if (token != null) { |
| | | params["token"] = token; |
| | | } |
| | | |
| | | params["uid"] = await UserUtil.getUid(); |
| | | var result = await HttpUtil.baseRequest( |
| | | context, "/api/v1/user/bindPhone", params, () { |
| | | showLoading(context); |
| | | }, notifyError: true); |
| | | dismissDialog(context); |
| | | if (result.success) { |
| | | return result.data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | ///获取用户信息 |
| | | static Future<Map<String, dynamic>?> getUserInfo( |
| | | BuildContext context, String uid) async { |
| | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:makemoney/ui/widget/ad_express.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | | import 'package:makemoney/utils/ui_utils.dart'; |
| | | import 'mine.dart'; |
| | |
| | | backgroundColor: Colors.transparent, |
| | | body: Container( |
| | | padding: EdgeInsets.all(20), |
| | | child: MyFillButton( |
| | | "测试点击", |
| | | 10, |
| | | height: 50, |
| | | onClick: () { |
| | | ToastUtil.toast("测试", context); |
| | | }, |
| | | ), |
| | | child: DrawVideoWidget("123456"), |
| | | )); |
| | | } |
| | | } |
| | |
| | | import 'package:flutter/services.dart'; |
| | | import 'package:flutter_boost/flutter_boost.dart'; |
| | | import 'package:makemoney/home.dart'; |
| | | import 'package:makemoney/ui/mine/msg.dart'; |
| | | import 'package:makemoney/ui/mine/my_boss.dart'; |
| | | import 'package:makemoney/utils/share_preference.dart'; |
| | | import 'package:makemoney/utils/ui_constant.dart'; |
| | |
| | | |
| | | void _runLocal() { |
| | | runApp(getBasePage( |
| | | TaskPage(title: ""), |
| | | MinePage( |
| | | title: "", |
| | | ), |
| | | )); |
| | | } |
| | | |
| | |
| | | )); |
| | | }, |
| | | |
| | | "MsgPage": (RouteSettings settings, String? uniqueId) { |
| | | return _getSimpleRoute( |
| | | settings, |
| | | uniqueId, |
| | | MsgPage( |
| | | title: "", |
| | | )); |
| | | }, |
| | | |
| | | 'BrowserPage': (RouteSettings settings, String? uniqueId) { |
| | | if (settings.arguments == null) { |
| | | return null; |
| | |
| | | return MaterialApp( |
| | | home: home, |
| | | debugShowCheckedModeBanner: true, |
| | | theme: ThemeData(primaryColor: ColorConstant.theme), |
| | | |
| | | ///必须加上builder参数,否则showDialog等会出问题 |
| | | builder: (_, __) { |
| | |
| | | { |
| | | return TaskPage(title: ""); |
| | | } |
| | | case "MsgPage": |
| | | { |
| | | return MsgPage(title: ""); |
| | | } |
| | | } |
| | | |
| | | return Container(); |
| | |
| | | import 'package:makemoney/api/user_api.dart'; |
| | | import 'package:makemoney/model/team/team_info_model.dart'; |
| | | import 'package:makemoney/ui/widget/ad_express.dart'; |
| | | import 'package:makemoney/utils/config_util.dart'; |
| | | import 'package:makemoney/utils/ui_utils.dart'; |
| | | import 'package:share_plus/share_plus.dart'; |
| | | |
| | |
| | | _teamInfoModel == null |
| | | ? 0 |
| | | : _teamInfoModel!.firstTeamCount!, |
| | | "直接队员", () { |
| | | "队员", () { |
| | | jumpPage("TeamPage", params: {"first": true}); |
| | | }), |
| | | // const SizedBox( |
| | | // width: 35, |
| | | // ), |
| | | // userContent( |
| | | // _teamInfoModel == null |
| | | // ? 0 |
| | | // : _teamInfoModel!.secondTeamCount!, |
| | | // "间接队员", () { |
| | | // jumpPage("TeamPage", |
| | | // params: {"first": false}); |
| | | // }), |
| | | const SizedBox( |
| | | width: 35, |
| | | ), |
| | | userContent( |
| | | _teamInfoModel == null |
| | | ? 0 |
| | | : _teamInfoModel!.secondTeamCount!, |
| | | "间接队员", () { |
| | | jumpPage("TeamPage", |
| | | params: {"first": false}); |
| | | }), |
| | | const SizedBox( |
| | | width: 35, |
| | | ), |
| | | userContent(msgCount, "消息", () {}, |
| | | userContent(msgCount, "消息", () { |
| | | jumpPage("MsgPage"); |
| | | }, |
| | | color: msgCount > 0 |
| | | ? COLOR_HIGHLIGHT |
| | | : COLOR_CONTENT), |
| | |
| | | "assets/imgs/mine/ic_fun_help.png", |
| | | "帮助中心", |
| | | 27, () { |
| | | jumpPage("AdvicePage", needLogin: false); |
| | | ConfigUtil.getConfig(context, "helpLink") |
| | | .then((value) { |
| | | jumpPage("BrowserPage", |
| | | params: { |
| | | "url": value, |
| | | "title": "帮助中心" |
| | | }, |
| | | needLogin: false); |
| | | }); |
| | | }), |
| | | functionWidget( |
| | | "assets/imgs/mine/ic_fun_kefu.png", |
| | | "在线客服", |
| | | 28.5, () { |
| | | MySharedPreferences.getInstance() |
| | | .getString("contactUsLink") |
| | | ConfigUtil.getConfig(context, "kefu") |
| | | .then((value) { |
| | | if (!StringUtil.isNullOrEmpty(value)) { |
| | | jumpPage("BrowserPage", |
| | | params: { |
| | | "url": value, |
| | | "title": "在线客服" |
| | | }, |
| | | needLogin: false); |
| | | } |
| | | jumpPage("BrowserPage", |
| | | params: {"url": value, "title": "客服"}, |
| | | needLogin: false); |
| | | }); |
| | | }), |
| | | functionWidget( |
| | |
| | | _BrowserPageState createState() => _BrowserPageState(title, url); |
| | | } |
| | | |
| | | class _BrowserPageState extends State<BrowserPage> |
| | | with SingleTickerProviderStateMixin { |
| | | class _BrowserPageState extends State<BrowserPage> { |
| | | String title = ""; |
| | | String? url; |
| | | double progress = 0; |
| | |
| | | void initState() { |
| | | super.initState(); |
| | | if (Platform.isAndroid) { |
| | | WebView.platform = SurfaceAndroidWebView(); |
| | | WebView.platform = AndroidWebView(); |
| | | } |
| | | } |
| | | |
| | |
| | | back: () { |
| | | _back(); |
| | | }, |
| | | rightIcon: const Icon(Icons.refresh,size: 30,), |
| | | rightClick: (){ |
| | | if(_webViewController!=null){ |
| | | leftWidget: const Padding( |
| | | padding: EdgeInsets.only(left: 5, right: 10), |
| | | child: Icon( |
| | | Icons.close_rounded, |
| | | size: 30, |
| | | )), |
| | | leftWidgetClick: () { |
| | | popPage(context); |
| | | }, |
| | | rightIcon: const Icon( |
| | | Icons.refresh, |
| | | size: 30, |
| | | ), |
| | | rightClick: () { |
| | | if (_webViewController != null) { |
| | | _webViewController!.reload(); |
| | | } |
| | | }, |
| | |
| | | height: 1, |
| | | child: LinearProgressIndicator( |
| | | backgroundColor: Colors.white, |
| | | valueColor: const AlwaysStoppedAnimation(ColorConstant.theme), |
| | | valueColor: |
| | | const AlwaysStoppedAnimation(ColorConstant.theme), |
| | | value: progress, |
| | | ), |
| | | ), |
| | | Expanded( |
| | | child: WebView( |
| | | //http://192.168.3.122:8848/test/JsTest.html |
| | | initialUrl:url, |
| | | initialUrl: url, |
| | | onWebViewCreated: (WebViewController webViewController) { |
| | | _webViewController = webViewController; |
| | | }, |
| | |
| | | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:makemoney/api/http.dart'; |
| | | import 'package:makemoney/api/team_api.dart'; |
| | | import 'package:makemoney/model/user/user_info.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | |
| | | import 'package:makemoney/utils/ui_utils.dart'; |
| | | import '../../utils/ui_constant.dart'; |
| | | import '../../ui/widget/nav.dart'; |
| | | import 'package:pin_code_fields/pin_code_fields.dart'; |
| | | import '../../utils/pageutils.dart'; |
| | | |
| | | import 'advice_submit.dart'; |
| | |
| | | |
| | | class _AddTeamPageState extends State<AddTeamPage> |
| | | with SingleTickerProviderStateMixin { |
| | | final VerificationBoxController _controller = VerificationBoxController(); |
| | | final TextEditingController _controller = TextEditingController(); |
| | | |
| | | @override |
| | | void initState() { |
| | | super.initState(); |
| | | _controller.text = "123123"; |
| | | } |
| | | |
| | | BoxDecoration getItemDecoration(Color bgColor, Color shadowColor) { |
| | |
| | | ]); |
| | | } |
| | | |
| | | double? itemWidth; |
| | | |
| | | @override |
| | | Widget build(BuildContext context) { |
| | | itemWidth = itemWidth ?? |
| | | (MediaQuery.of(context).size.width - 60 * 2 - 10 * 5 - 1) / 6; |
| | | |
| | | return Scaffold( |
| | | resizeToAvoidBottomInset: false, |
| | | backgroundColor: Color(0xFFFFFFFF), |
| | | resizeToAvoidBottomInset: true, |
| | | backgroundColor: const Color(0xFFFFFFFF), |
| | | body: Flex( |
| | | direction: Axis.vertical, |
| | | children: [ |
| | |
| | | TextSpan(text: "金币。"), |
| | | ]), |
| | | textAlign: TextAlign.center, |
| | | style: TextStyle(fontSize: 13, color: ColorConstant.theme), |
| | | style: TextStyle( |
| | | fontSize: 13, |
| | | color: ColorConstant.theme, |
| | | fontWeight: FontWeight.bold), |
| | | ), |
| | | SizedBox( |
| | | const SizedBox( |
| | | height: 40, |
| | | ), |
| | | Container( |
| | | alignment: Alignment.center, |
| | | child: VerificationBox(6, _controller)), |
| | | SizedBox( |
| | | child: |
| | | |
| | | // VerificationBox( |
| | | // 6, |
| | | // _controller, |
| | | // width: MediaQuery.of(context).size.width - 60 * 2, |
| | | // ) |
| | | PinCodeTextField( |
| | | appContext: context, |
| | | length: 6, |
| | | obscureText: false, |
| | | animationType: AnimationType.fade, |
| | | textStyle: const TextStyle( |
| | | color: ColorConstant.theme, |
| | | fontSize: 24, |
| | | fontWeight: FontWeight.bold), |
| | | cursorColor: ColorConstant.theme, |
| | | controller: _controller, |
| | | pinTheme: PinTheme( |
| | | activeColor: Colors.transparent, |
| | | selectedColor: Colors.transparent, |
| | | inactiveColor: Colors.transparent, |
| | | inactiveFillColor: const Color(0xFFEFEFEF), |
| | | activeFillColor: const Color(0xFFEFEFEF), |
| | | selectedFillColor: const Color(0xFFEFEFEF), |
| | | shape: PinCodeFieldShape.box, |
| | | borderRadius: BorderRadius.circular(13), |
| | | fieldHeight: itemWidth! * 1.25, |
| | | fieldWidth: itemWidth, |
| | | borderWidth: 0, |
| | | ), |
| | | animationDuration: const Duration(milliseconds: 100), |
| | | backgroundColor: Colors.transparent, |
| | | enableActiveFill: true, |
| | | onCompleted: (v) { |
| | | print("Completed"); |
| | | }, |
| | | onChanged: (value) { |
| | | print(value); |
| | | setState(() { |
| | | // currentText = value; |
| | | }); |
| | | }, |
| | | beforeTextPaste: (text) { |
| | | print("Allowing to paste $text"); |
| | | //if you return true then it will show the paste confirmation dialog. Otherwise if false, then nothing will happen. |
| | | //but you can show anything you want here, like your pop up saying wrong paste format or etc |
| | | return true; |
| | | }, |
| | | )), |
| | | const SizedBox( |
| | | height: 46, |
| | | ), |
| | | MyFillButton( |
| | |
| | | height: 42, |
| | | fontSize: 15, |
| | | onClick: () { |
| | | print("内容:${_controller.text}"); |
| | | |
| | | if (_controller.text.length < 6) { |
| | | return; |
| | | } |
| | | TeamApiUtil.getUserByInviteCode(context, _controller.text) |
| | | .then((value) { |
| | | if (value == null) { |
| | |
| | | alignment: Alignment.center, |
| | | child: Container( |
| | | width: dialogWidth, |
| | | height: 240, |
| | | height: 350, |
| | | child: Stack(children: [ |
| | | Container( |
| | | margin: const EdgeInsets.only(top: 30), |
| | | margin: const EdgeInsets.only(top: 30, bottom: 110), |
| | | decoration: const BoxDecoration( |
| | | borderRadius: BorderRadius.all(Radius.circular(15)), |
| | | color: Colors.white), |
| | | alignment: Alignment.topCenter, |
| | | ), |
| | | Padding( |
| | | padding: EdgeInsets.only(left: 10, right: 10), |
| | | padding: const EdgeInsets.only(left: 10, right: 10), |
| | | child: Column( |
| | | mainAxisAlignment: MainAxisAlignment.start, |
| | | crossAxisAlignment: CrossAxisAlignment.center, |
| | |
| | | fontWeight: FontWeight.bold), |
| | | ), |
| | | //内容 |
| | | SizedBox( |
| | | const SizedBox( |
| | | height: 15, |
| | | ), |
| | | const Text( |
| | |
| | | fontSize: 18, |
| | | fontWeight: FontWeight.bold), |
| | | ), |
| | | SizedBox( |
| | | const SizedBox( |
| | | height: 35, |
| | | ), |
| | | //------按钮区域-------- |
| | |
| | | } |
| | | }); |
| | | }, |
| | | ), |
| | | const SizedBox( |
| | | height: 28, |
| | | ), |
| | | InkWell( |
| | | onTap: () { |
| | | dismissDialog(context); |
| | | }, |
| | | child: Image.asset( |
| | | "assets/imgs/common/icon_dialog_close.png", |
| | | height: 30, |
| | | ), |
| | | ) |
| | | ], |
| | | )) |
| | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:makemoney/api/extract_api.dart'; |
| | | import 'package:makemoney/api/user_api.dart'; |
| | | import 'package:makemoney/model/user/extract_money_model.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | | import 'package:makemoney/ui/widget/dialog.dart'; |
| | | import 'package:makemoney/utils/ui_constant.dart'; |
| | | import 'package:makemoney/utils/ui_utils.dart'; |
| | | import 'package:makemoney/utils/wx_util.dart'; |
| | | |
| | | import '../../ui/widget/nav.dart'; |
| | | |
| | |
| | | @override |
| | | void initState() { |
| | | super.initState(); |
| | | WXAuthUtil.init(context, (s) { |
| | | UserApiUtil.bindWX(context, s).then((value) { |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | if (value["code"] == 0) { |
| | | ToastUtil.toast("微信绑定成功", context); |
| | | _getExtractInfo(); |
| | | return; |
| | | } |
| | | ToastUtil.toast(value["msg"], context); |
| | | }); |
| | | }); |
| | | _getExtractInfo(); |
| | | _getExtractDenominationList(); |
| | | } |
| | |
| | | Image.asset( |
| | | "assets/imgs/mine/ic_balance_bg.png"), |
| | | Container( |
| | | margin: EdgeInsets.only( |
| | | margin: const EdgeInsets.only( |
| | | left: 20, top: 14, bottom: 10), |
| | | child: Column( |
| | | crossAxisAlignment: |
| | |
| | | color: Colors.white, |
| | | fontSize: 12), |
| | | ), |
| | | SizedBox( |
| | | const SizedBox( |
| | | height: 5, |
| | | ), |
| | | Text.rich(TextSpan( |
| | |
| | | //绑定微信 |
| | | !_needBindWX |
| | | ? Container() |
| | | : Container( |
| | | padding: const EdgeInsets.fromLTRB(13, 10, 5, 10), |
| | | margin: const EdgeInsets.only(top: 12), |
| | | decoration: BoxDecoration( |
| | | borderRadius: BorderRadius.circular(13), |
| | | color: Colors.white), |
| | | child: Row( |
| | | children: [ |
| | | Image.asset( |
| | | "assets/imgs/mine/icon_balance_wx.png", |
| | | height: 34, |
| | | ), |
| | | const SizedBox( |
| | | width: 12.5, |
| | | ), |
| | | const Text("绑定微信", |
| | | style: TextStyle( |
| | | color: Colors.black, fontSize: 15)), |
| | | Expanded(child: Container()), |
| | | const Text("去绑定", |
| | | style: TextStyle( |
| | | color: Color(0xFF333333), |
| | | fontSize: 11)), |
| | | const Icon( |
| | | Icons.chevron_right, |
| | | size: 30, |
| | | color: Color(0xff2222222), |
| | | ) |
| | | ], |
| | | ), |
| | | ), |
| | | : InkWell( |
| | | onTap: () { |
| | | WXAuthUtil.startAuth(context); |
| | | }, |
| | | child: Container( |
| | | padding: |
| | | const EdgeInsets.fromLTRB(13, 10, 5, 10), |
| | | margin: const EdgeInsets.only(top: 12), |
| | | decoration: BoxDecoration( |
| | | borderRadius: BorderRadius.circular(13), |
| | | color: Colors.white), |
| | | child: Row( |
| | | children: [ |
| | | Image.asset( |
| | | "assets/imgs/mine/icon_balance_wx.png", |
| | | height: 34, |
| | | ), |
| | | const SizedBox( |
| | | width: 12.5, |
| | | ), |
| | | const Text("绑定微信", |
| | | style: TextStyle( |
| | | color: Colors.black, fontSize: 15)), |
| | | Expanded(child: Container()), |
| | | const Text("去绑定", |
| | | style: TextStyle( |
| | | color: Color(0xFF333333), |
| | | fontSize: 11)), |
| | | const Icon( |
| | | Icons.chevron_right, |
| | | size: 30, |
| | | color: Color(0xff2222222), |
| | | ) |
| | | ], |
| | | ), |
| | | )), |
| | | const SizedBox( |
| | | height: 12, |
| | | ), |
| | |
| | | topLeft: Radius.circular(13), |
| | | topRight: Radius.circular(13)), |
| | | )), |
| | | Padding( |
| | | padding: EdgeInsets.only( |
| | | bottom: DimenUtil.getOnePixel(context)), |
| | | child: Row( |
| | | children: [ |
| | | Expanded(flex: 1, child: getNavItem("金币记录", 0)), |
| | | Expanded(flex: 1, child: getNavItem("折算记录", 1)), |
| | | ], |
| | | )) |
| | | Padding(padding:const EdgeInsets.only(bottom:0), child: |
| | | Row( |
| | | children: [ |
| | | Expanded(flex: 1, child: getNavItem("金币记录", 0)), |
| | | Expanded(flex: 1, child: getNavItem("折算记录", 1)), |
| | | ], |
| | | )) |
| | | ]), |
| | | Expanded( |
| | | child: Container( |
| | |
| | | topRight: Radius.circular(13)), |
| | | boxShadow: [ |
| | | BoxShadow( |
| | | color: Color(0xFF989898), |
| | | color: const Color(0x80989898), |
| | | offset: Offset((index == 0 ? 2 : -2), 0)) |
| | | ]) |
| | | : null, |
| | |
| | | |
| | | _refreshController.refreshCompleted(); |
| | | _refreshController.loadComplete(); |
| | | |
| | | if (result == null && _page == 1&&_recordList.isEmpty) { |
| | | _refreshController.apiError!(); |
| | | } |
| | | |
| | | if (result == null || result["code"] != 0) { |
| | | //页码回滚 |
| | | if (_page > 1) { |
| | |
| | | onTap(); |
| | | }, |
| | | child: Padding( |
| | | padding: const EdgeInsets.only(top: 20, left: 16, right: 16, bottom: 5), |
| | | padding: |
| | | const EdgeInsets.only(top: 20, left: 16, right: 16, bottom: 5), |
| | | child: Row( |
| | | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| | | crossAxisAlignment: CrossAxisAlignment.center, |
| | |
| | | "assets/imgs/mine/ic_invite_friends_bg.png", |
| | | width: MediaQuery.of(context).size.width)), |
| | | Padding( |
| | | padding: EdgeInsets.only(top: 10), |
| | | padding: const EdgeInsets.only(top: 30), |
| | | child: SizedBox( |
| | | height: 0.7466 * |
| | | MediaQuery.of(context).size.width * |
| | |
| | | import 'package:flutter/services.dart'; |
| | | import 'package:fluwx_no_pay/fluwx_no_pay.dart' as fluwx; |
| | | import 'package:makemoney/ui/mine/add_team.dart'; |
| | | import 'package:makemoney/utils/config_util.dart'; |
| | | import 'package:makemoney/utils/wx_util.dart'; |
| | | import '../../api/user_api.dart'; |
| | | import 'package:html/dom.dart' as dom; |
| | | import '../../api/http.dart'; |
| | |
| | | import '../../utils/user_util.dart'; |
| | | import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart'; |
| | | import '../widget/nav.dart'; |
| | | import 'add_team.dart'; |
| | | |
| | | class LoginPage extends StatefulWidget { |
| | | //阿里云一键登录 |
| | |
| | | TextEditingController? phoneController = TextEditingController(); |
| | | TextEditingController? codeController = TextEditingController(); |
| | | String phone = ""; |
| | | String code = ""; |
| | | Timer? timer; |
| | | |
| | | //重新发送验证码倒计时 |
| | |
| | | @override |
| | | void initState() { |
| | | super.initState(); |
| | | fluwx |
| | | .registerWxApi( |
| | | appId: "wx420b62b9213e0fc9", |
| | | universalLink: "https://your.univerallink.com/link/") |
| | | .then((value) { |
| | | print("微信初始化完成:$value"); |
| | | fluwx.weChatResponseEventHandler.listen((res) { |
| | | print("微信回调:${res.errCode} - ${res.errStr}"); |
| | | if (res is fluwx.WeChatAuthResponse) { |
| | | fluwx.WeChatAuthResponse response = res; |
| | | print("微信授权结束:${response.code}"); |
| | | } |
| | | }); |
| | | |
| | | WXAuthUtil.init(context, (s) { |
| | | _loginWX(s); |
| | | }); |
| | | |
| | | if (widget.bindPhone) { |
| | | wxLogin = false; |
| | | } |
| | | |
| | | reSendSMSTimeLeft = -1; |
| | | //初始化微信登录监听 |
| | | fluwx.weChatResponseEventHandler.distinct((a, b) => a == b).listen((res) { |
| | | if (res is fluwx.WeChatAuthResponse) { |
| | | int errCode = res.errCode; |
| | | if (errCode == 0) { |
| | | String? code = res.code; |
| | | //TODO 把微信登录返回的code传给后台,剩下的事就交给后台处理 |
| | | } else if (errCode == -4) { |
| | | //showToast("用户拒绝授权"); |
| | | } else if (errCode == -2) { |
| | | // showToast("用户取消授权"); |
| | | } |
| | | } |
| | | |
| | | void _loginWX(code) { |
| | | UserApiUtil.loginByWX(context, code).then((value) { |
| | | if (value!["code"] == 0) { |
| | | UserInfo user = UserInfo.fromJson(value["data"]); |
| | | _loginSuccess(user); |
| | | } else { |
| | | ToastUtil.toast(value["msg"], context); |
| | | } |
| | | }); |
| | | } |
| | |
| | | : Container() |
| | | ]))), |
| | | //用户协议与隐私政策 |
| | | Row(children: [ |
| | | Container( |
| | | width: 25, |
| | | ), |
| | | Row( mainAxisAlignment: MainAxisAlignment.center, children: [ |
| | | |
| | | RoundCheckBox( |
| | | value: checked, |
| | | onChanged: (value) { |
| | |
| | | }); |
| | | }, |
| | | ), |
| | | Expanded( |
| | | child: HtmlWidget( |
| | | "<p>登录即表明同意 <a href='${Constant.PROTOCOL_URL}'>用户协议</a> 和 <a href='${Constant.PRIVACY_URL}'>隐私政策</a> </p>", |
| | | HtmlWidget( |
| | | "<p>${widget.bindPhone ? "绑定" : "登录"}即表明同意 <a href='${Constant.PROTOCOL_URL}'>用户协议</a> 和 <a href='${Constant.PRIVACY_URL}'>隐私政策</a> </p>", |
| | | textStyle: const TextStyle(color: Color(0xFF999999)), |
| | | onTapUrl: (url) { |
| | | String? title = ""; |
| | |
| | | (data) {}); |
| | | |
| | | return true; |
| | | })), |
| | | }), |
| | | const SizedBox(width: 10,) |
| | | ]) |
| | | ]), |
| | | //关闭按钮 |
| | |
| | | width: 14, |
| | | ))), |
| | | InkWell( |
| | | onTap: () {}, |
| | | onTap: () { |
| | | ConfigUtil.getConfig(context, "helpLink") |
| | | .then((value) { |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | BrowserPage(title: "帮助中心", url: value), |
| | | (data) {}); |
| | | }); |
| | | }, |
| | | child: const Text( |
| | | "帮助", |
| | | style: TextStyle( |
| | |
| | | ? Column(mainAxisAlignment: MainAxisAlignment.center, children: [ |
| | | InkWell( |
| | | onTap: () { |
| | | print("微信授权登录开始"); |
| | | UserUtil.loginWX(); |
| | | if (!checked) { |
| | | ToastUtil.toast("请同意用户协议与隐私政策", context); |
| | | return; |
| | | } |
| | | |
| | | WXAuthUtil.startAuth(context); |
| | | }, |
| | | child: Container( |
| | | height: 42, |
| | |
| | | ), |
| | | Container(height: 35), |
| | | MyFillButton( |
| | | "登录", |
| | | 10, |
| | | widget.bindPhone ? "绑定手机号" : "登录", |
| | | 13, |
| | | height: 45, |
| | | color: const Color(0xFFFF2B4B), |
| | | fontSize: 17, |
| | |
| | | return; |
| | | } |
| | | |
| | | UserApiUtil.loginByPhone(context, phoneController!.value.text, |
| | | codeController!.value.text, "") |
| | | .then((value) { |
| | | print("结果: $value"); |
| | | if (value!["code"] == 0) { |
| | | UserInfo user = UserInfo.fromJson(value["data"]); |
| | | _loginSuccess(user); |
| | | } else { |
| | | ToastUtil.toast(value["msg"], context); |
| | | } |
| | | }); |
| | | if (widget.bindPhone) { |
| | | UserApiUtil.bindPhone(context, phoneController!.value.text, |
| | | codeController!.value.text, null) |
| | | .then((value) { |
| | | print("结果: $value"); |
| | | if (value!["code"] == 0) { |
| | | ToastUtil.toast("绑定成功", context); |
| | | popPage(context); |
| | | return; |
| | | } else { |
| | | ToastUtil.toast(value["msg"], context); |
| | | } |
| | | }); |
| | | } else { |
| | | UserApiUtil.loginByPhone( |
| | | context, |
| | | phoneController!.value.text, |
| | | codeController!.value.text, |
| | | "") |
| | | .then((value) { |
| | | print("结果: $value"); |
| | | if (value!["code"] == 0) { |
| | | UserInfo user = UserInfo.fromJson(value["data"]); |
| | | _loginSuccess(user); |
| | | } else { |
| | | ToastUtil.toast(value["msg"], context); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | ), |
| | | ], |
| | |
| | | } else if (name == "QQ登录") { |
| | | qqLogin(); |
| | | } else if (name == "微信登录") { |
| | | UserUtil.loginWX(); |
| | | WXAuthUtil.startAuth(context); |
| | | } |
| | | }, |
| | | child: Container( |
| | |
| | | import 'package:makemoney/ui/widget/images_widget.dart'; |
| | | import 'package:makemoney/utils/pageutils.dart'; |
| | | import 'package:makemoney/utils/string_util.dart'; |
| | | import 'package:makemoney/utils/wx_util.dart'; |
| | | |
| | | import '../../api/user_api.dart'; |
| | | import '../../model/user/user_info.dart'; |
| | |
| | | @override |
| | | void initState() { |
| | | super.initState(); |
| | | WXAuthUtil.init(context, (s) { |
| | | UserApiUtil.bindWX(context, s).then((value) { |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | if (value["code"] == 0) { |
| | | ToastUtil.toast("微信绑定成功", context); |
| | | getUserInfo(); |
| | | return; |
| | | } |
| | | ToastUtil.toast(value["msg"], context); |
| | | }); |
| | | }); |
| | | |
| | | getUserInfo(); |
| | | } |
| | | |
| | |
| | | ? "未添加" |
| | | : _user!.phone!, |
| | | onClick: () { |
| | | if (_user!.phone == null) { |
| | | if (StringUtil.isNullOrEmpty( |
| | | _user!.phone)) { |
| | | //手机号绑定 |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | |
| | | ? "去授权" |
| | | : _user!.wxNickName!, |
| | | onClick: () { |
| | | //TODO 微信授权 |
| | | if (!StringUtil.isNullOrEmpty( |
| | | _user!.wxNickName)) { |
| | | return; |
| | | } |
| | | WXAuthUtil.startAuth(context); |
| | | }, |
| | | canIn: StringUtil.isNullOrEmpty( |
| | | _user!.wxNickName)) |
| | |
| | | class _SettingPageState extends State<SettingPage> |
| | | with SingleTickerProviderStateMixin { |
| | | bool msg = false; |
| | | bool ad = false; |
| | | bool ad = true; |
| | | bool content = true; |
| | | bool login = false; |
| | | |
| | | String cacheSize = "0B"; |
| | |
| | | |
| | | SettingUtil.isEnablePush().then((value) { |
| | | setState(() { |
| | | msg = value; |
| | | msg = value!; |
| | | }); |
| | | }); |
| | | |
| | | SettingUtil.isEnableRecommendAd().then((value) { |
| | | ad = value; |
| | | setState(() { |
| | | ad = value!; |
| | | }); |
| | | }); |
| | | |
| | | SettingUtil.isEnableRecommendContent().then((value) { |
| | | setState(() { |
| | | content = value!; |
| | | }); |
| | | }); |
| | | } |
| | | |
| | |
| | | UserUtil.getUid(); |
| | | // popPage(context); |
| | | }); |
| | | |
| | | } else { |
| | | ToastUtil.toast(map["msg"], context); |
| | | } |
| | |
| | | content: "关闭后,内容数量将不变,但内容相关度会降低", |
| | | marginTop: 0, |
| | | marginBottom: 1, |
| | | checked: ad, |
| | | checked: content, |
| | | changed: (bool value) { |
| | | SettingUtil.setRecommendAd(value).then((value1) { |
| | | SettingUtil.setRecommendContent(value).then((value1) { |
| | | setState(() { |
| | | ad = value; |
| | | content = value; |
| | | }); |
| | | }); |
| | | }), |
| | |
| | | title: "账户注销", |
| | | content: "", |
| | | onClick: () { |
| | | |
| | | MySharedPreferences.getInstance().getString("unRegisterLink").then((value) { |
| | | MySharedPreferences.getInstance() |
| | | .getString("unRegisterLink") |
| | | .then((value) { |
| | | if (!StringUtil.isNullOrEmpty(value)) { |
| | | NavigatorUtil.navigateToNextPage(context, |
| | | BrowserPage(title: "账户注销", url: value!), (data) {}); |
| | |
| | | title: "隐私投诉", |
| | | content: "", |
| | | onClick: () { |
| | | MySharedPreferences.getInstance().getString("feedBackLink").then((value) { |
| | | MySharedPreferences.getInstance() |
| | | .getString("feedBackLink") |
| | | .then((value) { |
| | | if (!StringUtil.isNullOrEmpty(value)) { |
| | | NavigatorUtil.navigateToNextPage(context, |
| | | BrowserPage(title: "隐私投诉", url: value!), (data) {}); |
| | |
| | | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:makemoney/api/msg_api.dart'; |
| | | import 'package:makemoney/api/team_api.dart'; |
| | | import 'package:makemoney/model/msg/app_notify_msg_model.dart'; |
| | | import 'package:makemoney/model/team/team_member_list_vo.dart'; |
| | | import 'package:makemoney/ui/mine/invite_friends.dart'; |
| | | import 'package:makemoney/ui/widget/base_ui.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | | import 'package:makemoney/ui/widget/images_widget.dart'; |
| | | import 'package:makemoney/ui/widget/refresh_listview.dart'; |
| | |
| | | level = widget.first ? 0 : 1; |
| | | }); |
| | | _refresh(); |
| | | _getNotify(); |
| | | } |
| | | |
| | | BoxDecoration getItemDecoration(Color bgColor, Color shadowColor) { |
| | |
| | | |
| | | _refreshController.refreshCompleted(); |
| | | _refreshController.loadComplete(); |
| | | |
| | | if (result == null && |
| | | _page == 1 && |
| | | (_teamList == null || _teamList!.isEmpty)) { |
| | | _refreshController.apiError!(); |
| | | } |
| | | |
| | | if (result == null || result["code"] != 0) { |
| | | //页码回滚 |
| | | if (_page > 1) { |
| | |
| | | } |
| | | } |
| | | |
| | | AppNotifyMsgModel? _notifyMsg; |
| | | |
| | | void _getNotify() async { |
| | | AppNotifyMsgModel? notifyMsgModel = |
| | | await MsgApiUtil.getNotifyMsg(context, "team"); |
| | | setState(() { |
| | | _notifyMsg = notifyMsgModel; |
| | | }); |
| | | } |
| | | |
| | | @override |
| | | Widget build(BuildContext context) { |
| | | return Scaffold( |
| | |
| | | height: 20, |
| | | ), |
| | | rightClick: () { |
| | | NavigatorUtil.navigateToNextPage(context, InviteFriendsPage(title: ""), (data) { }); |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, InviteFriendsPage(title: ""), (data) {}); |
| | | }, |
| | | ), |
| | | Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ |
| | | Expanded(flex: 1, child: getNavItem("直接队员", 0)), |
| | | Container( |
| | | width: 1, |
| | | height: 20, |
| | | color: const Color(0xFFE0E0E0), |
| | | ), |
| | | Expanded(flex: 1, child: getNavItem("间接队员", 1)), |
| | | ]), |
| | | // Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ |
| | | // Expanded(flex: 1, child: getNavItem("直接队员", 0)), |
| | | // Container( |
| | | // width: 1, |
| | | // height: 20, |
| | | // color: const Color(0xFFE0E0E0), |
| | | // ), |
| | | // Expanded(flex: 1, child: getNavItem("间接队员", 1)), |
| | | // ]), |
| | | |
| | | //通知消息 |
| | | _notifyMsg == null |
| | | ? Container() |
| | | : NotifyWidget(_notifyMsg!.content!, |
| | | textColor: const Color(0xFFFF8316), |
| | | bgColor: const Color(0xFFF5EBA4), |
| | | paddingRight: 0), |
| | | Expanded( |
| | | child: Container( |
| | | color: Color(0xFFF0F0F0), |
| | | color: const Color(0xFFF0F0F0), |
| | | child: RefreshListView( |
| | | refreshController: _refreshController, |
| | | refresh: () { |
| | |
| | | height: 44, |
| | | fontSize: 15, |
| | | onClick: () { |
| | | NavigatorUtil.navigateToNextPage(context, InviteFriendsPage(title: ""), (data) { }); |
| | | NavigatorUtil.navigateToNextPage(context, |
| | | InviteFriendsPage(title: ""), (data) {}); |
| | | }, |
| | | )), |
| | | InkWell( |
| | | onTap: () { |
| | | print("跳转帮助"); |
| | | ConfigUtil.getConfig(context, "helpLink") |
| | | .then((value) { |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | BrowserPage(title: "帮助中心", url: value), |
| | | (data) {}); |
| | | }); |
| | | }, |
| | | child: const Padding( |
| | | padding: EdgeInsets.all(10), |
| | |
| | | height: 45, |
| | | )), |
| | | const SizedBox( |
| | | width: 5, |
| | | width: 12, |
| | | ), |
| | | Expanded( |
| | | child: Container( |
| | |
| | | _teamList![index].todayGoldCorn == 0 |
| | | ? Container() |
| | | : Column( |
| | | crossAxisAlignment: CrossAxisAlignment.center, |
| | | crossAxisAlignment: CrossAxisAlignment.end, |
| | | mainAxisAlignment: MainAxisAlignment.center, |
| | | children: [ |
| | | const Text( |
| | |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:fluttertoast/fluttertoast.dart'; |
| | | import 'package:makemoney/api/gold_corn_api.dart'; |
| | | import 'package:makemoney/api/msg_api.dart'; |
| | | import 'package:makemoney/model/goldcorn/signin_info_model.dart'; |
| | | import 'package:makemoney/model/goldcorn/task_list_model.dart'; |
| | | import 'package:makemoney/model/msg/app_notify_msg_model.dart'; |
| | | import 'package:makemoney/ui/mine/login.dart'; |
| | | import 'package:makemoney/ui/widget/base_ui.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | | import 'package:makemoney/ui/widget/images_widget.dart'; |
| | | import 'package:makemoney/ui/widget/refresh_listview.dart'; |
| | | import 'package:makemoney/utils/pageutils.dart'; |
| | | import 'package:makemoney/utils/ui_constant.dart'; |
| | | import 'package:makemoney/utils/ui_utils.dart'; |
| | | import 'package:makemoney/utils/user_util.dart'; |
| | | |
| | | import '../../ui/widget/nav.dart'; |
| | | |
| | |
| | | |
| | | int selectedIndex = 0; |
| | | |
| | | bool _notify = true; |
| | | |
| | | FToast? fToast; |
| | | |
| | | int _page = 1; |
| | | |
| | | List<TaskListModel> _taskList = []; |
| | | |
| | | @override |
| | | void initState() { |
| | |
| | | //初始化 |
| | | _signInfo = SigninInfoModel( |
| | | continueSignInDay: 0, |
| | | isSignIned: false, |
| | | isSignIned: true, |
| | | notify: true, |
| | | dayList: [ |
| | | DayList(day: "-", goldCorn: 0, state: 2, today: false), |
| | |
| | | ]); |
| | | |
| | | _getSignInfo(); |
| | | _getNotify(); |
| | | _getTaskList(1); |
| | | } |
| | | |
| | | /***签到开始****/ |
| | | void _getSignInfo() async { |
| | | Map<String, dynamic>? result = await GoldCornApiUtil.getSignInInfo(context); |
| | | if (result == null) { |
| | |
| | | SigninInfoModel temp = SigninInfoModel.fromJson(result["data"]); |
| | | setState(() { |
| | | _signInfo = temp; |
| | | _notify = _signInfo!.notify!; |
| | | }); |
| | | } |
| | | |
| | | void _signIn() async { |
| | | bool login = await UserUtil.isLogin(); |
| | | if (!login) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, LoginPage(title: ""), (data) {}); |
| | | return; |
| | | } |
| | | |
| | | Map<String, dynamic>? result = await GoldCornApiUtil.signIn(context); |
| | | if (result == null) { |
| | | return; |
| | |
| | | var data = result["data"]; |
| | | showSignSuccessToast(data["goldCorn"], data["continueDay"]); |
| | | _getSignInfo(); |
| | | } |
| | | |
| | | void _setSignInNotify(bool notify) async { |
| | | Map<String, dynamic>? result = |
| | | await GoldCornApiUtil.setSignInNotify(context, notify); |
| | | if (result == null) { |
| | | return; |
| | | } |
| | | if (result["code"] != 0) { |
| | | ToastUtil.toast(result["msg"], context); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | /***签到结束****/ |
| | | |
| | | AppNotifyMsgModel? _notifyMsg; |
| | | |
| | | void _getNotify() async { |
| | | AppNotifyMsgModel? notifyMsgModel = |
| | | await MsgApiUtil.getNotifyMsg(context, "task"); |
| | | setState(() { |
| | | _notifyMsg = notifyMsgModel; |
| | | }); |
| | | } |
| | | |
| | | //下拉刷新 |
| | | void _refresh() { |
| | | if (_refreshController.dataNormal != null) { |
| | | _refreshController.dataNormal!(); |
| | | } |
| | | _refreshController.loadComplete(); |
| | | _getTaskList(1); |
| | | } |
| | | |
| | | //获取队员列表 |
| | | void _getTaskList(int page) async { |
| | | setState(() { |
| | | _page = page; |
| | | }); |
| | | |
| | | Map<String, dynamic>? result = await GoldCornApiUtil.getTaskList(context); |
| | | |
| | | _refreshController.refreshCompleted(); |
| | | _refreshController.loadComplete(); |
| | | |
| | | if (result == null && _page == 1&&_taskList.isEmpty) { |
| | | _refreshController.apiError!(); |
| | | } |
| | | |
| | | if (result == null || result["code"] != 0) { |
| | | //页码回滚 |
| | | if (_page > 1) { |
| | | setState(() { |
| | | _page = _page - 1; |
| | | }); |
| | | } |
| | | return; |
| | | } |
| | | //解析数据 |
| | | int count = result["data"]["count"]; |
| | | List<dynamic> list = result["data"]["list"]; |
| | | List<TaskListModel> tempList = []; |
| | | list.forEach((element) { |
| | | tempList.add(TaskListModel.fromJson(element)); |
| | | }); |
| | | |
| | | if (_page == 1) { |
| | | setState(() { |
| | | _taskList = tempList; |
| | | }); |
| | | } else { |
| | | setState(() { |
| | | _taskList.addAll(tempList); |
| | | }); |
| | | } |
| | | |
| | | //判断数据 |
| | | |
| | | if (_taskList.isEmpty) { |
| | | //空数据 |
| | | _refreshController.dataEmpty!(); |
| | | } else { |
| | | _refreshController.dataNormal!(); |
| | | if (count <= _taskList.length) { |
| | | //没有数据了 |
| | | _refreshController.loadNoData(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @override |
| | |
| | | ), |
| | | |
| | | //通知消息 |
| | | Container( |
| | | height: 30, |
| | | color: Colors.red, |
| | | ), |
| | | _notifyMsg == null |
| | | ? Container( |
| | | height: 30, |
| | | ) |
| | | : NotifyWidget(_notifyMsg!.content!, |
| | | textColor: Colors.white), |
| | | |
| | | //签到 |
| | | _signInfo == null |
| | | ? Container() |
| | |
| | | decoration: BoxDecoration( |
| | | color: Colors.white, |
| | | borderRadius: BorderRadius.circular(13)), |
| | | padding: const EdgeInsets.fromLTRB(10, 10, 10, 10), |
| | | padding: const EdgeInsets.fromLTRB(4, 20, 4, 10), |
| | | child: Column( |
| | | mainAxisSize: MainAxisSize.min, |
| | | children: [ |
| | | Row( |
| | | crossAxisAlignment: CrossAxisAlignment.end, |
| | | children: [ |
| | | SizedBox( |
| | | width: 6, |
| | | ), |
| | | const Text( |
| | | "签到领金币", |
| | | style: TextStyle( |
| | | color: ColorConstant.theme, fontSize: 15), |
| | | color: ColorConstant.theme, |
| | | fontSize: 15, |
| | | fontWeight: FontWeight.bold, |
| | | height: 1), |
| | | ), |
| | | const SizedBox( |
| | | width: 5, |
| | |
| | | "${_signInfo!.continueSignInDay}", |
| | | style: const TextStyle( |
| | | color: ColorConstant.theme, |
| | | fontSize: 12)), |
| | | fontSize: 12, |
| | | fontWeight: FontWeight.bold)), |
| | | const TextSpan(text: "天") |
| | | ])), |
| | | Expanded(child: Container()), |
| | |
| | | const SizedBox( |
| | | width: 5, |
| | | ), |
| | | Image.asset( |
| | | _signInfo!.notify! |
| | | ? "assets/imgs/task/icon_task_sign_notify_checked.png" |
| | | : "assets/imgs/task/icon_task_sign_notify.png", |
| | | height: 12, |
| | | ) |
| | | InkWell( |
| | | onTap: () { |
| | | UserUtil.isLogin().then((value) { |
| | | if (!value) { |
| | | NavigatorUtil.navigateToNextPage( |
| | | context, |
| | | LoginPage(title: ""), |
| | | (data) {}); |
| | | return; |
| | | } |
| | | setState(() { |
| | | _notify = !_notify; |
| | | }); |
| | | _setSignInNotify(_notify); |
| | | }); |
| | | }, |
| | | child: Padding( |
| | | padding: const EdgeInsets.only(top: 10), |
| | | child: Image.asset( |
| | | _notify |
| | | ? "assets/imgs/task/icon_task_sign_notify_checked.png" |
| | | : "assets/imgs/task/icon_task_sign_notify.png", |
| | | width: 22, |
| | | ))), |
| | | const SizedBox( |
| | | width: 6, |
| | | ), |
| | | ], |
| | | ), |
| | | Row( |
| | |
| | | const SizedBox( |
| | | height: 20, |
| | | ), |
| | | MyFillButton( |
| | | "立即签到", |
| | | 10, |
| | | fontSize: 15, |
| | | height: 42, |
| | | color: _signInfo!.isSignIned! |
| | | ? ColorConstant.theme.withAlpha(128) |
| | | : ColorConstant.theme, |
| | | onClick: () { |
| | | if (_signInfo!.isSignIned!) { |
| | | return; |
| | | } |
| | | _signIn(); |
| | | }, |
| | | ) |
| | | Padding( |
| | | padding: |
| | | const EdgeInsets.only(left: 6, right: 6), |
| | | child: MyFillButton( |
| | | "立即签到", |
| | | 10, |
| | | fontSize: 15, |
| | | height: 42, |
| | | color: _signInfo!.isSignIned! |
| | | ? ColorConstant.theme.withAlpha(128) |
| | | : ColorConstant.theme, |
| | | onClick: () { |
| | | if (_signInfo!.isSignIned!) { |
| | | return; |
| | | } |
| | | |
| | | _signIn(); |
| | | }, |
| | | )) |
| | | ], |
| | | ), |
| | | ), |
| | |
| | | fontSize: 10, color: Color(0xFF666666)), |
| | | ), |
| | | const SizedBox( |
| | | height: 5, |
| | | height: 8, |
| | | ), |
| | | // Row( |
| | | // children: [ |
| | |
| | | Expanded( |
| | | child: Container( |
| | | alignment: Alignment.topCenter, |
| | | margin: EdgeInsets.only(bottom: 10), |
| | | margin: const EdgeInsets.only(bottom: 10), |
| | | decoration: BoxDecoration( |
| | | color: Colors.white, |
| | | borderRadius: BorderRadius.circular(13)), |
| | | child: RefreshListView( |
| | | enablePullDown: false, |
| | | refresh: () { |
| | | _refresh(); |
| | | }, |
| | | enablePullUp: false, |
| | | refreshController: _refreshController, |
| | | loadTextColor: const Color(0xFFFF8316), |
| | | content: ListView.builder( |
| | | itemCount: 5, |
| | | padding: const EdgeInsets.only(top: 12), |
| | | itemCount: _taskList.length, |
| | | itemBuilder: (BuildContext context, int index) { |
| | | return getItemView(index, () {}); |
| | | return getItemView(_taskList[index], () {}); |
| | | }, |
| | | ), |
| | | ), |
| | |
| | | height: 55 * _sizeUnit!, |
| | | // padding: EdgeInsets.only(left: 10,right: 10), |
| | | child: Stack(children: [ |
| | | day.today! |
| | | day.today! && !_signInfo!.isSignIned! |
| | | ? Image.asset( |
| | | "assets/imgs/task/ic_task_sign_day_item_hb_today.png") |
| | | : Padding( |
| | |
| | | )); |
| | | } |
| | | |
| | | Widget getItemView(int index, GestureTapCallback onTap) { |
| | | return Padding( |
| | | padding: const EdgeInsets.only(top: 20, left: 16, right: 16, bottom: 5), |
| | | Widget getItemView(TaskListModel task, GestureTapCallback onTap) { |
| | | return Container( |
| | | padding: |
| | | const EdgeInsets.only(top: 10, left: 16, right: 16, bottom: 10), |
| | | child: Row( |
| | | mainAxisAlignment: MainAxisAlignment.start, |
| | | crossAxisAlignment: CrossAxisAlignment.start, |
| | | crossAxisAlignment: CrossAxisAlignment.center, |
| | | children: [ |
| | | Container( |
| | | width: 40, |
| | |
| | | ], |
| | | ), |
| | | ), |
| | | child: Container( |
| | | margin: const EdgeInsets.all(2), |
| | | decoration: BoxDecoration( |
| | | color: const Color(0xFFFFF8AE), |
| | | borderRadius: BorderRadius.circular(40), |
| | | ), |
| | | ), |
| | | child: CommonImage(task.icon!), |
| | | ), |
| | | SizedBox( |
| | | const SizedBox( |
| | | width: 10, |
| | | ), |
| | | Column( |
| | | crossAxisAlignment: CrossAxisAlignment.start, |
| | | children: [ |
| | | Text( |
| | | "浏览推荐视频", |
| | | style: TextStyle(color: Color(0xFF454545), fontSize: 12), |
| | | task.name!, |
| | | style: TextStyle( |
| | | color: Color(0xFF454545), fontSize: 12, height: 1.2), |
| | | ), |
| | | Text( |
| | | "今日进度(1/3)", |
| | | style: TextStyle( |
| | | task.process!, |
| | | style: const TextStyle( |
| | | color: Color(0xFF7F7F7F), fontSize: 9, height: 1.5), |
| | | ), |
| | | Text.rich(TextSpan( |
| | | style: TextStyle(color: Color(0xFFFF8316), fontSize: 9), |
| | | style: |
| | | TextStyle(color: const Color(0xFFFF8316), fontSize: 9), |
| | | children: [ |
| | | TextSpan(text: "+"), |
| | | TextSpan(text: "8888", style: TextStyle(fontSize: 10)), |
| | | TextSpan(text: "金币/人 (需手动领取)"), |
| | | const TextSpan(text: "+"), |
| | | TextSpan( |
| | | text: "${task.price}", |
| | | style: TextStyle(fontSize: 10)), |
| | | TextSpan(text: task.priceUnit), |
| | | ])), |
| | | ], |
| | | ), |
| | | Expanded(child: Container()), |
| | | MyOutlineButton( |
| | | "去完成", |
| | | task.actionName!, |
| | | 20, |
| | | width: 62, |
| | | height: 25, |
| | | fontSize: 12, |
| | | textColor: ColorConstant.theme, |
| | | color: ColorConstant.theme, |
| | | onClick: () { |
| | | if (false == task.active!) { |
| | | return; |
| | | } |
| | | jumpAppPage(task.jumpType!, null); |
| | | }, |
| | | ) |
| | | ], |
| | | )); |
| | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:pull_to_refresh/pull_to_refresh.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:marquee/marquee.dart'; |
| | | |
| | | Widget NotifyWidget(String text, {required Color textColor, Color? bgColor,double? paddingLeft,double? paddingRight }) { |
| | | return Container( |
| | | height: 30, |
| | | alignment: Alignment.center, |
| | | color: bgColor ?? Colors.transparent, |
| | | padding: EdgeInsets.only(left: paddingLeft ?? 10, right: paddingRight ?? 10, top: 5, bottom: 5), |
| | | child: Row( |
| | | children: [ |
| | | Icon( |
| | | Icons.volume_up_outlined, |
| | | color: textColor, |
| | | size: 15, |
| | | ), |
| | | SizedBox(width: 5,), |
| | | Expanded( |
| | | child: Marquee( |
| | | text: text, |
| | | style: TextStyle(fontSize: 12, color: textColor), |
| | | )) |
| | | ], |
| | | ), |
| | | ); |
| | | } |
| | |
| | | class TopNavBar extends StatelessWidget { |
| | | final String title; |
| | | GestureTapCallback? back; |
| | | GestureTapCallback? leftWidgetClick; |
| | | String? rightText; |
| | | String? leftText; |
| | | Widget? leftWidget; |
| | | Icon? rightIcon; |
| | | Image? rightImage; |
| | | GestureTapCallback? rightClick; |
| | |
| | | this.back, |
| | | this.rightText, |
| | | this.rightIcon, |
| | | this.leftWidget, |
| | | this.leftWidgetClick, |
| | | this.rightImage, |
| | | this.leftText = "", |
| | | this.rightClick, |
| | |
| | | leftText!, |
| | | style: const TextStyle(fontSize: 16), |
| | | ) |
| | | : Container() |
| | | : Container(), |
| | | leftWidget == null |
| | | ? Container() |
| | | : InkWell( |
| | | onTap: () { |
| | | if (leftWidgetClick == null) { |
| | | return; |
| | | } |
| | | leftWidgetClick!(); |
| | | }, |
| | | child: leftWidget!, |
| | | ) |
| | | ]), |
| | | )) |
| | | ], |
| | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:makemoney/ui/widget/button.dart'; |
| | | import 'package:pull_to_refresh/pull_to_refresh.dart'; |
| | | |
| | | typedef OnRefresh = void Function(); |
| | |
| | | required this.content, |
| | | this.emptyView, |
| | | this.refresh, |
| | | this.loadTextColor=const Color(0xFFB8AFB5), |
| | | this.loadTextColor = const Color(0xFFB8AFB5), |
| | | this.loadMore, |
| | | this.enablePullDown = true, |
| | | this.enablePullUp = true}); |
| | |
| | | : SmartRefresher( |
| | | enablePullDown: widget.enablePullDown!, |
| | | enablePullUp: widget.enablePullUp!, |
| | | header: const WaterDropHeader( |
| | | complete: Text( |
| | | "刷新完成", |
| | | style: TextStyle(color: Color(0xFFB8AFB5)), |
| | | ), |
| | | ), |
| | | header: |
| | | MaterialClassicHeader(), |
| | | |
| | | // const WaterDropHeader( |
| | | // complete: Text( |
| | | // "刷新完成", |
| | | // style: TextStyle(color: Color(0xFFB8AFB5)), |
| | | // ), |
| | | // ), |
| | | footer: CustomFooter( |
| | | builder: (BuildContext context, LoadStatus? mode) { |
| | | Widget body; |
| | |
| | | body = const Text("松手,加载更多!", |
| | | style: TextStyle(color: Color(0xFFB8AFB5))); |
| | | } else { |
| | | body = Text("~到底了~", |
| | | body = Text("~到底了~", |
| | | style: TextStyle(color: widget.loadTextColor)); |
| | | } |
| | | return SizedBox( |
| | |
| | | "assets/imgs/common/ic_empty.png", |
| | | ), |
| | | const Text( |
| | | "暂无数据 ", |
| | | style: TextStyle(color: Color(0xFFF698C9), fontSize: 18), |
| | | "~空空如也~", |
| | | style: TextStyle(color: Color(0xFF999999), fontSize: 18), |
| | | ) |
| | | ], |
| | | ), |
| | |
| | | } |
| | | |
| | | Widget errorView() { |
| | | return InkWell( |
| | | onTap: () { |
| | | _onRefresh(); |
| | | }, |
| | | child: Container( |
| | | alignment: Alignment.center, |
| | | // color: Colors.yellow, |
| | | child: Stack( |
| | | alignment: Alignment.bottomCenter, |
| | | children: [ |
| | | Image.asset("assets/imgs/common/ic_network_error.png", |
| | | width: MediaQuery.of(context).size.width * 2 / 5), |
| | | const Text( |
| | | "网络异常,点击重新加载", |
| | | style: TextStyle(color: Color(0xFFF698C9), fontSize: 18), |
| | | ) |
| | | ], |
| | | ), |
| | | )); |
| | | return Container( |
| | | alignment: Alignment.center, |
| | | // color: Colors.yellow, |
| | | child: Stack( |
| | | alignment: Alignment.bottomCenter, |
| | | children: [ |
| | | Image.asset("assets/imgs/common/ic_network_error.png", |
| | | width: MediaQuery.of(context).size.width * 3 / 5), |
| | | const Positioned( |
| | | bottom: 50, |
| | | left: 0, |
| | | right: 0, |
| | | child: Text( |
| | | "网络请求出错", |
| | | textAlign: TextAlign.center, |
| | | style: TextStyle(fontSize: 15, color: Color(0xFF999999)), |
| | | )), |
| | | MyFillButton( |
| | | "点击重新加载", |
| | | 18, |
| | | width: 170, |
| | | height: 36, |
| | | fontSize: 15, |
| | | onClick: () { |
| | | _onRefresh(); |
| | | }, |
| | | ) |
| | | ], |
| | | ), |
| | | ); |
| | | } |
| | | |
| | | @override |
| | |
| | | ///SOS雷达扫描View |
| | | class VerificationBox extends StatefulWidget { |
| | | final int length; |
| | | final double width; |
| | | final VerificationBoxController controller; |
| | | |
| | | VerificationBox(this.length, this.controller); |
| | | VerificationBox(this.length, this.controller, {required this.width}); |
| | | |
| | | @override |
| | | _VerificationBoxState createState() => _VerificationBoxState(); |
| | |
| | | |
| | | class _VerificationBoxState extends State<VerificationBox> |
| | | with WidgetsBindingObserver { |
| | | TextEditingController _controller = TextEditingController(); |
| | | final TextEditingController _controller = TextEditingController(); |
| | | String content = ""; |
| | | final FocusNode _focusNode = FocusNode(); |
| | | bool isKeyboardActived = false; |
| | |
| | | @override |
| | | void initState() { |
| | | super.initState(); |
| | | WidgetsBinding.instance!.addObserver(this); |
| | | widget.controller.controller = _controller; |
| | | |
| | | _controller.addListener(() { |
| | | setState(() { |
| | | print("listener:"); |
| | |
| | | } |
| | | }); |
| | | }); |
| | | WidgetsBinding.instance!.addObserver(this); |
| | | |
| | | } |
| | | |
| | | @override |
| | | void dispose() { |
| | | super.dispose(); |
| | | WidgetsBinding.instance!.removeObserver(this); |
| | | isKeyboardActived = false; |
| | | _focusNode.unfocus(); |
| | | } |
| | | |
| | | @override |
| | | void didChangeMetrics() { |
| | | print("didChangeMetrics isKeyboardActived:$isKeyboardActived"); |
| | | super.didChangeMetrics(); |
| | | WidgetsBinding.instance!.addPostFrameCallback((_) { |
| | | // 当前是安卓系统并且在焦点聚焦的情况下 |
| | |
| | | Widget build(BuildContext context) { |
| | | return GestureDetector( |
| | | onTap: () { |
| | | print("点击事件,输入框获取焦点:${_focusNode.hasFocus}"); |
| | | FocusScope.of(context).requestFocus(_focusNode); |
| | | }, |
| | | child: Stack( |
| | |
| | | RegExp("[a-zA-Z]|[0-9]")), |
| | | LengthLimitingTextInputFormatter(widget.length), |
| | | ], |
| | | style: TextStyle(fontSize: 1, color: Colors.transparent), |
| | | decoration: InputDecoration( |
| | | style: const TextStyle(fontSize: 1, color: Colors.transparent), |
| | | decoration: const InputDecoration( |
| | | border: InputBorder.none, |
| | | focusedBorder: InputBorder.none, |
| | | focusColor: Colors.transparent), |
| | |
| | | focusNode: _focusNode, |
| | | autofocus: false, |
| | | controller: _controller)), |
| | | Row( |
| | | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| | | children: getItems(), |
| | | ) |
| | | SizedBox( |
| | | width: widget.width, |
| | | child: Row( |
| | | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| | | children: getItems(), |
| | | )) |
| | | ], |
| | | )); |
| | | } |
| | |
| | | } |
| | | |
| | | Widget getItem(int index) { |
| | | double width = (widget.width - 10 * widget.length - 1) / widget.length; |
| | | |
| | | //TODO 传入宽度计算 |
| | | return Container( |
| | | alignment: Alignment.center, |
| | | width: 36, |
| | | height: 45, |
| | | width: width, |
| | | height: width * 1.25, |
| | | decoration: BoxDecoration( |
| | | color: const Color(0xFFEFEFEF), |
| | | borderRadius: BorderRadius.circular(13)), |
| | |
| | | class VerificationBoxController { |
| | | VerificationBoxController(); |
| | | |
| | | TextEditingController? _controller = null; |
| | | TextEditingController? _controller; |
| | | |
| | | set controller(TextEditingController? controller) { |
| | | this._controller = controller; |
| | | _controller = controller; |
| | | } |
| | | |
| | | String get text => (_controller == null ? "" : _controller!.text); |
| | |
| | | import 'dart:convert'; |
| | | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:makemoney/utils/share_preference.dart'; |
| | | import '../../api/config_api.dart'; |
| | | import '../api/http.dart'; |
| | | import 'package:shared_preferences/shared_preferences.dart'; |
| | | |
| | | class ConfigUtil { |
| | | ///保存配置信息 |
| | | static void saveConfig(Map<String, dynamic> map) async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | await prefs.setString("config_value", jsonEncode(map)); |
| | | } |
| | | |
| | | static Future<String?> getConfig(BuildContext context, String key) async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | String? result = prefs.getString("config_value"); |
| | | if (result != null) { |
| | | Map<String, dynamic> map = jsonDecode(result); |
| | | return map[key]; |
| | | } else { |
| | | //重新请求 |
| | | ConfigApiUtil.getConfig(context).then((value) { |
| | | if (value == null) { |
| | | return; |
| | | } |
| | | if (value["code"] == 0) { |
| | | saveConfig(value["data"]); |
| | | } |
| | | }); |
| | | } |
| | | return null; |
| | | String? value = await dataMethodChannel.invokeMethod("getConfig", key); |
| | | return value; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | enum SharePlatform { all, wx, wxcircle, qq, qqzone, sina } |
| | | |
| | | |
| | |
| | | |
| | | import 'package:makemoney/utils/share_preference.dart'; |
| | | import 'package:shared_preferences/shared_preferences.dart'; |
| | | |
| | | class SettingUtil { |
| | | //设置推送 |
| | | static Future<bool> setPush(bool enable) async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | return await prefs.setBool("setting_push", enable); |
| | | await _setSetting("pushUnDisturb", enable); |
| | | return true; |
| | | } |
| | | |
| | | ///是否允许推送 |
| | | static Future<bool> isEnablePush() async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | bool? result = prefs.getBool("setting_push"); |
| | | result ??= true; |
| | | return result; |
| | | static Future<bool?> isEnablePush() async { |
| | | return await _getSetting("pushUnDisturb"); |
| | | } |
| | | |
| | | //设置推荐广告 |
| | | static Future<bool> setRecommendAd(bool enable) async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | return await prefs.setBool("setting_recommend_ad", enable); |
| | | await _setSetting("adRecommend", enable); |
| | | return true; |
| | | } |
| | | |
| | | ///是否允许推荐广告 |
| | | static Future<bool> isEnableRecommendAd() async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | bool? result = prefs.getBool("setting_recommend_ad"); |
| | | result ??= true; |
| | | return result; |
| | | static Future<bool?> isEnableRecommendAd() async { |
| | | return await _getSetting("adRecommend"); |
| | | } |
| | | |
| | | //设置推荐广告 |
| | | static Future<bool> setLocationSpan(int second) async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | return await prefs.setInt("setting_location_span", second); |
| | | //设置推荐内容 |
| | | static Future<bool> setRecommendContent(bool enable) async { |
| | | await _setSetting("contentRecommend", enable); |
| | | return true; |
| | | } |
| | | |
| | | ///是否允许推荐广告 |
| | | static Future<int> getLocationSpan() async { |
| | | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| | | int? result = prefs.getInt("setting_location_span"); |
| | | result ??= 30; |
| | | return result; |
| | | ///是否允许推荐内容 |
| | | static Future<bool?> isEnableRecommendContent() async { |
| | | return await _getSetting("contentRecommend"); |
| | | } |
| | | |
| | | static _setSetting(String key, bool value) async { |
| | | await dataMethodChannel |
| | | .invokeMethod("setSetting", {"key": key, "value": value}); |
| | | } |
| | | |
| | | static Future<bool?> _getSetting(String key) async { |
| | | return await dataMethodChannel.invokeMethod("getSetting", key); |
| | | } |
| | | } |
| | |
| | | |
| | | class Constant { |
| | | |
| | | static const bool NATIVE=false; |
| | | static const bool NATIVE=true; |
| | | |
| | | static const String IOS_APP_ID = |
| | | "1615734087"; |
| | |
| | | uiMethodChannel.invokeMethod("setStatusBarDark"); |
| | | } |
| | | |
| | | //跳转页面 |
| | | jumpAppPage(String type, Map<String, dynamic>? params) { |
| | | Map<String, dynamic> ps = {"type": type}; |
| | | if (params != null) { |
| | | ps["params"] = params; |
| | | } |
| | | //跳转应用界面 |
| | | uiMethodChannel.invokeMethod("jumpAppPage", ps); |
| | | } |
| | | |
| | | ///包裹整个页面,下拉刷新,,上拉加载的默认配置 |
| | | Widget getBasePage(Widget widget) { |
| | | return RefreshConfiguration( |
| | |
| | | return prefs.setBool("agree_protocol", true); |
| | | } |
| | | |
| | | ///微信登录 |
| | | static void loginWX() async { |
| | | fluwx |
| | | .sendWeChatAuth(scope: "snsapi_userinfo", state: "wechat_sdk_demo_test") |
| | | .then((value) { |
| | | print("微信授权登录回调:$value"); |
| | | }); |
| | | } |
| | | |
| | | |
| | | ///QQ登录 |
| | | static Future<Map> loginQQ() async { |
| | |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.0" |
| | | fading_edge_scrollview: |
| | | dependency: transitive |
| | | description: |
| | | name: fading_edge_scrollview |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.1" |
| | | fake_async: |
| | | dependency: transitive |
| | | description: |
| | |
| | | name: fluwx_no_pay |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "3.8.1" |
| | | version: "3.8.5" |
| | | fwfh_text_style: |
| | | dependency: transitive |
| | | description: |
| | |
| | | name: image_picker |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "0.8.5" |
| | | image_picker_android: |
| | | dependency: transitive |
| | | description: |
| | | name: image_picker_android |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "0.8.4+11" |
| | | image_picker_for_web: |
| | | dependency: transitive |
| | |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.1.6" |
| | | image_picker_ios: |
| | | dependency: transitive |
| | | description: |
| | | name: image_picker_ios |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "0.8.4+11" |
| | | image_picker_platform_interface: |
| | | dependency: transitive |
| | | description: |
| | |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "1.0.1" |
| | | marquee: |
| | | dependency: "direct dev" |
| | | description: |
| | | name: marquee |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.2.1" |
| | | matcher: |
| | | dependency: transitive |
| | | description: |
| | |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "3.7.0" |
| | | pin_code_fields: |
| | | dependency: "direct dev" |
| | | description: |
| | | name: pin_code_fields |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "7.4.0" |
| | | platform: |
| | | dependency: transitive |
| | | description: |
| | |
| | | name: share_plus |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "3.1.0" |
| | | version: "4.0.4" |
| | | share_plus_linux: |
| | | dependency: transitive |
| | | description: |
| | | name: share_plus_linux |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.4" |
| | | version: "3.0.0" |
| | | share_plus_macos: |
| | | dependency: transitive |
| | | description: |
| | | name: share_plus_macos |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.2" |
| | | version: "3.0.0" |
| | | share_plus_platform_interface: |
| | | dependency: transitive |
| | | description: |
| | | name: share_plus_platform_interface |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.1" |
| | | version: "3.0.2" |
| | | share_plus_web: |
| | | dependency: transitive |
| | | description: |
| | | name: share_plus_web |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.4" |
| | | version: "3.0.0" |
| | | share_plus_windows: |
| | | dependency: transitive |
| | | description: |
| | | name: share_plus_windows |
| | | url: "https://pub.flutter-io.cn" |
| | | source: hosted |
| | | version: "2.0.3" |
| | | version: "3.0.0" |
| | | shared_preferences: |
| | | dependency: "direct dev" |
| | | description: |
| | |
| | | |
| | | # The following adds the Cupertino Icons font to your application. |
| | | # Use with the CupertinoIcons class for iOS style icons. |
| | | cupertino_icons: ^1.0.2 |
| | | cupertino_icons: ^1.0.4 |
| | | |
| | | dev_dependencies: |
| | | flutter_test: |
| | | sdk: flutter |
| | | flutter_lints: ^1.0.0 |
| | | cupertino_icons: ^1.0.3 |
| | | flutter_lints: ^1.0.4 |
| | | cupertino_icons: ^1.0.4 |
| | | permission_handler: ^9.0.2 |
| | | |
| | | |
| | |
| | | |
| | | webview_flutter: ^2.8.0 |
| | | |
| | | flutter_widget_from_html_core: ^0.8.3 |
| | | flutter_widget_from_html_core: ^0.8.5+1 |
| | | |
| | | #时间日期选择 |
| | | flutter_datetime_picker: ^1.5.1 |
| | |
| | | qr_flutter: ^4.0.0 |
| | | |
| | | #分享组件 |
| | | share_plus: ^3.0.4 |
| | | path_provider: ^2.0.6 |
| | | share_plus: ^4.0.4 |
| | | path_provider: ^2.0.9 |
| | | |
| | | #微信登录 |
| | | fluwx_no_pay: ^3.8.1 |
| | | fluwx_no_pay: ^3.8.5 |
| | | |
| | | event_bus: ^2.0.0 |
| | | |
| | |
| | | cached_network_image: ^3.2.0 |
| | | |
| | | #图片选择 |
| | | image_picker: ^0.8.4+9 |
| | | image_picker: ^0.8.5 |
| | | #图片裁剪 |
| | | image_cropper: ^1.5.0 |
| | | |
| | |
| | | #保存图片到相册 |
| | | image_gallery_saver: ^1.7.1 |
| | | |
| | | #跑马灯 |
| | | marquee: ^2.2.1 |
| | | |
| | | #验证码输入 |
| | | pin_code_fields: ^7.4.0 |
| | | |
| | | flutter_boost: |
| | | git: |
| | | url: 'https://github.com/alibaba/flutter_boost.git' |