看广告.

This commit is contained in:
18631081161 2024-12-14 15:39:35 +08:00
parent 82dc268344
commit 8808620fe1
18 changed files with 792 additions and 98 deletions

View File

@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.huanmeng.talk">
<uses-permission android:name="android.permission.INTERNET" />

View File

@ -111,6 +111,10 @@ public class MainActivity extends FlutterActivity {
String orderInfoZfb = call.argument("orderInfoZfb");
Alipay(orderInfoZfb);
break;
case "playAd"://看广告
break;
case "test1":
Log.d("TAG1", "onMethodCall: 66666666666");

BIN
assets/images/ic_ad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
assets/images/ic_open_f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
assets/images/ic_open_n.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
assets/images/img_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

View File

@ -5,7 +5,7 @@ import 'me_character_info_bean.dart';
part 'user_info_bean.g.dart';
///
///
@JsonSerializable(explicitToJson: true)
class UserInfoBean {
int? currency;

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class CancelDialog extends StatefulWidget {
Function onTap;
final Function onTap;
CancelDialog({required this.onTap});
@ -10,12 +10,6 @@ class CancelDialog extends StatefulWidget {
}
class _CancelDialogState extends State<CancelDialog> {
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Material(

View File

@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
class CreateCharacterDialog extends StatefulWidget {
Function onTap;
CreateCharacterDialog({super.key, required this.onTap});
@override
State<CreateCharacterDialog> createState() => _CreateCharacterDialogState();
}
class _CreateCharacterDialogState extends State<CreateCharacterDialog> {
@override
Widget build(BuildContext context) {
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(
width: 25,
height: 3,
margin: EdgeInsets.only(top: 14),
decoration: BoxDecoration(color: Color(0xFF272734)),
),
GestureDetector(
onTap: () {
Navigator.of(context).pop();
widget.onTap();
},
child: Container(
width: double.infinity,
height: 76.67,
margin: EdgeInsets.only(left: 16, right: 16, top: 23),
decoration: BoxDecoration(color: Color(0xFF252526), borderRadius: BorderRadius.all(Radius.circular(7))),
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 13,
child: Container(
width: 47,
height: 47,
color: Colors.lightBlueAccent,
)),
Positioned(
left: 78,
top: 20,
child: Text(
"创建个人模型",
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16),
)),
Positioned(
left: 78,
top: 44,
child: Text(
"本周剩余10/10",
style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
))
],
),
),
),
Container(
width: double.infinity,
height: 119.63,
alignment: Alignment.center,
margin: EdgeInsets.only(left: 16, right: 16, top: 23, bottom: 19),
decoration: BoxDecoration(color: Color(0xFF252526), borderRadius: BorderRadius.all(Radius.circular(7))),
child: Text(
'拉新人banner',
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16),
),
),
],
),
));
}
}

View File

@ -0,0 +1,102 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CreateTypeDialog extends StatefulWidget {
Function onTap;
CreateTypeDialog({super.key, required this.onTap});
@override
State<CreateTypeDialog> createState() => _CreateTypeDialogState();
}
class _CreateTypeDialogState extends State<CreateTypeDialog> {
List<int> typeList = [1, 2, 3, 4, 5, 6];
String type = "";
@override
void initState() {
// TODO: implement initState
super.initState();
type = "类型${typeList[0]}";
}
@override
Widget build(BuildContext context) {
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.symmetric(horizontal: 16, vertical: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Text(
"取消",
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
Text(
"选择分类",
style: TextStyle(color: Colors.white, fontSize: 10),
),
GestureDetector(
onTap: () {
Navigator.pop(context);
widget.onTap(type);
},
child: Text(
"确定",
style: TextStyle(color: Colors.white, fontSize: 10),
),
),
],
),
),
Container(
width: 90,
height: 150,
alignment: Alignment.center,
child: CupertinoPicker(
itemExtent: 35.0,
onSelectedItemChanged: (index) {
setState(() {
type = "类型${typeList[index]}";
print(typeList[index]);
});
},
children: _typeItem(),
),
),
],
),
));
}
_typeItem() {
return typeList.map((res) {
return Container(
alignment: Alignment.center,
child: Text(
"类型$res",
style: TextStyle(fontSize: 14, color: Colors.white),
),
);
}).toList();
}
}

View File

@ -4,7 +4,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:talk/tools/home/test_page.dart';
import 'package:talk/tools/creat/create_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';
@ -95,7 +95,6 @@ class _ChatAppState extends State<ChatApp> {
'/ProblemPage': (BuildContext context) => const ProblemPage(),
'/ShopPage': (BuildContext context) => const ShopPage(),
'/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(),
@ -103,6 +102,7 @@ class _ChatAppState extends State<ChatApp> {
'/CloseTeenageModePage': (BuildContext context) => const CloseTeenageModePage(),
'/TeenageRetrievePasswordPage': (BuildContext context) => const TeenageRetrievePasswordPage(),
'/AlgorithmFilingPage': (BuildContext context) => const AlgorithmFilingPage(),
'/CreatePage': (BuildContext context) => const CreatePage(),
},
debugShowMaterialGrid: false,
//

View File

@ -0,0 +1,497 @@
import 'package:flutter/material.dart';
import '../../common/func.dart';
import '../../dialog/create_type_dialog.dart';
class CreatePage extends StatefulWidget {
const CreatePage({super.key});
@override
State<CreatePage> createState() => _CreatePageState();
}
class _CreatePageState extends State<CreatePage> {
final TextEditingController _textBgController = TextEditingController();
int gender = 1; // 1: 0: 3:
String nameText = ""; //
void _textNameChanged(String str) {
nameText = str;
}
String bgText = ""; //
void _textBgChanged(String str) {
bgText = str;
}
String imageText = ""; //
void _textImageChanged(String str) {
imageText = str;
}
int currentStyleIndex = 0; //
List<int> styleList = [1, 2, 3, 4, 5, 6, 7, 8, 9];
String type = ""; //
@override
void initState() {
// TODO: implement initState
super.initState();
}
@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: SingleChildScrollView(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Text(
"角色信息",
style: TextStyle(color: Color(0xFFFF9000), fontSize: 15),
),
),
Container(
margin: EdgeInsets.only(top: 15),
alignment: Alignment.centerLeft,
child: Text(
"角色昵称",
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
TextField(
cursorColor: const Color(0xFFFF9000),
style: const TextStyle(color: Colors.white),
onChanged: _textNameChanged,
decoration: const InputDecoration(
hintText: '给角色取个名字',
hintStyle: TextStyle(color: Color(0xFF4C4C4C), fontSize: 13),
border: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF3A3A3A)), // 线
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFFF9000)),
),
),
maxLength: 8,
),
Container(
margin: const EdgeInsets.only(top: 10),
alignment: Alignment.centerLeft,
child: const Text(
"性别",
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
margin: const EdgeInsets.only(top: 17),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
gender = 1;
setState(() {});
},
child: Container(
width: 93,
height: 32,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: Color(gender == 1 ? 0xFFFF9000 : 0xFF686868), width: 1),
borderRadius: const BorderRadius.all(Radius.circular(7))),
child: Text(
"",
style: TextStyle(fontSize: 13, color: Color(gender == 1 ? 0xFFFF9000 : 0xFF686868)),
),
),
),
GestureDetector(
onTap: () {
gender = 2;
setState(() {});
},
child: Container(
width: 93,
height: 32,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: Color(gender == 2 ? 0xFFFF9000 : 0xFF686868), width: 1),
borderRadius: BorderRadius.all(Radius.circular(7))),
child: Text(
"",
style: TextStyle(fontSize: 13, color: Color(gender == 2 ? 0xFFFF9000 : 0xFF686868)),
),
),
),
GestureDetector(
onTap: () {
gender = 3;
setState(() {});
},
child: Container(
width: 93,
height: 32,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: Color(gender == 3 ? 0xFFFF9000 : 0xFF686868), width: 1),
borderRadius: BorderRadius.all(Radius.circular(7))),
child: Text(
"其他",
style: TextStyle(fontSize: 13, color: Color(gender == 3 ? 0xFFFF9000 : 0xFF686868)),
),
),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 20),
alignment: Alignment.centerLeft,
child: Text(
"身份背景",
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 20),
padding: const EdgeInsets.only(left: 9, top: 5, right: 9),
decoration: BoxDecoration(
color: Color(0xFF262626),
borderRadius: BorderRadius.all(Radius.circular(6.6)),
),
child: TextField(
controller: _textBgController,
keyboardType: TextInputType.name,
cursorColor: Color(0xFFFF9000),
// focusNode: _commentFocus,
decoration:
InputDecoration.collapsed(hintText: '描述越详细,越接近你心目中的形象', hintStyle: const TextStyle(fontSize: 12.0, color: Color(0xFF535353))),
textAlign: TextAlign.left,
maxLines: 6,
style: const TextStyle(fontSize: 14.0, color: Colors.white),
onChanged: _textBgChanged,
autofocus: false,
maxLength: 500,
),
),
Container(
margin: EdgeInsets.only(top: 15),
alignment: Alignment.centerLeft,
child: Text(
"开场白",
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
TextField(
cursorColor: const Color(0xFFFF9000),
style: const TextStyle(color: Colors.white),
onChanged: _textNameChanged,
decoration: const InputDecoration(
hintText: '它的开场第一句话',
hintStyle: TextStyle(color: Color(0xFF4C4C4C), fontSize: 13),
border: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF3A3A3A)), // 线
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFFF9000)),
),
),
maxLength: 50,
),
GestureDetector(
onTap: () {
FunctionUtil.bottomSheetDialog(context, CreateTypeDialog(
onTap: (type) {
this.type = type;
setState(() {});
},
));
},
child: Container(
width: double.infinity,
height: 45,
margin: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
color: Color(0xFF202020),
borderRadius: BorderRadius.all(Radius.circular(7)),
),
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 10,
child: Text(
"分类",
style: TextStyle(color: Colors.white),
),
),
Positioned(
right: 10,
child: Text(
type == "" ? "添加" : type,
style: TextStyle(color: type == "" ? Colors.white : Color(0xFFFF9000)),
),
),
],
),
),
),
Container(
width: double.infinity,
height: 45,
margin: EdgeInsets.only(top: 17),
decoration: BoxDecoration(
color: Color(0xFF202020),
borderRadius: BorderRadius.all(Radius.circular(7)),
),
child: Container(),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 41),
child: Text(
"角色形象",
style: TextStyle(color: Color(0xFFFF9000), fontSize: 15),
),
),
Container(
margin: EdgeInsets.only(top: 15),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"形象描述",
style: TextStyle(color: Colors.white, fontSize: 14),
),
Text(
"随机生成",
style: TextStyle(color: Color(0xFFFF9000), fontSize: 10),
),
],
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 20),
padding: const EdgeInsets.only(left: 9, top: 5, right: 9),
decoration: BoxDecoration(
color: Color(0xFF262626),
borderRadius: BorderRadius.all(Radius.circular(6.6)),
),
child: TextField(
// controller: _textBgController,
keyboardType: TextInputType.name,
cursorColor: Color(0xFFFF9000),
// focusNode: _commentFocus,
decoration: InputDecoration.collapsed(hintText: '长相,场景,衣服', hintStyle: const TextStyle(fontSize: 12.0, color: Color(0xFF535353))),
textAlign: TextAlign.left,
maxLines: 3,
style: const TextStyle(fontSize: 14.0, color: Colors.white),
onChanged: _textImageChanged,
autofocus: false,
maxLength: 100,
),
),
Container(
margin: EdgeInsets.only(top: 15),
alignment: Alignment.centerLeft,
child: Text(
"风格选择",
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
// width: 500,
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 21),
height: 154,
child: GridView.count(
shrinkWrap: true,
//Widget之间间距
crossAxisSpacing: 12.0,
//Widget之间间距
mainAxisSpacing: 9.0,
//GridView内边距
padding: EdgeInsets.zero,
//Widget数量
crossAxisCount: 2,
//Widget宽高比例
childAspectRatio: 1.0,
//Widget列表
children: _item(styleList),
physics: const NeverScrollableScrollPhysics(),
// cellForRow
scrollDirection: Axis.horizontal)),
),
Container(
margin: EdgeInsets.only(top: 15),
alignment: Alignment.centerLeft,
child: Text(
"选择参考图像",
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
width: double.infinity,
height: 118,
margin: EdgeInsets.only(top: 17),
decoration: BoxDecoration(
color: Color(0xFF202020),
borderRadius: BorderRadius.all(Radius.circular(7)),
),
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
top: 38,
child: Image(width: 18, height: 18, image: AssetImage('assets/images/img_add.png')),
),
Positioned(
top: 77,
child: Text(
"将基于上传的参考图片生成基础模型",
style: TextStyle(color: Color(0xFF6F6F6F), fontSize: 10),
))
],
),
),
Container(
margin: EdgeInsets.only(top: 35),
width: size.width,
height: 30,
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 0,
child: Text(
"是否公开",
style: TextStyle(color: Colors.white, fontSize: 14),
)),
Positioned(
left: 70,
child: Text(
"审核中....",
style: TextStyle(color: Color(0xFF696969), fontSize: 12),
)),
Positioned(
right: 0,
child: Image(width: 52, height: 21, image: AssetImage('assets/images/ic_open_f.png')),
)
],
),
),
Container(
margin: EdgeInsets.symmetric(vertical: 48),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 116,
height: 37,
alignment: Alignment.center,
decoration:
BoxDecoration(border: Border.all(color: Color(0xFFFF9000), width: 1), borderRadius: BorderRadius.all(Radius.circular(7))),
child: Text(
"智能一键生成",
style: TextStyle(fontSize: 14, color: Color(0xFFFF9000)),
),
),
Container(
width: 191,
height: 37,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFFF9000),
borderRadius: BorderRadius.all(Radius.circular(7)),
),
child: Text(
"立即生成",
style: TextStyle(fontSize: 14, color: Colors.black),
),
),
],
),
),
],
),
),
),
);
}
_item(List<int> list) {
final size = MediaQuery.of(context).size;
final w113 = size.width / 3.185840707964602;
final h159 = size.width / 2.264150943396226;
final w105 = size.width / 3.428571428571429;
return list.map((res) {
int index = styleList.indexOf(res);
return GestureDetector(
onTap: () {
currentStyleIndex = index;
setState(() {});
},
child: Container(
alignment: Alignment.center,
child: Stack(
children: [
// ClipRRect(
// borderRadius: BorderRadius.all(Radius.circular(15)),
// child: CachedNetworkImage(
// width: w113,
// height: h159,
// fit: BoxFit.cover,
// imageUrl: res.imageUrl!,
// errorWidget: (context, url, error) => const Icon(Icons.error),
// ),
// ),
Container(
width: 72,
height: 72,
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.all(Radius.circular(7)),
border: Border.all(color: Color(0xFFFF9000), width: currentStyleIndex == index ? 1 : 0),
),
)
],
),
),
);
}).toList();
}
}

View File

@ -1,60 +0,0 @@
import 'package:flutter/material.dart';
import '../../custom/custom_popup.dart';
class TestPage extends StatefulWidget {
const TestPage({super.key});
@override
State<TestPage> createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Positioned(
top: 400,
left: 50,
child: CustomPopup(
menuBuilder: () {
return Container(
width: 50,
height: 150,
color: Colors.lightBlue,
);
},
pressType: PressType.singleClick,
child: Container(
width: 50,
height: 50,
color: Colors.black,
),
),
),
Positioned(
top: 400,
left: 150,
child: CustomPopup(
menuBuilder: () {
return Container(
width: 50,
height: 150,
color: Colors.lightBlue,
);
},
pressType: PressType.singleClick,
child: Container(
width: 50,
height: 50,
color: Colors.black,
),
),
),
],
),
);
}
}

View File

@ -8,6 +8,8 @@ import 'package:talk/tools/home/my_home_page.dart';
import 'package:talk/tools/me/me_page.dart';
import 'package:talk/tools/message/message_page.dart';
import '../common/func.dart';
import '../dialog/create_character_dialog.dart';
import '../network/NetworkConfig.dart';
import 'find/find_page.dart';
@ -154,20 +156,29 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
currentIndex = index;
});
_tabController.animateTo(index);
// switch (index) {
// case 0:
// case 1:
// currentIndex = index;
// _tabController.animateTo(currentIndex);
// break;
// case 2:
// FunctionUtil.bottomSheetDialog(context, CreateCharacterDialog(
// onTap: () {
// Navigator.pushNamed(context, "/CreatePage");
// },
// ));
// break;
// case 3:
// _tabController.animateTo(2);
// currentIndex = 2;
// _tabController.animateTo(currentIndex);
// break;
// case 4:
// _tabController.animateTo(3);
// break;
// default:
// _tabController.animateTo(index);
// currentIndex = 3;
// _tabController.animateTo(currentIndex);
// break;
// }
// setState(() {});
},
),
),

View File

@ -41,7 +41,7 @@ class _LoginPageState extends State<LoginPage> {
int _timeLeft = 60; //
bool _isCountingDown = false;
Timer? _timer;
Timer? _timer;
///
void getCode() {
@ -87,7 +87,7 @@ class _LoginPageState extends State<LoginPage> {
break;
case "login":
EasyLoading.showToast(newData['data']);
if(_timer!=null){
if (_timer != null) {
_timer!.cancel();
}
Navigator.pushReplacementNamed(context, "/HomePage");
@ -265,7 +265,7 @@ class _LoginPageState extends State<LoginPage> {
children: [
Expanded(
child: Container(
padding: const EdgeInsets.only(left: 17, bottom: 6),
padding: const EdgeInsets.only(left: 17),
child: TextField(
controller: _codeController,
onChanged: _codeChanged,
@ -305,7 +305,7 @@ class _LoginPageState extends State<LoginPage> {
height: h43,
width: w288,
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 17, bottom: 6),
padding: const EdgeInsets.only(left: 17),
decoration: const BoxDecoration(
color: Color(0x33FFFFFF),
borderRadius: BorderRadius.all(Radius.circular(7)),

View File

@ -2,11 +2,13 @@ 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/me/me_model.dart';
import '../../beans/me_character_info_bean.dart';
import '../../beans/user_info_bean.dart';
import '../../common/EventBusUtil.dart';
import '../../common/Global.dart';
import '../../network/NetworkConfig.dart';
import '../chat/chat_page.dart';
@ -161,28 +163,30 @@ class _MePageState extends State<MePage> {
// style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
// ),
// ),
Text(
'${userInfoBean.hasTalked}',
style: TextStyle(color: Colors.white, fontSize: 16),
),
Container(
margin: EdgeInsets.only(left: 6, right: 10),
margin: EdgeInsets.only(left: 6, right: 2),
child: Text(
'聊过',
style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
),
),
Text(
'${userInfoBean.hasTalked}',
style: TextStyle(color: Color(0xFFFF9000), fontSize: 16),
),
Container(
margin: EdgeInsets.only(left: 25, right: 2),
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),
),
style: const TextStyle(color: Color(0xFFFF9000), fontSize: 17),
),
],
),
@ -298,6 +302,52 @@ class _MePageState extends State<MePage> {
)
: Container(),
///广
GestureDetector(
onTap: () {
Map<String, dynamic> map = {
"playAd": "playAd",
};
invokeNativeMethod("playAd", map);
},
child: Container(
width: size.width,
height: 62,
margin: EdgeInsets.only(left: 15, right: 15, top: 20),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color(0xFFB0B6D3),
Color(0xFF96A5F5),
],
),
),
child: const Stack(
alignment: Alignment.center,
children: [
Positioned(
top: 15,
left: 12,
child: Text(
"看广告获得聊天次数",
style: TextStyle(fontSize: 12, color: Color(0xFF3248B6)),
)),
Positioned(
top: 34,
left: 12,
child: Text(
"看一次广告可获得10次聊天",
style: TextStyle(fontSize: 15, color: Color(0xFF3248B5)),
)),
Positioned(right: 15, child: Image(width: 36, height: 36, image: AssetImage('assets/images/ic_ad.png')))
],
),
),
),
// Container(
// height: h50,
// margin: EdgeInsets.symmetric(horizontal: 16),
@ -409,4 +459,12 @@ class _MePageState extends State<MePage> {
);
}).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

@ -19,7 +19,7 @@ class StartPage extends StatefulWidget {
class _StartPageState extends State<StartPage> {
late StreamSubscription subscription;
LoginModel _viewmodel = new LoginModel();
final LoginModel _viewmodel = LoginModel();
@override
void initState() {

View File

@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.1+2
environment:
sdk: '>=3.4.1 <4.0.0'
sdk: '>=2.17.1 <3.0.0'
dependencies:
@ -42,7 +42,7 @@ dependencies:
image_picker: ^0.8.4
permission_handler: ^10.4.5
image_gallery_saver: ^2.0.3
web_socket_channel: ^3.0.0
web_socket_channel: ^2.0.0
flutter_client_sse: ^2.0.1
expandable_text: ^2.3.0
card_swiper: ^3.0.1
@ -59,7 +59,7 @@ dev_dependencies:
sdk: flutter
flutter_lints: ^3.0.0
build_runner: ^2.4.11
build_runner: ^2.2.0
json_serializable: ^6.8.0