微信支付,支付宝支付

This commit is contained in:
18631081161 2024-08-26 21:29:52 +08:00
parent 8273998e13
commit 9954555d61
50 changed files with 1930 additions and 330 deletions

View File

@ -69,6 +69,20 @@ android {
}
}
dependencies {
// SDK AAR
api 'com.alipay.sdk:alipaysdk-android:15.8.17'
api 'com.android.support:support-v4:28.0.0'
api "com.android.support:appcompat-v7:28.0.0"
//
api 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.30'
api 'org.greenrobot:eventbus:3.1.1'
}
flutter {
source = "../.."
}

View File

@ -1,36 +1,37 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:label="妙语星河"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:label="妙语星河">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:launchMode="singleTop"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- <meta-data-->
<!-- android:name="io.flutter.embedding.android.SplashScreenDrawable"-->
<!-- android:resource="@drawable/launch_background"-->
<!-- />-->
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<!-- <meta-data-->
<!-- android:name="io.flutter.embedding.android.SplashScreenDrawable"-->
<!-- android:resource="@drawable/launch_background"-->
<!-- />-->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
@ -39,6 +40,18 @@
android:name="flutterEmbedding"
android:value="2" />
<activity
android:name="com.huanmeng.talk.wxapi.WXPayEntryActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<activity-alias
android:name="${applicationId}.wxapi.WXPayEntryActivity"
android:exported="true"
android:targetActivity=".wxapi.WXPayEntryActivity" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
@ -47,8 +60,11 @@
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
<action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain" />
</intent>
</queries>
<queries>
<package android:name="com.tencent.mm" />
</queries>
</manifest>

View File

@ -1,6 +1,205 @@
package com.huanmeng.talk;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.alipay.sdk.app.PayTask;
import com.tencent.mm.opensdk.modelpay.PayReq;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.StandardMethodCodec;
public class MainActivity extends FlutterActivity {
private static final String CHANNEL = "samples.flutter.dev/battery";
private MethodChannel nativeChannel;
private final int SDK_PAY_FLAG = 1;
private final String APP_ID = "wxa4009a51b6438a06";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
Log.d("TAG", "onCreate: EventBus");
}
@Override
protected void onNewIntent(@NonNull Intent intent) {
super.onNewIntent(intent);
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(MessageEvent event) {
if (event.message.equals("wxPaySuccess")) {
Map<String, String> map = new HashMap<>();
map.put("wxPaySuccess", "wxPaySuccess");
nativeChannel.invokeMethod("wxPaySuccess", map);
}
}
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
super.configureFlutterEngine(flutterEngine);
nativeChannel = new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL, StandardMethodCodec.INSTANCE);
nativeChannel.setMethodCallHandler(new MethodChannel.MethodCallHandler() {
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
switch (call.method) {
case "test":
Log.d("TAG", "onMethodCall: 66666666666");
Map<String, String> map = new HashMap<>();
map.put("test", "ADSuccess");
nativeChannel.invokeMethod("test", map);
break;
case "WxPay"://微信支付
String orderInfoWx = call.argument("orderInfoWx");
Log.d("TAG", "onMethodCall: orderInfoWx===" + orderInfoWx);
WxPay(orderInfoWx);
break;
case "Alipay"://支付宝支付
Log.d("TAG", "onMethodCall: Alipay");
String orderInfoZfb = call.argument("orderInfoZfb");
Alipay(orderInfoZfb);
break;
case "test1":
Log.d("TAG1", "onMethodCall: 66666666666");
break;
}
}
});
}
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
@SuppressWarnings("unused")
public void handleMessage(Message msg) {
switch (msg.what) {
case SDK_PAY_FLAG:
//这里接收支付宝的回调信息
//需要注意的是支付结果一定要调用自己的服务端来确定不能通过支付宝的回调结果来判断
@SuppressWarnings("unchecked")
PayResult payResult = new PayResult((Map<String, String>) msg.obj);
/**
* 对于支付结果请商户依赖服务端的异步通知结果同步通知结果仅作为支付结束的通知
*/
String resultInfo = payResult.getResult();// 同步返回需要验证的信息
String resultStatus = payResult.getResultStatus();
// 判断resultStatus 为9000则代表支付成功
if (TextUtils.equals(resultStatus, "9000")) {
// 该笔订单是否真实支付成功需要依赖服务端的异步通知
Log.d("TAG", "handleMessage9000: payResult==" + payResult);
Map<String, String> map = new HashMap<>();
map.put("AlipaySuccess", "AlipaySuccess");
nativeChannel.invokeMethod("AlipaySuccess", map);
} else {
// 该笔订单真实的支付结果需要依赖服务端的异步通知
Log.d("TAG", "handleMessage: payResult==" + payResult);
Map<String, String> map = new HashMap<>();
map.put("AlipaySuccess", "AlipaySuccess");
nativeChannel.invokeMethod("AlipaySuccess", map);
}
break;
default:
break;
}
}
};
private void WxPay(String orderInfo) {
IWXAPI api = WXAPIFactory.createWXAPI(MainActivity.this, APP_ID);
try {
JSONObject jsonObject = new JSONObject(orderInfo);
String appid = jsonObject.getString("appid");
String partnerId = jsonObject.getString("partnerid");
String prepayId = jsonObject.getString("prepayid");
String packageValue = jsonObject.getString("package");
String nonceStr = jsonObject.getString("noncestr");
String timeStamp = jsonObject.getString("timestamp");
String sign = jsonObject.getString("sign");
PayReq request = new PayReq();
request.appId = appid;
request.partnerId = partnerId;
request.prepayId = prepayId;
request.packageValue = packageValue;
request.nonceStr = nonceStr;
request.timeStamp = timeStamp;
request.sign = sign;
api.sendReq(request);
Log.d("TAG", "onMethodCall: appid===" + appid);
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
//支付宝支付
private void Alipay(String orderInfo) {
final Runnable payRunnable = () -> {
PayTask alipay = new PayTask(MainActivity.this);
Map<String, String> result = alipay.payV2(orderInfo, true);
Log.i("msp", result.toString());
Message msg = new Message();
msg.what = SDK_PAY_FLAG;
msg.obj = result;
mHandler.sendMessage(msg);
};
// 必须异步调用
Thread payThread = new Thread(payRunnable);
payThread.start();
}
}

View File

@ -0,0 +1,9 @@
package com.huanmeng.talk;
public class MessageEvent {
public String message;
public MessageEvent(String message) {
this.message = message;
}
}

View File

@ -0,0 +1 @@
package com.huanmeng.talk; import android.text.TextUtils; import java.util.Map; public class PayResult { private String resultStatus; private String result; private String memo; public PayResult(Map<String, String> rawResult) { if (rawResult == null) { return; } for (String key : rawResult.keySet()) { if (TextUtils.equals(key, "resultStatus")) { resultStatus = rawResult.get(key); } else if (TextUtils.equals(key, "result")) { result = rawResult.get(key); } else if (TextUtils.equals(key, "memo")) { memo = rawResult.get(key); } } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } /** * @return the resultStatus */ public String getResultStatus() { return resultStatus; } /** * @return the memo */ public String getMemo() { return memo; } /** * @return the result */ public String getResult() { return result; } }

View File

@ -0,0 +1,90 @@
package com.huanmeng.talk.wxapi;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.Nullable;
import com.huanmeng.talk.MainActivity;
import com.huanmeng.talk.MessageEvent;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import org.greenrobot.eventbus.EventBus;
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
private final String APP_ID = "wxa4009a51b6438a06";
private IWXAPI api;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(this, APP_ID);
api.handleIntent(getIntent(), this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(getIntent());
api.handleIntent(intent, this);
Log.d("TAG", "onNewIntent: 8888888888888");
}
@Override
public void onReq(BaseReq baseReq) {
Log.d("TAG", "onPay, errCode = " + baseReq);
}
@Override
public void onResp(BaseResp resp) {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
//发送成功
// 该笔订单真实的支付结果需要依赖服务端的异步通知
Log.d("TAG", "支付成功");
EventBus.getDefault().post(new MessageEvent("wxPaySuccess"));
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
//发送取消
Log.d("TAG", "取消支付");
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
//发送被拒绝
Log.d("TAG", "拒绝支付");
break;
case BaseResp.ErrCode.ERR_UNSUPPORT:
//不支持错误
Log.d("TAG", "不支持支付");
break;
default:
//发送返回
Log.d("TAG", "返回支付");
break;
}
finish();
// Log.d("TAG", "onPayFinish, errCode = " + resp.errCode);
// if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
// Log.d("TAG", "onPayFinish,errCode=" + resp.errCode);
//
// finish();
// }
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 KiB

BIN
assets/images/ic_alipay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
assets/images/ic_c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
assets/images/ic_c_s.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/images/ic_close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

BIN
assets/images/ic_report.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -0,0 +1,16 @@
import 'package:json_annotation/json_annotation.dart';
part 'create_order_bean.g.dart';
///
@JsonSerializable(explicitToJson: true)
class CreateOrderBean {
String? orderId;
String? payment;
CreateOrderBean(this.orderId, this.payment);
factory CreateOrderBean.fromJson(Map<String, dynamic> json) => _$CreateOrderBeanFromJson(json);
Map<String, dynamic> toJson() => _$CreateOrderBeanToJson(this);
}

View File

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'create_order_bean.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
CreateOrderBean _$CreateOrderBeanFromJson(Map<String, dynamic> json) =>
CreateOrderBean(
json['orderId'] as String?,
json['payment'] as String?,
);
Map<String, dynamic> _$CreateOrderBeanToJson(CreateOrderBean instance) =>
<String, dynamic>{
'orderId': instance.orderId,
'payment': instance.payment,
};

View File

@ -6,13 +6,14 @@ part 'recharge_bean.g.dart';
@JsonSerializable(explicitToJson: true)
class RechargeBean {
int? id;
String? productId;
int? currencyCount;
int? price;
String? price;
String? discount;
int? currencyType;
String? imgUrl;
RechargeBean(this.id, this.currencyCount, this.price, this.discount, this.currencyType, this.imgUrl);
RechargeBean(this.id, this.productId, this.currencyCount, this.price, this.discount, this.currencyType, this.imgUrl);
factory RechargeBean.fromJson(Map<String, dynamic> json) => _$RechargeBeanFromJson(json);

View File

@ -8,8 +8,9 @@ part of 'recharge_bean.dart';
RechargeBean _$RechargeBeanFromJson(Map<String, dynamic> json) => RechargeBean(
(json['id'] as num?)?.toInt(),
json['productId'] as String?,
(json['currencyCount'] as num?)?.toInt(),
(json['price'] as num?)?.toInt(),
json['price'] as String?,
json['discount'] as String?,
(json['currencyType'] as num?)?.toInt(),
json['imgUrl'] as String?,
@ -18,6 +19,7 @@ RechargeBean _$RechargeBeanFromJson(Map<String, dynamic> json) => RechargeBean(
Map<String, dynamic> _$RechargeBeanToJson(RechargeBean instance) =>
<String, dynamic>{
'id': instance.id,
'productId': instance.productId,
'currencyCount': instance.currencyCount,
'price': instance.price,
'discount': instance.discount,

View File

@ -35,80 +35,103 @@ class _AgreementDialogState extends State<AgreementDialog> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(top: 28),
child: Text(
'用户协议与隐私政策',
style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w600),
),
),
Container(
margin: EdgeInsets.only(top: 20, left: 22, right: 22),
child: Text(
'感谢您选择妙语星河!感谢您一直以来的支持!',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 10),
child: Text(
'妙语星河非常重视您的个人信息和隐私保护',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 10),
child: Text(
'1.为了更好的提供注册登录、浏览动态、发布动态内容、消费支付等服务.我们会根据您使用服务的具体功能需求,收集必要的用户信息(可能涉及账户、设备、交易、日志、IMSI等相关信息)',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 10),
child: Text(
'2.未经您的同意,我们不会将您的信息出租、出售给第三方或用于您未授权的其他用途:',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 20),
child: RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(text: '3.您可以对上述信息进行访问、更正、删除以及撤回同意等。 更多内容请您认真阅读并了解《', style: TextStyle(fontSize: 10, color: Colors.white)),
TextSpan(
text: '用户协议',
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "用户协议",
url: "https://shhuanmeng.com/yonghuxieyi.html",
)),
);
}),
TextSpan(text: '》、《', style: TextStyle(fontSize: 10, color: Colors.white)),
TextSpan(
text: '隐私政策',
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "隐私政策",
url: "https://shhuanmeng.com/yinsixieyi.html",
)),
);
}),
TextSpan(text: '》 点击同意即表示您已阅读并同意全部条款。', style: TextStyle(fontSize: 10, color: Colors.white)),
]),
height: 320,
margin: EdgeInsets.only(top: 10),
child: SingleChildScrollView(
child: Column(
children: [
Container(
child: Text(
'免责声明与风险提示',
style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w600),
),
),
Container(
margin: EdgeInsets.only(top: 10, left: 22, right: 22),
child: Text(
'本平台生成的相关内容为人工智能模型概率生成,不确保真实性,您须自行进行核实,特别是针对其中包含的数字、时间以及各类事实性描述等内容。除与您个人信息相关的内容,您在使用妙语星河软件及相关服务时发布上传的内容均由您原创或已获合法授权(且含转授权),知识产权归您或合法第三方所有,同时不侵犯任何人的相关权益。',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
margin: EdgeInsets.only(top: 15),
child: Text(
'用户协议与隐私政策',
style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w600),
),
),
Container(
margin: EdgeInsets.only(top: 10, left: 22, right: 22),
child: Text(
'感谢您选择妙语星河!感谢您一直以来的支持!',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 10),
child: Text(
'妙语星河非常重视您的个人信息和隐私保护',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 10),
child: Text(
'1.为了更好的提供注册登录、浏览动态、发布动态内容、消费支付等服务.我们会根据您使用服务的具体功能需求,收集必要的用户信息(可能涉及账户、设备、交易、日志、IMSI等相关信息)',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22, bottom: 10),
child: Text(
'2.未经您的同意,我们不会将您的信息出租、出售给第三方或用于您未授权的其他用途:',
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5, left: 22, right: 22),
child: RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(text: '3.您可以对上述信息进行访问、更正、删除以及撤回同意等。 更多内容请您认真阅读并了解《', style: TextStyle(fontSize: 10, color: Colors.white)),
TextSpan(
text: '用户协议',
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "用户协议",
url: "https://shhuanmeng.com/yonghuxieyi.html",
)),
);
}),
TextSpan(text: '》、《', style: TextStyle(fontSize: 10, color: Colors.white)),
TextSpan(
text: '隐私政策',
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "隐私政策",
url: "https://shhuanmeng.com/yinsixieyi.html",
)),
);
}),
TextSpan(text: '》 点击同意即表示您已阅读并同意全部条款。', style: TextStyle(fontSize: 10, color: Colors.white)),
]),
),
),
],
),
),
),
GestureDetector(
@ -119,6 +142,7 @@ class _AgreementDialogState extends State<AgreementDialog> {
child: Container(
width: 160,
height: 40,
margin: EdgeInsets.only(top: 10),
alignment: Alignment.center,
decoration: BoxDecoration(color: Color(0xFFFF9000), borderRadius: BorderRadius.all(Radius.circular(50))),
child: Text('同意并继续'),

View File

@ -0,0 +1,160 @@
import 'package:flutter/material.dart';
class PaymentMethodDialog extends StatefulWidget {
Function onTap;
PaymentMethodDialog({super.key, required this.onTap});
@override
State<PaymentMethodDialog> createState() => _PaymentMethodDialogState();
}
class _PaymentMethodDialogState extends State<PaymentMethodDialog> {
bool isWX = true;
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Material(
type: MaterialType.transparency, //
color: Color(0x1A000000),
child: Container(
decoration: const BoxDecoration(
color: Color(0xFF19191A),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(7),
topRight: Radius.circular(7),
)),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: EdgeInsets.only(top: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: EdgeInsets.only(left: 16),
child: Text(
'请选择支付方式',
style: TextStyle(fontSize: 13, color: Colors.white),
),
),
Container(
margin: const EdgeInsets.only(right: 16),
child: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Image(
width: 10,
image: AssetImage('assets/images/ic_close.png'),
),
)),
],
),
),
Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 22),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image(
width: 14.67,
height: 12,
image: AssetImage('assets/images/ic_we_chat.png'),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
'微信支付',
style: TextStyle(fontSize: 10, color: Colors.white),
),
)
],
),
GestureDetector(
onTap: () {
setState(() {
isWX = true;
});
},
child: Image(
width: 15,
height: 15,
image: !isWX ? AssetImage('assets/images/ic_c.png') : AssetImage('assets/images/ic_c_s.png'),
),
),
],
),
),
Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 17),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image(
width: 14,
height: 14,
image: AssetImage('assets/images/ic_alipay.png'),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
'支付宝支付',
style: TextStyle(fontSize: 10, color: Colors.white),
),
)
],
),
GestureDetector(
onTap: () {
setState(() {
isWX = false;
});
},
child: Image(
width: 15,
height: 15,
image: isWX ? AssetImage('assets/images/ic_c.png') : AssetImage('assets/images/ic_c_s.png'),
),
),
],
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
widget.onTap(isWX);
Navigator.of(context).pop();
},
child: Container(
width: size.width,
height: 40,
margin: EdgeInsets.only(left: 16, right: 16, top: 25, bottom: 36),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFFF9000),
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Text(
"去支付",
style: TextStyle(fontSize: 16, color: Colors.white),
),
),
),
],
)),
);
}
}

View File

@ -8,7 +8,13 @@ import 'package:talk/tools/home/test_page.dart';
import 'package:talk/tools/home_page.dart';
import 'package:talk/tools/login/login_page.dart';
import 'package:talk/tools/me/about_page.dart';
import 'package:talk/tools/me/algorithm_filing_page.dart';
import 'package:talk/tools/me/close_teenage_mode_page.dart';
import 'package:talk/tools/me/report_page.dart';
import 'package:talk/tools/me/setting_page.dart';
import 'package:talk/tools/me/teenage_mode_page.dart';
import 'package:talk/tools/me/teenage_password_page.dart';
import 'package:talk/tools/me/teenage_retrieve_password_page.dart';
import 'package:talk/tools/search/search_page.dart';
import 'package:talk/tools/shop/account_page.dart';
import 'package:talk/tools/shop/problem_page.dart';
@ -42,9 +48,29 @@ class ChatApp extends StatefulWidget {
}
class _ChatAppState extends State<ChatApp> {
// invokeMethod唤起
Future<dynamic> nativeCallHandler(MethodCall methodCall) async {
switch (methodCall.method) {
case "test":
print("object77777");
break;
case "AlipaySuccess": //
print("AlipaySuccess6666666666666");
EasyLoading.showToast("支付成功");
break;
case "wxPaySuccess": //
print("wxPaySuccess6666666666666");
EasyLoading.showToast("微信支付成功");
break;
}
}
@override
void initState() {
// TODO: implement initState
Global.method.setMethodCallHandler(nativeCallHandler);
super.initState();
//
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
@ -66,6 +92,12 @@ class _ChatAppState extends State<ChatApp> {
'/SettingPage': (BuildContext context) => const SettingPage(),
'/TestPage': (BuildContext context) => const TestPage(),
'/AboutPage': (BuildContext context) => const AboutPage(),
'/ReportPage': (BuildContext context) => const ReportPage(),
'/TeenageModePage': (BuildContext context) => const TeenageModePage(),
'/TeenagePasswordPage': (BuildContext context) => const TeenagePasswordPage(),
'/CloseTeenageModePage': (BuildContext context) => const CloseTeenageModePage(),
'/TeenageRetrievePasswordPage': (BuildContext context) => const TeenageRetrievePasswordPage(),
'/AlgorithmFilingPage': (BuildContext context) => const AlgorithmFilingPage(),
},
debugShowMaterialGrid: false,
//

View File

@ -9,12 +9,12 @@ class NetworkConfig {
static int SELECT_INDEX = 0;
static List BASE_URLS = [
"http://101.43.19.200:90/",
"http://101.43.19.200:90/",
"https://miaoyuapi.shhuanmeng.com/",
"https://miaoyuapi.shhuanmeng.com/",
];
static List BASE_URLS_AI = [
"http://101.43.19.200:90/",
"https://miaoyuapi.shhuanmeng.com/",
];
static bool isTest = true;
@ -28,6 +28,8 @@ class NetworkConfig {
static String Version = "1.0.0";
static String Language = "en";
static UserInfoBean? userInfoBean;
static bool isTeenage = false; //
static String teenagePassword = ""; //
static const String accountLogin = "api/Account/AccountLogIn"; //
static const String sendPhoneNumber = "api/Account/SendPhoneNumber"; //
@ -62,5 +64,5 @@ class NetworkConfig {
static const String logout = "api/Account/Logout"; //
static const String createOrder = "api/Payment/CreateOrder"; //
}

View File

@ -80,7 +80,7 @@ class ChatModel {
});
} else {
streamController.sink.add({
'code': "-1", //
'code': "SendMessageError", //
'data': dataEntity.message
});
}

View File

@ -15,9 +15,7 @@ import '../../common/func.dart';
import '../../custom/DynamicText.dart';
import '../../custom/custom_popup.dart';
import '../../dialog/delete_dialog.dart';
import '../../dialog/memory_card_dialog.dart';
import '../../dialog/restart_chat_dialog.dart';
import '../../network/NetworkConfig.dart';
import 'chat_info_page.dart';
import 'chat_model.dart';
@ -116,6 +114,11 @@ class _ChatPageState extends State<ChatPage> {
_scrollController.jumpTo(_scrollController.position.maxScrollExtent);
});
break;
case "SendMessageError":
isSend = true;
chatList.removeLast();
EasyLoading.showToast(newData['data']);
break;
case "delChatByIds":
if (newData['data']) {
@ -454,7 +457,7 @@ class _ChatPageState extends State<ChatPage> {
focusedBorder: InputBorder.none,
isCollapsed: true,
//
hintText: "打个招呼吧...",
hintText: "发消息由AI生成回复",
hintStyle: TextStyle(color: Color(0xFFB6B6B6), fontSize: 13),
),
style: const TextStyle(color: Colors.white),
@ -473,6 +476,7 @@ class _ChatPageState extends State<ChatPage> {
: GestureDetector(
onTap: () {
if (!isSend) {
EasyLoading.showToast("请等待上一条回复完毕");
return;
}
@ -583,31 +587,21 @@ class _ChatPageState extends State<ChatPage> {
),
),
),
Container(
margin: EdgeInsets.only(left: l50),
child: GestureDetector(
onTap: () {
setState(() {
isMore = false;
});
if (NetworkConfig.userInfoBean!.memoryCardCount! > 0) {
FunctionUtil.bottomSheetDialog(context, MemoryCardDialog(
onTap: () {
EasyLoading.showToast("status");
},
));
} else {
Navigator.pushNamed(context, "/ShopPage");
}
Navigator.pushNamed(context, "/ReportPage");
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image(width: 26, height: 26, image: AssetImage('assets/images/ic_memory.png')),
Image(width: 26, height: 26, image: AssetImage('assets/images/ic_report.png')),
Container(
margin: EdgeInsets.only(top: 9),
child: Text(
'记忆提升',
'举报',
style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
),
),
@ -615,6 +609,39 @@ class _ChatPageState extends State<ChatPage> {
),
),
),
// Container(
// margin: EdgeInsets.only(left: l50),
// child: GestureDetector(
// onTap: () {
// setState(() {
// isMore = false;
// });
// if (NetworkConfig.userInfoBean!.memoryCardCount! > 0) {
// FunctionUtil.bottomSheetDialog(context, MemoryCardDialog(
// onTap: () {
// EasyLoading.showToast("status");
// },
// ));
// } else {
// Navigator.pushNamed(context, "/ShopPage");
// }
// },
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image(width: 26, height: 26, image: AssetImage('assets/images/ic_memory.png')),
// Container(
// margin: EdgeInsets.only(top: 9),
// child: Text(
// '记忆提升',
// style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
// ),
// ),
// ],
// ),
// ),
// ),
],
),
)
@ -696,8 +723,13 @@ class _ChatPageState extends State<ChatPage> {
// );
// }
if (chatList[index].role == 'pay') {
return Container();
}
///
if (chatList[index].role == 'tips') {
// return Container();
return Center(
child: GestureDetector(
onTap: () {
@ -713,10 +745,10 @@ class _ChatPageState extends State<ChatPage> {
mainAxisSize: MainAxisSize.min,
children: [
Text(chatList[index].content!, style: TextStyle(color: Color(0xFFB6B6B6), fontSize: 10)),
Container(
margin: const EdgeInsets.only(left: 10),
child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
),
// Container(
// margin: const EdgeInsets.only(left: 10),
// child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
// ),
],
),
),

View File

@ -65,7 +65,7 @@ class _MultiplexPageState extends State<MultiplexPage> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 25, bottom: 60, left: 16, right: 16),
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 25, left: 16, right: 16),
child: ListView.builder(
itemCount: categoryList.length,
itemBuilder: (BuildContext context, int index) {

View File

@ -11,11 +11,11 @@ import 'package:flutter_spinkit/flutter_spinkit.dart';
import '../../beans/character_info_bean.dart';
import '../../beans/chat_info_bean.dart';
import '../../beans/send_message_bean.dart';
import '../../common/Global.dart';
import '../../common/func.dart';
import '../../custom/DynamicText.dart';
import '../../custom/custom_popup.dart';
import '../../dialog/delete_dialog.dart';
import '../../dialog/memory_card_dialog.dart';
import '../../dialog/restart_chat_dialog.dart';
import '../../network/NetworkConfig.dart';
import '../chat/chat_info_page.dart';
@ -106,6 +106,12 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
});
break;
case "SendMessageError":
isSend = true;
chatList.removeLast();
EasyLoading.showToast(newData['data']);
break;
case "delChatByIds":
if (newData['data']) {
chatList.removeAt(delIndex);
@ -441,7 +447,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
focusedBorder: InputBorder.none,
isCollapsed: true,
//
hintText: "打个招呼吧...",
hintText: "发消息由AI生成回复",
hintStyle: TextStyle(color: Color(0xFFB6B6B6), fontSize: 13),
),
style: const TextStyle(color: Colors.white),
@ -465,6 +471,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
}
if (!isSend) {
EasyLoading.showToast("请等待上一条回复完毕");
return;
}
@ -512,6 +519,12 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
}
isMore = !isMore;
setState(() {});
// Map<String, dynamic> map = {
// "test": "test",
// };
// invokeNativeMethod("test", map);
},
child: Container(
margin: EdgeInsets.only(left: 14),
@ -579,33 +592,21 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
),
),
),
Container(
margin: EdgeInsets.only(left: l50),
child: GestureDetector(
onTap: () {
setState(() {
isMore = false;
});
// EasyLoading.show(status: 'loading...');
// _viewmodel.delChat(widget.characterId);
if (NetworkConfig.userInfoBean!.memoryCardCount! > 0) {
FunctionUtil.bottomSheetDialog(context, MemoryCardDialog(
onTap: () {
EasyLoading.showToast("status");
},
));
} else {
Navigator.pushNamed(context, "/ShopPage");
}
Navigator.pushNamed(context, "/ReportPage");
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image(width: 26, height: 26, image: AssetImage('assets/images/ic_memory.png')),
Image(width: 26, height: 26, image: AssetImage('assets/images/ic_report.png')),
Container(
margin: EdgeInsets.only(top: 9),
child: Text(
'记忆提升',
'举报',
style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
),
),
@ -613,6 +614,41 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
),
),
),
// Container(
// margin: EdgeInsets.only(left: l50),
// child: GestureDetector(
// onTap: () {
// setState(() {
// isMore = false;
// });
// // EasyLoading.show(status: 'loading...');
// // _viewmodel.delChat(widget.characterId);
// if (NetworkConfig.userInfoBean!.memoryCardCount! > 0) {
// FunctionUtil.bottomSheetDialog(context, MemoryCardDialog(
// onTap: () {
// EasyLoading.showToast("status");
// },
// ));
// } else {
// Navigator.pushNamed(context, "/ShopPage");
// }
// },
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image(width: 26, height: 26, image: AssetImage('assets/images/ic_memory.png')),
// Container(
// margin: EdgeInsets.only(top: 9),
// child: Text(
// '记忆提升',
// style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
// ),
// ),
// ],
// ),
// ),
// ),
],
),
)
@ -693,8 +729,13 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
// );
// }
if (chatList[index].role == 'pay') {
return Container();
}
///
if (chatList[index].role == 'tips') {
// return Container();
return Center(
child: GestureDetector(
onTap: () {
@ -711,10 +752,10 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
mainAxisSize: MainAxisSize.min,
children: [
Text(chatList[index].content!, style: const TextStyle(color: Color(0xFFB6B6B6), fontSize: 10)),
Container(
margin: const EdgeInsets.only(left: 10),
child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
),
// Container(
// margin: const EdgeInsets.only(left: 10),
// child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
// ),
],
),
),
@ -894,6 +935,14 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
);
}
//
invokeNativeMethod(String method, Map<String, dynamic> map) async {
dynamic args;
try {
args = await Global.method.invokeMethod(method, map);
} on PlatformException catch (e) {}
}
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;

View File

@ -25,7 +25,7 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
void initState() {
// TODO: implement initState
super.initState();
_tabController = TabController(length: 4, vsync: this);
_tabController = TabController(length: NetworkConfig.isTeenage ? 3 : 4, vsync: this);
}
@override
@ -46,12 +46,18 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
TabBarView(
controller: _tabController,
physics: const NeverScrollableScrollPhysics(),
children: const [
MyHomePage(),
FindPage(),
MessagePage(),
MePage(),
],
children: NetworkConfig.isTeenage
? [
MyHomePage(),
MessagePage(),
MePage(),
]
: [
MyHomePage(),
FindPage(),
MessagePage(),
MePage(),
],
),
],
),
@ -63,46 +69,70 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
child: BottomNavigationBar(
backgroundColor: const Color(0xFF0C0909),
type: BottomNavigationBarType.fixed,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Text(
'首页',
style: TextStyle(color: Color(currentIndex == 0 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
'发现',
style: TextStyle(color: Color(currentIndex == 1 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
// BottomNavigationBarItem(
// icon: Container(
// // margin: EdgeInsets.only(top: 10),
// child: Image(
// width: 32,
// image: AssetImage('assets/images/ic_create.png'),
// ),
// ),
// label: '',
// ),
BottomNavigationBarItem(
icon: Text(
'消息',
style: TextStyle(color: Color(currentIndex == 2 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
'我的',
style: TextStyle(color: Color(currentIndex == 3 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
],
items: NetworkConfig.isTeenage
? <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Text(
'首页',
style: TextStyle(color: Color(currentIndex == 0 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
'消息',
style: TextStyle(color: Color(currentIndex == 1 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
'我的',
style: TextStyle(color: Color(currentIndex == 2 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
]
: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Text(
'首页',
style: TextStyle(color: Color(currentIndex == 0 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
'发现',
style: TextStyle(color: Color(currentIndex == 1 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
// BottomNavigationBarItem(
// icon: Container(
// // margin: EdgeInsets.only(top: 10),
// child: Image(
// width: 32,
// image: AssetImage('assets/images/ic_create.png'),
// ),
// ),
// label: '',
// ),
BottomNavigationBarItem(
icon: Text(
'消息',
style: TextStyle(color: Color(currentIndex == 2 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
'我的',
style: TextStyle(color: Color(currentIndex == 3 ? 0xFFFFFFFF : 0xFF7E7E7E), fontSize: 15),
),
label: '',
),
],
//
currentIndex: currentIndex,
//
@ -113,12 +143,12 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
unselectedFontSize: 15,
iconSize: 0,
onTap: (index) {
if (NetworkConfig.userId == "") {
Navigator.of(context).pushNamed('/LoginPage');
return;
}
print("objectindex==$index");
setState(() {
currentIndex = index;
});

View File

@ -41,6 +41,8 @@ class _LoginPageState extends State<LoginPage> {
int _timeLeft = 60; //
bool _isCountingDown = false;
late Timer _timer;
///
void getCode() {
if (phoneText == "") {
@ -55,7 +57,7 @@ class _LoginPageState extends State<LoginPage> {
_isCountingDown = true;
});
Timer.periodic(const Duration(seconds: 1), (timer) {
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
if (_timeLeft > 0) {
setState(() {
_timeLeft--;
@ -89,6 +91,7 @@ class _LoginPageState extends State<LoginPage> {
case "getUserInfo":
EasyLoading.dismiss();
_timer.cancel();
Navigator.pushReplacementNamed(context, "/HomePage");
break;

View File

@ -51,20 +51,36 @@ class _AboutPageState extends State<AboutPage> {
},
),
),
body: Column(
body: Stack(
alignment: Alignment.center,
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 68),
child: Image(width: 70, height: 70, image: AssetImage('assets/images/ic_launcher.png')),
Column(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 68),
child: Image(width: 70, height: 70, image: AssetImage('assets/images/ic_launcher.png')),
),
Container(
margin: EdgeInsets.only(top: 17),
child: Text(
version,
style: TextStyle(fontSize: 12, color: Color(0xFF858585)),
),
)
],
),
Container(
margin: EdgeInsets.only(top: 17),
child: Text(
version,
style: TextStyle(fontSize: 12, color: Color(0xFF858585)),
),
)
Positioned(
bottom: 50,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, "/AlgorithmFilingPage");
},
child: Text(
'算法备案',
style: TextStyle(color: Colors.grey),
),
)),
],
),
);

View File

@ -0,0 +1,64 @@
import 'package:flutter/material.dart';
class AlgorithmFilingPage extends StatefulWidget {
const AlgorithmFilingPage({super.key});
@override
State<AlgorithmFilingPage> createState() => _AlgorithmFilingPageState();
}
class _AlgorithmFilingPageState extends State<AlgorithmFilingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF121213),
appBar: AppBar(
backgroundColor: Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: Text(
'算法备案',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Container(
alignment: Alignment.topCenter,
margin: EdgeInsets.only(top: 50),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'妙语星河算法备案公示',
style: TextStyle(color: Colors.grey),
),
Container(
margin: EdgeInsets.only(top: 30),
child: Text(
textAlign: TextAlign.center,
'应事文本信息合成算法-1\n(网信算备310104297296101230057号)',
style: TextStyle(color: Colors.grey),
),
),
Container(
margin: EdgeInsets.only(top: 10),
child: Text(
textAlign: TextAlign.center,
'应事文本信息合成算法-2\n(网信算备310104297296101230065号)',
style: TextStyle(color: Colors.grey),
),
),
],
),
),
);
}
}

View File

@ -0,0 +1,98 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_verification_code/flutter_verification_code.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:talk/network/NetworkConfig.dart';
import '../home_page.dart';
class CloseTeenageModePage extends StatefulWidget {
const CloseTeenageModePage({super.key});
@override
State<CloseTeenageModePage> createState() => _CloseTeenageModePageState();
}
class _CloseTeenageModePageState extends State<CloseTeenageModePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF121213),
appBar: AppBar(
backgroundColor: const Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: const Text(
'青少年模式',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: const Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 40),
child: Text(
'输入密码',
style: TextStyle(color: Color(0xFFF2F2F2), fontSize: 20),
),
),
Container(
child: VerificationCode(
textStyle: TextStyle(color: Colors.lightBlue),
onCompleted: (String value) async {
if (NetworkConfig.teenagePassword == value) {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool("isTeenage", false);
prefs.setString("teenagePassword", '');
NetworkConfig.teenagePassword = '';
NetworkConfig.isTeenage = false;
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const HomePage()),
(Route<dynamic> route) => false,
);
} else {
EasyLoading.showToast("密码错误!");
}
},
onEditing: (bool value) {
print("objectvalue==$value");
},
),
),
Container(
margin: EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'忘记密码?',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 12),
),
GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/TeenageRetrievePasswordPage');
},
child: Text(
'找回密码',
style: TextStyle(color: Color(0xFFFF9000), fontSize: 12),
),
),
],
),
),
],
),
);
}
}

View File

@ -6,6 +6,7 @@ import 'package:talk/tools/me/me_model.dart';
import '../../beans/me_character_info_bean.dart';
import '../../beans/user_info_bean.dart';
import '../../network/NetworkConfig.dart';
import '../chat/chat_page.dart';
class MePage extends StatefulWidget {
@ -133,122 +134,162 @@ class _MePageState extends State<MePage> {
],
),
),
Container(
margin: EdgeInsets.only(left: 16, top: 17),
child: Row(
children: [
// Text(
// '9',
// style: TextStyle(color: Colors.white, fontSize: 16),
// ),
// Container(
// margin: EdgeInsets.only(left: 6),
// child: Text(
// '相册',
// style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
// ),
// ),
Text(
'${userInfoBean.remainingChatCount}',
style: TextStyle(color: Colors.white, fontSize: 16),
),
Container(
margin: EdgeInsets.only(left: 6),
child: Text(
'聊过',
style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
!NetworkConfig.isTeenage
? Container(
margin: EdgeInsets.only(left: 16, top: 17),
child: Row(
children: [
// Text(
// '9',
// style: TextStyle(color: Colors.white, fontSize: 16),
// ),
// Container(
// margin: EdgeInsets.only(left: 6),
// child: Text(
// '相册',
// style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
// ),
// ),
Text(
'${userInfoBean.remainingChatCount}',
style: TextStyle(color: Colors.white, fontSize: 16),
),
Container(
margin: EdgeInsets.only(left: 6),
child: Text(
'聊过',
style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
),
),
],
),
),
],
),
),
)
: Container(),
NetworkConfig.isTeenage
? Container(
margin: EdgeInsets.only(top: 10),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image(width: 50, image: const AssetImage('assets/images/ic_teenage.png')),
),
Container(
margin: EdgeInsets.only(top: 43),
alignment: Alignment.center,
child: Image(width: 220, image: const AssetImage('assets/images/teenage_explain.png')),
),
GestureDetector(
onTap: () {
if (NetworkConfig.isTeenage) {
Navigator.pushNamed(context, '/CloseTeenageModePage');
} else {
Navigator.pushNamed(context, '/TeenagePasswordPage');
}
},
child: Container(
width: double.infinity,
height: 45,
alignment: Alignment.center,
margin: const EdgeInsets.only(left: 16, right: 16, top: 60),
decoration: const BoxDecoration(color: Color(0xFFFF9000), borderRadius: BorderRadius.all(Radius.circular(10))),
child: Text("关闭青少年模式"),
),
),
],
),
)
: Container(),
///
Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 22),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/AccountPage');
},
child: Container(
height: t38,
decoration: BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(13))),
child: Row(
children: [
Container(
margin: EdgeInsets.only(left: 15),
child: Image(
width: 23,
height: 20,
image: AssetImage('assets/images/ic_currency.png'),
!NetworkConfig.isTeenage
? Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 22),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/AccountPage');
},
child: Container(
height: t38,
decoration: BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(13))),
child: Row(
children: [
Container(
margin: EdgeInsets.only(left: 15),
child: Image(
width: 23,
height: 20,
image: AssetImage('assets/images/ic_currency.png'),
),
),
Container(
margin: EdgeInsets.only(left: 17),
child: Text(
'语珠:${userInfoBean.currency}',
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 13),
),
),
],
),
),
Container(
margin: EdgeInsets.only(left: 17),
child: Text(
'语珠:${userInfoBean.currency}',
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 13),
),
),
],
),
),
),
),
),
Container(width: 15),
Expanded(
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/ShopPage');
},
child: Container(
height: t38,
decoration: const BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(13))),
child: Row(
children: [
Container(
margin: const EdgeInsets.only(left: 15),
child: const Image(
width: 23,
height: 20,
image: AssetImage('assets/images/ic_mall.png'),
Container(width: 15),
Expanded(
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/ShopPage');
},
child: Container(
height: t38,
decoration: const BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(13))),
child: Row(
children: [
Container(
margin: const EdgeInsets.only(left: 15),
child: const Image(
width: 23,
height: 20,
image: AssetImage('assets/images/ic_mall.png'),
),
),
Container(
margin: const EdgeInsets.only(left: 35),
child: const Text(
'商城',
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 13),
),
),
],
),
),
Container(
margin: const EdgeInsets.only(left: 35),
child: const Text(
'商城',
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 13),
),
),
],
),
),
),
],
),
),
],
),
),
)
: Container(),
Container(
height: h50,
margin: EdgeInsets.symmetric(horizontal: 16),
child: GestureDetector(
onTap: () {
// Navigator.pushNamed(context, '/LoginPage');
},
child: CachedNetworkImage(
width: w58,
height: w58,
imageUrl: userInfoBean.inviteNewUser!.imgUrl!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
),
),
// Container(
// height: h50,
// margin: EdgeInsets.symmetric(horizontal: 16),
// child: GestureDetector(
// onTap: () {
// // Navigator.pushNamed(context, '/LoginPage');
// },
// child: CachedNetworkImage(
// width: w58,
// height: w58,
// imageUrl: userInfoBean.inviteNewUser!.imgUrl!,
// errorWidget: (context, url, error) => const Icon(Icons.error),
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.only(left: 16, top: 33),

View File

@ -0,0 +1,274 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
///
class ReportPage extends StatefulWidget {
const ReportPage({super.key});
@override
State<ReportPage> createState() => _ReportPageState();
}
class _ReportPageState extends State<ReportPage> {
final TextEditingController _textController = TextEditingController(text: '');
final FocusNode _commentFocus = FocusNode(); //
int typeIndex = 0;
String promptText = "";
void _textFieldChanged(String str) {
promptText = str;
}
@override
void initState() {
// TODO: implement initState
super.initState();
}
setType(type) {
typeIndex = type;
setState(() {});
}
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: Color(0xFF121213),
appBar: AppBar(
backgroundColor: Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: Text(
'举报中心',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
width: size.width,
margin: EdgeInsets.only(left: 16, top: 10),
child: Text(
'举报类型',
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 18),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
GestureDetector(
onTap: () {
setType(0);
},
child: Image(
width: 12,
height: 12,
image: typeIndex == 0 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
),
),
Container(
margin: EdgeInsets.only(left: 7),
child: Text(
'骚扰谩骂',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
),
)
],
),
Row(
children: [
GestureDetector(
onTap: () {
setType(1);
},
child: Image(
width: 12,
height: 12,
image: typeIndex == 1 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
),
),
Container(
margin: EdgeInsets.only(left: 7),
child: Text(
'垃圾广告',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
),
)
],
),
Row(
children: [
GestureDetector(
onTap: () {
setType(2);
},
child: Image(
width: 12,
height: 12,
image: typeIndex == 2 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
),
),
Container(
margin: EdgeInsets.only(left: 7),
child: Text(
'涉政社恐',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
),
)
],
),
],
),
),
Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 18),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
GestureDetector(
onTap: () {
setType(4);
},
child: Image(
width: 12,
height: 12,
image: typeIndex == 4 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
),
),
Container(
margin: EdgeInsets.only(left: 7),
child: Text(
'欺诈骗钱',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
),
)
],
),
Row(
children: [
GestureDetector(
onTap: () {
setType(5);
},
child: Image(
width: 12,
height: 12,
image: typeIndex == 5 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
),
),
Container(
margin: EdgeInsets.only(left: 7),
child: Text(
'淫秽色情',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
),
)
],
),
Row(
children: [
GestureDetector(
onTap: () {
setType(6);
},
child: Image(
width: 12,
height: 12,
image: typeIndex == 6 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
),
),
Container(
margin: EdgeInsets.only(left: 7),
child: Text(
'其他 ',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
),
)
],
),
],
),
),
Container(
margin: EdgeInsets.only(left: 16, top: 24),
child: Row(
children: [
Text(
'具体描述',
style: TextStyle(fontSize: 14, color: Color(0xFFC5C5C5)),
),
Text(
'(选填)',
style: TextStyle(fontSize: 10, color: Color(0xFFC5C5C5)),
),
],
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 20),
padding: const EdgeInsets.only(left: 9, top: 13, right: 9),
decoration: BoxDecoration(
color: Color(0xFF262626),
borderRadius: BorderRadius.all(Radius.circular(6.6)),
),
child: TextField(
controller: _textController,
keyboardType: TextInputType.name,
focusNode: _commentFocus,
decoration:
InputDecoration.collapsed(hintText: '请描述举报的具体原因,以便更快处理', hintStyle: const TextStyle(fontSize: 10.0, color: Color(0xFF535353))),
textAlign: TextAlign.left,
maxLines: 4,
style: const TextStyle(fontSize: 16.0, color: Colors.white),
onChanged: _textFieldChanged,
autofocus: false,
maxLength: 200,
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
EasyLoading.show(status: 'loading...');
Future.delayed(Duration(milliseconds: 1000), () {
//2
EasyLoading.showToast("提交成功");
Navigator.of(context).pop();
});
},
child: Container(
width: double.infinity,
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.only(left: 16, right: 16, top: 50),
decoration: BoxDecoration(color: Color(0xFFFF9000), borderRadius: BorderRadius.all(Radius.circular(10))),
child: Text(
'提交',
style: TextStyle(
fontSize: 16,
),
),
),
),
],
),
);
}
}

View File

@ -184,6 +184,34 @@ class _SettingApgeState extends State<SettingPage> {
),
),
),
Container(
height: 0.33,
color: Color(0xFF3A3A3A),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.pushNamed(context, '/TeenageModePage');
},
child: const SizedBox(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'青少年模式',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
GestureDetector(
onTap: () async {
logout();

View File

@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_verification_code/flutter_verification_code.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:talk/network/NetworkConfig.dart';
import '../home_page.dart';
class TeenageConfirmPasswordPage extends StatefulWidget {
String value;
TeenageConfirmPasswordPage({super.key, required this.value});
@override
State<TeenageConfirmPasswordPage> createState() => _TeenageConfirmPasswordPageState();
}
class _TeenageConfirmPasswordPageState extends State<TeenageConfirmPasswordPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF121213),
appBar: AppBar(
backgroundColor: const Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: const Text(
'青少年模式',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: const Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 40),
child: Text(
'确认密码',
style: TextStyle(color: Color(0xFFF2F2F2), fontSize: 20),
),
),
Container(
alignment: Alignment.center,
child: Text(
'请再次输入密码',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 14),
),
),
Container(
child: VerificationCode(
textStyle: const TextStyle(color: Colors.lightBlue),
onCompleted: (String value) async {
if (widget.value == value) {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool("isTeenage", true);
prefs.setString("teenagePassword", value);
NetworkConfig.isTeenage = true;
NetworkConfig.teenagePassword = value;
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const HomePage()),
(Route<dynamic> route) => false,
);
} else {
EasyLoading.showToast("两次输入密码不同!");
}
},
onEditing: (bool value) {
print("objectvalue==$value");
},
),
),
],
),
);
}
}

View File

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:talk/network/NetworkConfig.dart';
class TeenageModePage extends StatefulWidget {
const TeenageModePage({super.key});
@override
State<TeenageModePage> createState() => _TeenageModePageState();
}
class _TeenageModePageState extends State<TeenageModePage> {
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
final t43 = size.width / 8.3720930232558;
final w98 = size.width / 3.6734693877551;
final w246 = size.width / 1.4634146341463;
final h45 = size.width / 8;
return Scaffold(
backgroundColor: const Color(0xFF121213),
appBar: AppBar(
backgroundColor: const Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: const Text(
'青少年模式开启须知',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: const Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
margin: EdgeInsets.only(top: t43),
alignment: Alignment.center,
child: Image(width: w98, image: const AssetImage('assets/images/ic_teenage.png')),
),
Container(
margin: EdgeInsets.only(top: t43),
alignment: Alignment.center,
child: Image(width: w246, image: const AssetImage('assets/images/teenage_explain.png')),
),
GestureDetector(
onTap: () {
if (NetworkConfig.isTeenage) {
Navigator.pushNamed(context, '/CloseTeenageModePage');
} else {
Navigator.pushNamed(context, '/TeenagePasswordPage');
}
},
child: Container(
width: double.infinity,
height: h45,
alignment: Alignment.center,
margin: const EdgeInsets.only(left: 16, right: 16, top: 60),
decoration: const BoxDecoration(color: Color(0xFFFF9000), borderRadius: BorderRadius.all(Radius.circular(10))),
child: Text(NetworkConfig.isTeenage ? "关闭青少年模式" : "开启青少年模式"),
),
),
],
),
);
}
}

View File

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:flutter_verification_code/flutter_verification_code.dart';
import 'package:talk/tools/me/teenage_confirm_password_page.dart';
///
class TeenagePasswordPage extends StatefulWidget {
const TeenagePasswordPage({super.key});
@override
State<TeenagePasswordPage> createState() => _TeenagePasswordPageState();
}
class _TeenagePasswordPageState extends State<TeenagePasswordPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF121213),
appBar: AppBar(
backgroundColor: const Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: const Text(
'青少年模式',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: const Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 40),
child: Text(
'设置密码',
style: TextStyle(color: Color(0xFFF2F2F2), fontSize: 20),
),
),
Container(
alignment: Alignment.center,
child: Text(
'此密码为关闭青少年模式的密码',
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 14),
),
),
Container(
child: VerificationCode(
textStyle: TextStyle(color: Colors.lightBlue),
onCompleted: (String value) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => TeenageConfirmPasswordPage(value: value),
),
);
},
onEditing: (bool value) {
print("objectvalue==$value");
},
),
),
],
),
);
}
}

View File

@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
class TeenageRetrievePasswordPage extends StatefulWidget {
const TeenageRetrievePasswordPage({super.key});
@override
State<TeenageRetrievePasswordPage> createState() => _TeenageRetrievePasswordPageState();
}
class _TeenageRetrievePasswordPageState extends State<TeenageRetrievePasswordPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF121213),
appBar: AppBar(
backgroundColor: const Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: const Text(
'青少年模式',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: const Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 40),
child: Text(
'找回密码',
style: TextStyle(color: Color(0xFFF2F2F2), fontSize: 20),
),
),
Container(
margin: EdgeInsets.only(top: 20),
child: Text(
"若您需要重置青少年模式的密码,请发邮件至",
style: TextStyle(fontSize: 12, color: Color(0xFFA8A8A8)),
),
),
Container(
margin: EdgeInsets.only(top: 20),
child: Text(
"zhangxiaode690@gmail.com",
style: TextStyle(fontSize: 12, color: Color(0xFFFF9000)),
),
),
],
),
);
}
}

View File

@ -100,7 +100,7 @@ class _SearchPageState extends State<SearchPage> {
//
focusedBorder: InputBorder.none,
//
hintText: "打个招呼吧...",
hintText: "发消息由AI生成回复",
hintStyle: TextStyle(color: Color(0xFFB6B6B6), fontSize: 13),
suffixStyle: TextStyle(fontSize: 13),
),

View File

@ -1,11 +1,17 @@
import 'dart:async';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:talk/tools/shop/shop_model.dart';
import 'package:talk/tools/shop/transaction_page.dart';
import '../../beans/account_bean.dart';
import '../../beans/create_order_bean.dart';
import '../../beans/transaction_records_bean.dart';
import '../../common/Global.dart';
import '../../common/func.dart';
import '../../dialog/payment_method_dialog.dart';
///
class AccountPage extends StatefulWidget {
@ -36,6 +42,25 @@ class _AccountPageState extends State<AccountPage> {
break;
case "getTransactionRecords":
recordList = newData['data'];
break;
case "createOrderWx": //
CreateOrderBean createOrderBean = newData['data'];
Map<String, dynamic> map = {
"orderInfoWx": createOrderBean.payment,
};
invokeNativeMethod("WxPay", map);
break;
case "createOrderZfb": //
CreateOrderBean createOrderBean = newData['data'];
Map<String, dynamic> map = {
"orderInfoZfb": createOrderBean.payment,
};
invokeNativeMethod("Alipay", map);
break;
}
setState(() {});
@ -214,30 +239,54 @@ class _AccountPageState extends State<AccountPage> {
decoration: BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(17))),
child: Stack(
children: [
Positioned(
left: 21,
top: 14,
child: Text(
'${res.currencyCount}',
style: TextStyle(color: Color(0xFFFF9000), fontSize: 13),
)),
Positioned(
left: 48,
top: 16,
child: Text(
'语珠',
style: TextStyle(color: Color(0xFF6F6F6F), fontSize: 10),
)),
Positioned(
left: 21,
top: 34,
child: Text(
'${res.price}',
style: TextStyle(color: Colors.white, fontSize: 10),
)),
GestureDetector(
onTap: () {
FunctionUtil.bottomSheetDialog(context, PaymentMethodDialog(
onTap: (isWX) {
_viewmodel.createOrder(res.productId.toString(), isWX ? "wx" : "zfb");
},
));
},
child: CachedNetworkImage(
// width: 155,
// height: 100,
fit: BoxFit.cover,
imageUrl: res.imgUrl!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
),
// Positioned(
// left: 21,
// top: 14,
// child: Text(
// '${res.currencyCount}',
// style: TextStyle(color: Color(0xFFFF9000), fontSize: 13),
// )),
// Positioned(
// left: 48,
// top: 16,
// child: Text(
// '语珠',
// style: TextStyle(color: Color(0xFF6F6F6F), fontSize: 10),
// )),
// Positioned(
// left: 21,
// top: 34,
// child: Text(
// '${res.price}',
// style: TextStyle(color: Colors.white, fontSize: 10),
// )),
],
),
);
}).toList();
}
//
invokeNativeMethod(String method, Map<String, dynamic> map) async {
dynamic args;
try {
args = await Global.method.invokeMethod(method, map);
} on PlatformException catch (e) {}
}
}

View File

@ -4,6 +4,7 @@ import 'package:talk/network/NetworkConfig.dart';
import 'package:talk/network/RequestCenter.dart';
import '../../beans/account_bean.dart';
import '../../beans/create_order_bean.dart';
import '../../beans/mall_bean.dart';
import '../../beans/transaction_records_bean.dart';
import '../../network/BaseEntity.dart';
@ -80,4 +81,37 @@ class ShopModel {
print("errorEntity==${errorEntity.message}");
});
}
///
Future<void> createOrder(productId, paymentMethod) async {
RequestCenter.instance.request(NetworkConfig.createOrder, {
"productId": productId,
"paymentMethod": paymentMethod,
}, (BaseEntity dataEntity) {
if (dataEntity.code == 0) {
CreateOrderBean createOrderBean = CreateOrderBean.fromJson(dataEntity.data);
print("dataEntity.data==${dataEntity.data}");
if (paymentMethod == "wx") {
streamController.sink.add({
'code': "createOrderWx", //
'data': createOrderBean,
});
} else {
streamController.sink.add({
'code': "createOrderZfb", //
'data': createOrderBean,
});
}
} else {
streamController.sink.add({
'code': "error", //
'data': dataEntity.message,
});
}
}, (ErrorEntity errorEntity) {
print("errorEntity==${errorEntity.message}");
});
}
}

View File

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:talk/network/NetworkConfig.dart';
import '../common/func.dart';
import '../dialog/agreement_dialog.dart';
@ -65,6 +66,8 @@ class _StartPageState extends State<StartPage> {
getIsFirst() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
bool isFirst = prefs.getBool("IsFirst") ?? true;
NetworkConfig.isTeenage = prefs.getBool("isTeenage") ?? false;
NetworkConfig.teenagePassword = prefs.getString("teenagePassword") ?? '';
if (isFirst) {
FunctionUtil.popDialog2(context, AgreementDialog(
onTap: (index) {

View File

@ -50,6 +50,7 @@ dependencies:
flutter_keyboard_visibility: ^6.0.0
webview_flutter: ^4.8.0
package_info_plus: ^8.0.0
flutter_verification_code: ^1.1.7
dev_dependencies:
flutter_test: