修改包名 androidlogo 充公我喜欢的 喜欢我的 最近来访

This commit is contained in:
YangYuhao 2023-07-07 14:17:08 +08:00
parent 6236085e57
commit 0872ad95fd
41 changed files with 923 additions and 133 deletions

View File

@ -42,9 +42,23 @@ android {
main.java.srcDirs += 'src/main/kotlin'
}
signingConfigs {
debug {
storeFile file('../leyuan.jks')
storePassword 'leyuan'
keyAlias = 'leyuan'
keyPassword 'leyuan'
}
release {
storeFile file('../leyuan.jks')
storePassword 'leyuan'
keyAlias = 'leyuan'
keyPassword 'leyuan'
}
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.circle_app"
applicationId "com.leyuan.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21

View File

@ -1,8 +1,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.circle_app">
package="com.leyuan.app">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.circle_app">
package="com.leyuan.app">
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -1,4 +1,4 @@
package com.example.circle_app
package com.leyuan.app
import io.flutter.embedding.android.FlutterActivity

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.circle_app">
package="com.leyuan.app">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.

View File

@ -1,111 +1,62 @@
import 'dart:ffi';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../network/api.dart';
import '../../network/dio_manager.dart';
import '../../util/util.dart';
import 'state.dart';
class FriendslistLogic extends GetxController {
final RefreshController refreshController = RefreshController();
final FriendslistState state = FriendslistState();
final type = Get.arguments as String;
int page = 1;
int isVip = 0;
bool isLoad = true;
List<UserInfo> lists = [];
@override
void onInit() async{
void onInit() async {
super.onInit();
initList();
}
initList() async{
if(page==1){
initList() async {
if (page == 1) {
lists.clear();
}
switch(type){
case "0":
var data =
await DioManager.instance.get(url: Api.followList, params: {
'page':page
});
var bean = BaseResponse<User>.fromJson(data, (data) => User.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if(page == 1){
refreshController.refreshCompleted();
}else{
refreshController.loadComplete();
}
return ;
case "1":
var data =
await DioManager.instance.get(url: Api.fansList, params: {
'page':page
});
var bean = BaseResponse<User>.fromJson(data, (data) => User.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if(page == 1){
refreshController.refreshCompleted();
}else{
refreshController.loadComplete();
}
return ;
case "2":
var data =
await DioManager.instance.get(url: Api.visitList, params: {
'page':page
});
var bean = BaseResponse<User>.fromJson(data, (data) => User.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if(page == 1){
refreshController.refreshCompleted();
}else{
refreshController.loadComplete();
}
return ;
case "3":
var data =
await DioManager.instance.get(url: Api.visitList, params: {
'page':page
});
var bean = BaseResponse<User>.fromJson(data, (data) => User.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if(page == 1){
refreshController.refreshCompleted();
}else{
refreshController.loadComplete();
}
break;
var data = await DioManager.instance
.get(url: Api.followList, params: {'page': page});
var bean = BaseResponse<User>.fromJson(data, (data) => User.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if (page == 1) {
refreshController.refreshCompleted();
} else {
refreshController.loadComplete();
}
}
setLike(int index) async {
var data = await DioManager.instance.post(
url: "${Api.setLike + lists[index].id.toString()}/follow",
params: {'status': lists[index].isLike? "0" : "1"});
var bean = BaseResponse<dynamic>.fromJson(
data,
(jsonData) => jsonData,
);
if (bean.isSuccess()) {
lists[index].isLike = !lists[index].isLike;
update();
}
showToast(bean.msg);
}
}
class User {
final List<UserInfo> lists;
final int total;
@ -114,7 +65,8 @@ class User {
factory User.fromJson(Map<String, dynamic> json) {
final List<dynamic> userList = json['lists'];
final List<UserInfo> users = userList.map((user) => UserInfo.fromJson(user)).toList();
final List<UserInfo> users =
userList.map((user) => UserInfo.fromJson(user)).toList();
final int total = json['total'];
return User(lists: users, total: total);
}
@ -131,7 +83,7 @@ class UserInfo {
final int gender;
final int role;
final int orientation;
bool isLike = true;
final double lng;
final double lat;
final String city;
@ -148,6 +100,7 @@ class UserInfo {
required this.gender,
required this.role,
required this.orientation,
this.isLike = true,
required this.lng,
required this.lat,
required this.city,
@ -173,4 +126,3 @@ class UserInfo {
);
}
}

View File

@ -28,7 +28,7 @@ class FriendslistPage extends StatelessWidget {
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
centerTitle: _getTitleName(logic.type),
centerTitle: "我喜欢的",
),
body: SafeArea(
child: logic.isLoad ? loaddingWidget(true) : logic.lists.isEmpty ? noResultWidget() : SmartRefresher(
@ -39,7 +39,7 @@ class FriendslistPage extends StatelessWidget {
padding: EdgeInsets.all(10.sp),
itemCount: logic.lists.length,
itemBuilder: (context, index) {
return ListItem(logic.lists[index]);
return ListItem(logic.lists[index],index);
},
),
),
@ -49,7 +49,7 @@ class FriendslistPage extends StatelessWidget {
});
}
Widget ListItem(UserInfo item) {
Widget ListItem(UserInfo item,int index) {
return GestureDetector(
onTap: (){
Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString());
@ -82,7 +82,7 @@ class FriendslistPage extends StatelessWidget {
left: 0,
bottom: 0,
child: item.vip>0 ?
child: item.vip!=null&&item.vip>0 ?
Image(
image: AssetImage(getBaseImage("vip")),
width: 44.sp,
@ -119,22 +119,22 @@ class FriendslistPage extends StatelessWidget {
// Pla
Spacer(),
GestureDetector(onTap: (){
showToast("私聊");
logic.setLike(index);
},
child: Container(
width: 60,
width: 75,
height: 28,
decoration: BoxDecoration(
color: Color(0xFFFF4D7C),
borderRadius: BorderRadius.circular(14),
),
child: Center(
child: Text(
"私聊",
style: TextStyle(fontSize: 14, color: Colors.white),
),
child:
Center(
child: Text(item.isLike?"取消喜欢":"喜欢", style: TextStyle(fontSize: 14, color: Colors.white)),
),
),),
),
),
],
),
),);
@ -174,20 +174,7 @@ class FriendslistPage extends StatelessWidget {
],
);
}
String _getTitleName(String type) {
switch (type) {
case "0":
return "我喜欢的";
case "1":
return "喜欢我的";
case "2":
return "最近访客";
case "3":
return "最近来访";
default:
return "";
}
}
void _onRefresh() async {
logic.page = 1;

View File

@ -0,0 +1,10 @@
import 'package:get/get.dart';
import 'logic.dart';
class LikelistBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => LikelistLogic());
}
}

View File

@ -0,0 +1,163 @@
import 'dart:ffi';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../network/api.dart';
import '../../network/dio_manager.dart';
import '../../util/util.dart';
import 'state.dart';
class LikelistLogic extends GetxController {
final RefreshController refreshController = RefreshController();
final LikelistState state = LikelistState();
int page = 1;
int isVip = 0;
bool isLoad = true;
List<UserListItem> lists = [];
@override
void onInit() async{
super.onInit();
initList();
}
initList() async{
if(page==1){
lists.clear();
}
var data =
await DioManager.instance.get(url: Api.fansList, params: {
'page':page
});
var bean = BaseResponse<UserList>.fromJson(data, (data) => UserList.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if(page == 1){
refreshController.refreshCompleted();
}else{
refreshController.loadComplete();
}
}
setLike(int index) async {
var data = await DioManager.instance.post(
url: "${Api.setLike + lists[index].user.id.toString()}/follow",
params: {'status': lists[index].isLike?"0":"1"});
var bean = BaseResponse<dynamic>.fromJson(
data,
(jsonData) => jsonData,
);
if (bean.isSuccess()) {
lists[index].isLike = !lists[index].isLike;
update();
}
showToast(bean.msg);
}
}
class User {
final int id;
final String nickname;
final String avatar;
final String signature;
final String birthday;
final int age;
final int vip;
final int gender;
final int role;
final int orientation;
final double lng;
final double lat;
final String city;
final String avatarThumb;
User({
required this.id,
required this.nickname,
required this.avatar,
required this.signature,
required this.birthday,
required this.age,
required this.vip,
required this.gender,
required this.role,
required this.orientation,
required this.lng,
required this.lat,
required this.city,
required this.avatarThumb,
});
factory User.fromJson(Map<String, dynamic> json) {
return User(
id: json['id'],
nickname: json['nickname'],
avatar: json['avatar'],
signature: json['signature'],
birthday: json['birthday'],
age: json['age'],
vip: json['vip'],
gender: json['gender'],
role: json['role'],
orientation: json['orientation'],
lng: json['lng'],
lat: json['lat'],
city: json['city'],
avatarThumb: json['avatar_thumb'],
);
}
}
class UserListItem {
final User user;
bool isLike;
UserListItem({
required this.user,
required this.isLike,
});
factory UserListItem.fromJson(Map<String, dynamic> json) {
return UserListItem(
user: User.fromJson(json['user']),
isLike: json['isLike'],
);
}
}
class UserList {
final List<UserListItem> lists;
UserList({
required this.lists,
});
factory UserList.fromJson(Map<String, dynamic> json) {
List<UserListItem> userItems = [];
if (json['lists'] != null) {
for (var item in json['lists']) {
userItems.add(UserListItem.fromJson(item));
}
}
return UserList(
lists: userItems,
);
}
}

View File

@ -0,0 +1,5 @@
class LikelistState {
LikelistState() {
///Initialize variables
}
}

View File

@ -0,0 +1,196 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../components/my_app_bar.dart';
import '../../router/app_routers.dart';
import '../../util/util.dart';
import 'logic.dart';
class LikelistPage extends StatelessWidget {
LikelistPage({Key? key}) : super(key: key);
final logic = Get.find<LikelistLogic>();
final state = Get.find<LikelistLogic>().state;
@override
Widget build(BuildContext context) {
return GetBuilder<LikelistLogic>(builder: (logic) {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBaseImage("home_back")),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
centerTitle: "喜欢我的",
),
body: SafeArea(
child: logic.isLoad
? loaddingWidget(true)
: logic.lists.isEmpty
? noResultWidget()
: SmartRefresher(
controller: logic.refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
child: ListView.builder(
padding: EdgeInsets.all(10.sp),
itemCount: logic.lists.length,
itemBuilder: (context, index) {
return ListItem(logic.lists[index], index);
},
),
),
),
),
);
});
}
Widget ListItem(UserListItem item, int index) {
return GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity,
arguments: item.user.id.toString());
},
child: Container(
margin: EdgeInsets.only(bottom: 21),
child: Row(
children: [
Stack(
children: [
ClipOval(
child: GestureDetector(
onTap: () {
var imgList = <String>[];
imgList.add(item.user.avatar);
Get.toNamed(AppRoutes.Swiper,
arguments: {'imaglist': imgList, 'index': 0});
},
child: CachedNetworkImage(
fit: BoxFit.cover,
imageUrl: item.user.avatar,
width: 53.sp,
height: 53.sp,
),
),
),
Positioned(
right: 0,
left: 0,
bottom: 0,
child: item.isLike
? Image(
image: AssetImage(getBaseImage("vip")),
width: 44.sp,
height: 18.sp,
)
: Container(),
)
],
),
SizedBox(width: 10.sp),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
item.user.nickname,
style: const TextStyle(
color: Colors.white70,
fontSize: 14,
fontWeight: FontWeight.bold),
),
SizedBox(width: 4.sp),
// SizedBox(height: 8.sp),
_buildInfoRow(item),
// Placeholder image
],
),
SizedBox(height: 8.sp),
Container(
width: 150.sp,
child: Text(
item.user.signature,
style: TextStyle(fontSize: 12.sp, color: Color(0xFFB7BECC)),
),
),
],
),
// Pla
Spacer(),
GestureDetector(
onTap: () {
logic.setLike(index);
},
child: Container(
width: 75,
height: 28,
decoration: BoxDecoration(
color: Color(0xFFFF4D7C),
borderRadius: BorderRadius.circular(14),
),
child: Center(
child: Text(item.isLike ? "互相关注" : "关注",
style: TextStyle(fontSize: 14, color: Colors.white)),
),
),
),
],
),
),
);
}
Widget _buildInfoRow(UserListItem userInfoBean) {
String ageMsg = getAgeCOntent(
userInfoBean.user.gender,
userInfoBean.user.age,
userInfoBean.user.role,
userInfoBean.user.orientation);
return Row(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color.fromRGBO(141, 255, 248, 1.0),
Color.fromRGBO(181, 211, 255, 1.0),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp),
child: Text(
ageMsg,
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
),
),
SizedBox(width: 6.sp),
],
);
}
void _onRefresh() async {
logic.page = 1;
logic.initList();
}
void _onLoading() async {
logic.page = logic.page + 1;
logic.initList();
}
}

View File

@ -28,6 +28,7 @@ class MinefragmentLogic extends GetxController {
int orientation = -1;
String enterHomeInfoMsg = "进入主页";
String JoinedCircle = "";
@override
void onInit() async {
@ -43,9 +44,11 @@ class MinefragmentLogic extends GetxController {
like_count = bean.data.likeCount ?? 0;
like_me_count = bean.data.likeMeCount ?? 0;
recent_visit_count = bean.data.recentVisitCount ?? 0;
JoinedCircle = "${"加入了"+bean.data.joininterestcount.toString()}个圈子";
SharedPreferences sharedPreferences =
await SharedPreferences.getInstance();
int likeMeCount = sharedPreferences.getInt(SharedPreferencesHelper.LIKEMECOUNT)??0;
int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0;
sharedPreferences.setString(SharedPreferencesHelper.PHOTO, bean.data.phone);
@ -151,6 +154,7 @@ class MineResponseBean {
String? vipExpireDate;
int? vipExpireDays;
String phone;
int? joininterestcount;
MineResponseBean(
{required this.user,
@ -159,7 +163,8 @@ class MineResponseBean {
required this.recentVisitCount,
this.vipExpireDate,
this.vipExpireDays,
required this.phone});
required this.phone,
required this.joininterestcount});
factory MineResponseBean.fromJson(Map<String, dynamic> json) {
return MineResponseBean(
@ -170,6 +175,9 @@ class MineResponseBean {
recentVisitCount: json['recent_visit_count'],
vipExpireDate: json['vip_expire_date'],
vipExpireDays: json['vip_expire_days'],
joininterestcount: json['join_interest_count'],
);
}
}

View File

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:circle_app/router/app_routers.dart';
import 'package:flutter/material.dart';
@ -51,7 +53,7 @@ class MinefragmentPage extends StatelessWidget {
fit: BoxFit.fill,
),
),
_CircleLiveView(),
_CircleLiveView(logic),
],
),
),
@ -60,10 +62,10 @@ class MinefragmentPage extends StatelessWidget {
});
}
Widget _CircleLiveView() {
Widget _CircleLiveView(MinefragmentLogic logic) {
return Container(
child: Column(
children: [_CircleItemView(), _HelpItemView(), _SetUpItemView()],
children: [_CircleItemView(logic), _HelpItemView(), _SetUpItemView()],
),
);
}
@ -151,7 +153,7 @@ class MinefragmentPage extends StatelessWidget {
);
}
Widget _CircleItemView() {
Widget _CircleItemView(MinefragmentLogic logic) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
@ -179,7 +181,7 @@ class MinefragmentPage extends StatelessWidget {
Row(
children: [
Text(
"加入了3个圈子",
logic.JoinedCircle,
style: TextStyle(color: Colors.white30),
),
Image(
@ -207,7 +209,7 @@ class MinefragmentPage extends StatelessWidget {
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Get.toNamed(AppRoutes.FriendsActivity, arguments: "0");
Get.toNamed(AppRoutes.FriendsActivity);
},
child: Container(
child: Column(
@ -249,7 +251,7 @@ class MinefragmentPage extends StatelessWidget {
sharedPreferences.setInt(SharedPreferencesHelper.LIKEMECOUNT, logic.like_me_count);
});
}
Get.toNamed(AppRoutes.FriendsActivity, arguments: "1");
Get.toNamed(AppRoutes.LikeListActivity);
},
child: Stack(
children: [
@ -308,13 +310,8 @@ class MinefragmentPage extends StatelessWidget {
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
sharedPreferences.setInt(SharedPreferencesHelper.RECENTVISITCOUNT, logic.recent_visit_count);
});
}
Get.toNamed(AppRoutes.FriendsActivity, arguments: "2");
Get.toNamed(AppRoutes.VisitorListActivity);
},
child: Stack(
children: [

View File

@ -0,0 +1,10 @@
import 'package:get/get.dart';
import 'logic.dart';
class VisitorlistBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => VisitorlistLogic());
}
}

View File

@ -0,0 +1,146 @@
import 'dart:ffi';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../network/api.dart';
import '../../network/dio_manager.dart';
import '../../util/util.dart';
import 'state.dart';
class VisitorlistLogic extends GetxController {
final RefreshController refreshController = RefreshController();
final VisitorlistState state = VisitorlistState();
int page = 1;
int isVip = 0;
bool isLoad = true;
List<UserListItem> lists = [];
@override
void onInit() async {
super.onInit();
initList();
}
initList() async {
if (page == 1) {
lists.clear();
}
var data =
await DioManager.instance.get(url: Api.visitList, params: {
'page': page
});
var bean = BaseResponse<UserList>.fromJson(
data, (data) => UserList.fromJson(data));
if (bean.isSuccess()) {
lists.addAll(bean.data.lists);
}
isLoad = false;
update();
if (page == 1) {
refreshController.refreshCompleted();
} else {
refreshController.loadComplete();
}
}
}
class User {
final int id;
final String nickname;
final String avatar;
final String signature;
final String birthday;
final int age;
final int vip;
final int gender;
final int role;
final int orientation;
final double lng;
final double lat;
final String city;
final String avatarThumb;
User({
required this.id,
required this.nickname,
required this.avatar,
required this.signature,
required this.birthday,
required this.age,
required this.vip,
required this.gender,
required this.role,
required this.orientation,
required this.lng,
required this.lat,
required this.city,
required this.avatarThumb,
});
factory User.fromJson(Map<String, dynamic> json) {
return User(
id: json['id'],
nickname: json['nickname'],
avatar: json['avatar'],
signature: json['signature'],
birthday: json['birthday'],
age: json['age'],
vip: json['vip'],
gender: json['gender'],
role: json['role'],
orientation: json['orientation'],
lng: json['lng'],
lat: json['lat'],
city: json['city'],
avatarThumb: json['avatar_thumb'],
);
}
}
class UserListItem {
final User user;
final String accountId;
UserListItem({
required this.user,
required this.accountId,
});
factory UserListItem.fromJson(Map<String, dynamic> json) {
return UserListItem(
user: User.fromJson(json['user']),
accountId: json['account_id'],
);
}
}
class UserList {
final List<UserListItem> lists;
UserList({
required this.lists,
});
factory UserList.fromJson(Map<String, dynamic> json) {
List<UserListItem> userItems = [];
if (json['lists'] != null) {
for (var item in json['lists']) {
userItems.add(UserListItem.fromJson(item));
}
}
return UserList(
lists: userItems,
);
}
}

View File

@ -0,0 +1,5 @@
class VisitorlistState {
VisitorlistState() {
///Initialize variables
}
}

View File

@ -0,0 +1,189 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../components/my_app_bar.dart';
import '../../router/app_routers.dart';
import '../../util/util.dart';
import 'logic.dart';
class VisitorlistPage extends StatelessWidget {
VisitorlistPage({Key? key}) : super(key: key);
final logic = Get.find<VisitorlistLogic>();
final state = Get.find<VisitorlistLogic>().state;
@override
Widget build(BuildContext context) {
return GetBuilder<VisitorlistLogic>(builder: (logic) {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBaseImage("home_back")),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
centerTitle:"最近访客",
),
body: SafeArea(
child: logic.isLoad ? loaddingWidget(true) : logic.lists.isEmpty ? noResultWidget() : SmartRefresher(
controller: logic.refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
child: ListView.builder(
padding: EdgeInsets.all(10.sp),
itemCount: logic.lists.length,
itemBuilder: (context, index) {
return ListItem(logic.lists[index],index);
},
),
),
),
),
);
});
}
Widget ListItem(UserListItem item,int index) {
return GestureDetector(
onTap: (){
Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.user.id.toString());
},
child: Container(
margin: EdgeInsets.only(bottom: 21),
child: Row(
children: [
Stack(children: [
ClipOval(
child: GestureDetector(
onTap: () {
var imgList = <String>[];
imgList.add(item.user.avatar);
Get.toNamed(AppRoutes.Swiper, arguments: {
'imaglist': imgList,
'index': 0
});
},
child: CachedNetworkImage(
fit: BoxFit.cover,
imageUrl: item.user.avatar,
width: 53.sp,
height: 53.sp,
),
),
),
Positioned(
right: 0,
left: 0,
bottom: 0,
child: item.user.vip!=0 ?
Image(
image: AssetImage(getBaseImage("vip")),
width: 44.sp,
height: 18.sp,
):Container(),)
],),
SizedBox(width: 10.sp),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
item.user.nickname,
style: const TextStyle(color :Colors.white70,fontSize: 14, fontWeight: FontWeight.bold),
),
SizedBox(width: 4.sp),
// SizedBox(height: 8.sp),
_buildInfoRow(item),
// Placeholder image
],
),
SizedBox(height: 8.sp),
Container(
width: 150.sp,
child: Text(
item.user.signature,
style: TextStyle(fontSize: 12.sp, color: Color(0xFFB7BECC)),
),
),
],
),
// Pla
Spacer(),
GestureDetector(onTap: (){
},
child: Container(
width: 60,
height: 28,
decoration: BoxDecoration(
color: Color(0xFFFF4D7C),
borderRadius: BorderRadius.circular(14),
),
child: Center(
child: Text("私聊", style: TextStyle(fontSize: 14, color: Colors.white)),
)
,
),),
],
),
),);
}
Widget _buildInfoRow(UserListItem userInfoBean) {
String ageMsg = getAgeCOntent(userInfoBean.user.gender, userInfoBean.user.age,
userInfoBean.user.role, userInfoBean.user.orientation);
return Row(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: LinearGradient(
colors: [
Color.fromRGBO(141, 255, 248, 1.0),
Color.fromRGBO(181, 211, 255, 1.0),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
padding: EdgeInsets.only(
top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp),
child: Text(
ageMsg ,
style: TextStyle(
color: Colors.black,
fontSize: 10,
),
),
),
SizedBox(width: 6.sp),
],
);
}
void _onRefresh() async {
logic.page = 1;
logic.initList();
}
void _onLoading() async {
logic.page = logic.page + 1;
logic.initList();
}
}

View File

@ -18,6 +18,8 @@ import 'package:circle_app/app/help/binding.dart';
import 'package:circle_app/app/help/view.dart';
import 'package:circle_app/app/home/binding.dart';
import 'package:circle_app/app/home/view.dart';
import 'package:circle_app/app/likelist/binding.dart';
import 'package:circle_app/app/likelist/view.dart';
import 'package:circle_app/app/login/login/view.dart';
import 'package:circle_app/app/minefragment/binding.dart';
import 'package:circle_app/app/minefragment/view.dart';
@ -46,6 +48,7 @@ import 'package:circle_app/app/text/binding.dart';
import 'package:circle_app/app/text/view.dart';
import 'package:circle_app/app/userinfo/binding.dart';
import 'package:circle_app/app/userinfo/view.dart';
import 'package:circle_app/app/visitorlist/view.dart';
import 'package:circle_app/app/webview/binding.dart';
import 'package:circle_app/app/webview/view.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
@ -54,6 +57,7 @@ import 'package:get/get_navigation/src/routes/get_route.dart';
import '../app/blacklist/view.dart';
import '../app/circle/binding.dart';
import '../app/splash/view.dart';
import '../app/visitorlist/binding.dart';
import 'app_routers.dart';
class AppPages {
@ -179,5 +183,15 @@ class AppPages {
page: () => MyfeedbacklistPage(),
binding: MyfeedbacklistBinding(),
),
GetPage(
name: AppRoutes.LikeListActivity,
page: () => LikelistPage(),
binding: LikelistBinding(),
),
GetPage(
name: AppRoutes.VisitorListActivity,
page: () => VisitorlistPage(),
binding: VisitorlistBinding(),
),
];
}

View File

@ -11,6 +11,8 @@ abstract class AppRoutes {
static const BlackActivity = '/user/BlackActivity';
static const HelpActivity = '/user/HelpActivity';
static const FriendsActivity = '/user/FriendsActivity';
static const LikeListActivity = '/user/LikeListActivity';
static const VisitorListActivity = '/user/VisitorListActivity';
static const UserInfoActivity = '/user/UserInfoActivity';
static const ReportActivity = '/user/ReportActivity';
static const FeedbackActivity = '/user/FeedbackActivity';

View File

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:circle_app/util/util.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
@ -84,11 +85,13 @@ class CacheUtil {
// Get.back();
} else if (value >= 0) {
// Get.back();
showToast("正在清理中···");
//showToast("正在清理中···");
SmartDialog.showLoading(msg: "正在清理中···");
Future.delayed(Duration(seconds: 2), () async {
//
await delDir(_tempDir);
await loadCache();
SmartDialog.dismiss();
showToast("清理缓存成功");
callback("0KB");
});
@ -96,6 +99,7 @@ class CacheUtil {
}
} catch (e) {
print(e);
SmartDialog.dismiss();
showToast("清除缓存失败");
}

View File

@ -257,4 +257,7 @@ navigateToUserAgreement(){
//
navigateToPrivacyPolicy(){
Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"隐私协议","url":"https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1"});
}
}
//
//

View File

@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
set(BINARY_NAME "circle_app")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.circle_app")
set(APPLICATION_ID "com.leyuan.app")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.