first commit
1
untitled/lib/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
53c54fc3-dd3f-4d4d-9385-bc1001382434
|
||||
46
untitled/lib/Configure.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'config/_.dart';
|
||||
import 'package:device_info/device_info.dart';
|
||||
|
||||
/*
|
||||
* 各种工具和配置的初始化
|
||||
*/
|
||||
class Configure {
|
||||
|
||||
static Future init() async {
|
||||
// 运行初始
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// SharedPreferences 初始化
|
||||
await SPreferences.init();
|
||||
|
||||
// 是否第一次打开的判断
|
||||
Config.isFirstOpen = !SPreferences().getBool("isFirstOpen");
|
||||
|
||||
// 是否第一次打开的判断
|
||||
Config.isLogin = !SPreferences().getIsLogin();
|
||||
|
||||
// 如果不是第一次打开,那么设置主题色,否则不设置
|
||||
if (!Config.isFirstOpen) {
|
||||
Core.SetStatusThemeColor();
|
||||
}
|
||||
|
||||
// 初始化极光
|
||||
JiGuangPush();
|
||||
|
||||
// 初始化事件控制中心
|
||||
Config.eventBus = EventBus();
|
||||
|
||||
// 读取保存设备信息
|
||||
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
Config.isAndroid
|
||||
? Config.androidDeviceInfo = await deviceInfoPlugin.androidInfo
|
||||
: Config.iosDeviceInfo = await deviceInfoPlugin.iosInfo;
|
||||
|
||||
// 保存App软件包信息
|
||||
Config.packageInfo = await PackageInfo.fromPlatform();
|
||||
}
|
||||
}
|
||||
21
untitled/lib/R.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
class R {
|
||||
/// 静态资源配置,程序自动生成,请勿手动修改
|
||||
/// 
|
||||
static final String libStaticImgUpdateIcClosePng = 'lib/static/img/update_ic_close.png';
|
||||
/// 
|
||||
static final String libStaticImgTaxiPng = 'lib/static/img/taxi.png';
|
||||
/// 
|
||||
static final String libStaticImgDsStore = 'lib/static/img/.DS_Store';
|
||||
/// 
|
||||
static final String libStaticImgWelcome3Png = 'lib/static/img/welcome3.png';
|
||||
/// 
|
||||
static final String libStaticImgWelcome2Png = 'lib/static/img/welcome2.png';
|
||||
/// 
|
||||
static final String libStaticImgUpdateBgAppTopPng = 'lib/static/img/update_bg_app_top.png';
|
||||
/// 
|
||||
static final String libStaticImgLogoPng = 'lib/static/img/logo.png';
|
||||
/// 
|
||||
static final String libStaticImgViplogoPng = 'lib/static/img/vipLogo.png';
|
||||
/// 
|
||||
static final String libStaticImgBackPng = 'lib/static/img/back.png';
|
||||
}
|
||||
1
untitled/lib/config/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
90f95b79-eab7-4698-ade6-5337af05eef9
|
||||
22
untitled/lib/config/Colors.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorConfig {
|
||||
|
||||
// 主题色
|
||||
static const Color ThemeColor = Color(0XFFfb7299);
|
||||
// static const Color ThemeColor = Color(0XFFffd101);
|
||||
// 比主题稍微淡一点的主题色
|
||||
static const Color ThemeOtherColor = Color(0XFFfe7fa2);
|
||||
// cell 左侧图标的颜色
|
||||
static const Color IconColor = Color(0XFFc3c0c0);
|
||||
// 某些标题的黑色
|
||||
static const Color TitleColor = Color(0XFF333333);
|
||||
// 某些稍微灰色一点的字体颜色
|
||||
static const Color TextColor = Color(0XFF7e7979);
|
||||
// 未激活时候的字体颜色
|
||||
static const Color NoActiveColor = Color(0XFFd3d2d2);
|
||||
static const Color LineColor = Color(0XFFefefef);
|
||||
// 白色背景
|
||||
static const Color WhiteBackColor = Colors.white;
|
||||
|
||||
}
|
||||
221
untitled/lib/config/Index.dart
Normal file
@@ -0,0 +1,221 @@
|
||||
import 'dart:io';
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:intro_views_flutter/Models/page_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
|
||||
class Config {
|
||||
|
||||
/// 第一次打开,本地无值,返回false取反为true所以显示welcome
|
||||
/// 第二次打开,本地有值,返回true取反false,所以显示app页面
|
||||
static bool isFirstOpen = false;
|
||||
|
||||
// 第一次打开,未登录,本地无值,返回false,取反为true,访问登录页面
|
||||
// 第二次打开,已登录,本地有值,返回true,取反为返回false,访问app页面
|
||||
static bool isLogin = true;
|
||||
|
||||
/// App 的名字
|
||||
static String appName = "屁桃儿";
|
||||
/// 保存 App安装包信息
|
||||
static PackageInfo packageInfo;
|
||||
|
||||
/// 是否为 android
|
||||
static bool isAndroid = Platform.isAndroid;
|
||||
/// 保存 android 设备信息
|
||||
static AndroidDeviceInfo androidDeviceInfo;
|
||||
|
||||
/// 是否为 ios
|
||||
static bool isIos = Platform.isIOS;
|
||||
/// 保存 ios 设备信息
|
||||
static IosDeviceInfo iosDeviceInfo;
|
||||
/// IOS app 下载地址
|
||||
// static String iosDownApkUrl = "https://apps.apple.com/cn/app/qq/id444934666";
|
||||
static String iosDownApkUrl = "itms-apps://itunes.apple.com/cn/app/id444934666";
|
||||
|
||||
static int currentIndex = 0;
|
||||
|
||||
// 保存视频数组
|
||||
static List<Feeds> feeds = [];
|
||||
|
||||
/// 首页 /home.html
|
||||
static String h5IpUrl = "http://47.114.153.249/page/";
|
||||
static String shareIpUrl = "http://47.114.153.249/share/";
|
||||
static String h5DomainUrl = "http://www.geekhelp.cn/page/";
|
||||
|
||||
/// 极光推送的配置
|
||||
static final Map<String, dynamic> JgConfig = {
|
||||
"appKey": 'd4e22ab876276f4a374880ca',
|
||||
"channel": 'pitaoer',
|
||||
"production": true,
|
||||
"debug": false,
|
||||
};
|
||||
|
||||
/// 首页底部Tab的控制器
|
||||
static PageController tabController;
|
||||
|
||||
/// 事件控制中心
|
||||
static EventBus eventBus;
|
||||
|
||||
static List vipList = [
|
||||
{
|
||||
"id": 1,
|
||||
"vipTitle": "月卡",
|
||||
"vipMoney": 30,
|
||||
"vipDay": 1,
|
||||
"vipExplain": [
|
||||
"1:✅ 可以收藏(单图收藏&写真收藏)",
|
||||
"2:❎ 无法保存图片到相册",
|
||||
"3:❎ 无法使用【成人视频】功能",
|
||||
"4:❎ 无法下载【成人视频】功能"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"vipTitle": "季卡",
|
||||
"vipMoney": 88,
|
||||
"vipDay": 0.9,
|
||||
"vipExplain": [
|
||||
"1:✅ 可以收藏(单图收藏&写真收藏)",
|
||||
"2:✅ 可以下载保存到相册",
|
||||
"3:❎ 无法使用【成人视频】功能",
|
||||
"4:❎ 无法下载【成人视频】功能"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"vipTitle": "年卡",
|
||||
"vipMoney": 324,
|
||||
"vipDay": 0.8,
|
||||
"vipExplain": [
|
||||
"1:✅ 可以收藏(单图收藏&写真收藏)",
|
||||
"2:✅ 可以下载保存到相册",
|
||||
"3:✅ 可以使用【成人视频】功能",
|
||||
"4:✅ 可以下载【成人视频】功能"
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
/// 接口地址
|
||||
static final Map<String, dynamic> ApiUrl = {
|
||||
|
||||
// 写真图片接口基地址
|
||||
'PhotoBaseUrl': 'http://192.168.0.105:3000/api/json',
|
||||
// 'PhotoBaseUrl': 'http://120.27.144.174:3000/api/json',
|
||||
|
||||
// 'VideoBaseUrl': 'http://47.114.153.249:1314',
|
||||
'VideoBaseUrl': 'http://192.168.0.105:8090/api',
|
||||
|
||||
// 视频接口基地址
|
||||
'ApiList': {
|
||||
'update': '/updateVersion', // App升级接口
|
||||
'index': '/index', // 首页
|
||||
'class': '/class', // 获取分类菜单
|
||||
'login': '/login', // 登录
|
||||
'register': '/register', // 注册
|
||||
'agentreg': '/agentreg', // 代理注册
|
||||
'freeUse': '/freeUse', // vip计数
|
||||
'place': '/placeOrder', // 办理vip
|
||||
'orderStatus': '/orderStatus', // 查询购买记录
|
||||
|
||||
'agentInfo': '/agent/info', // 【新接口,替换】代替原本的详情
|
||||
'info': '/info', // 进入详情
|
||||
|
||||
'classList': '/classList', // 获取分类列表下数据
|
||||
'agentClassList': '/agent/classList', //【新接口,替换】 代替原本的 获取分类列表下数据
|
||||
|
||||
'mechanism': '/mechanism', // 机构列表
|
||||
|
||||
'mechanismList': '/mechanismList', // 机构列表点击进入详情
|
||||
'agentMechanismList': '/agent/mechanismList', // 【新接口,替换】机构列表点击进入详情
|
||||
|
||||
'allModel': '/allModel', // 模特列表
|
||||
'modelList': '/modelList', // 进入模特的个人套图页
|
||||
|
||||
'agentRecently': '/agent/recently', // 最近更新
|
||||
'agentSearch': '/agent/search', // 搜索接口
|
||||
|
||||
'agentRandom': '/agent/random', // 随机展示
|
||||
|
||||
|
||||
'videoType': '/likeList'
|
||||
}
|
||||
};
|
||||
|
||||
static final pages = [
|
||||
PageViewModel(
|
||||
pageColor: ColorConfig.ThemeColor,
|
||||
body: Text(
|
||||
'一款正经的模特写真应用',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(17.0)),
|
||||
),
|
||||
title: Text(
|
||||
Config.appName,
|
||||
style: TextStyle(fontSize: Screen.setFontSize(30.0)),
|
||||
),
|
||||
textStyle: TextStyle(color: Colors.white),
|
||||
mainImage: Image.asset(
|
||||
R.libStaticImgLogoPng,
|
||||
height: Screen.setHeight(225.0),
|
||||
width: Screen.setWidth(225.0),
|
||||
alignment: Alignment.center,
|
||||
)),
|
||||
PageViewModel(
|
||||
pageColor: const Color(0xFF03A9F4),
|
||||
body: Text(
|
||||
'基于谷歌 Flutter+Dart 开发,体验更丝滑更流畅,响应速度让人惊叹',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(17.0)),
|
||||
),
|
||||
title: Text(
|
||||
'流畅极致',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(30.0)),
|
||||
),
|
||||
textStyle: TextStyle(color: Colors.white),
|
||||
mainImage: Image.asset(
|
||||
R.libStaticImgWelcome2Png,
|
||||
height: Screen.setHeight(255.0),
|
||||
width: Screen.setWidth(255.0),
|
||||
alignment: Alignment.center,
|
||||
)),
|
||||
PageViewModel(
|
||||
pageColor: const Color(0xFF8BC34A),
|
||||
body: Text(
|
||||
'国内外100多家写真机构,198万张高清模特写真,有你喜欢的',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(17.0)),
|
||||
),
|
||||
title: Text(
|
||||
'全面丰富',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(30.0)),
|
||||
),
|
||||
mainImage: Image.asset(
|
||||
R.libStaticImgWelcome3Png,
|
||||
height: Screen.setHeight(255.0),
|
||||
width: Screen.setWidth(255.0),
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
textStyle: TextStyle(color: Colors.white),
|
||||
),
|
||||
PageViewModel(
|
||||
pageColor: const Color(0xFF607D8B),
|
||||
body: Text(
|
||||
'点击【进入】开始使用!',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(17.0)),
|
||||
),
|
||||
title: Text(
|
||||
'开始使用',
|
||||
style: TextStyle(fontSize: Screen.setFontSize(30.0)),
|
||||
),
|
||||
mainImage: Image.asset(
|
||||
R.libStaticImgTaxiPng,
|
||||
height: Screen.setHeight(255.0),
|
||||
width: Screen.setWidth(255.0),
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
textStyle: TextStyle(color: Colors.white),
|
||||
),
|
||||
];
|
||||
}
|
||||
4
untitled/lib/config/_.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
library config;
|
||||
|
||||
export 'Colors.dart';
|
||||
export 'Index.dart';
|
||||
1
untitled/lib/db/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
ac4d75e7-753e-48af-8808-f26bd74a9f87
|
||||
64
untitled/lib/db/SQLite.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'dart:io';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
|
||||
class SQLite {
|
||||
static final SQLite _singleton = SQLite._internal();
|
||||
factory SQLite() => _singleton;
|
||||
SQLite._internal();
|
||||
static Database _db;
|
||||
|
||||
Future<Database> get db async {
|
||||
if (_db != null) {
|
||||
return _db;
|
||||
}
|
||||
_db = await _initDB();
|
||||
return _db;
|
||||
}
|
||||
|
||||
Future<Database> _initDB() async {
|
||||
Directory documentsDirectory = await getApplicationDocumentsDirectory();
|
||||
String path = join(documentsDirectory.path, 'MiTaoShe');
|
||||
print("documentsDirectory.path ============ : ${path}");
|
||||
return await openDatabase(
|
||||
path,
|
||||
version: 1,
|
||||
onCreate: _onCreate
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future _onCreate(Database db, int version) async {
|
||||
/// 创建like 喜欢表
|
||||
await db.execute("CREATE TABLE Like ("
|
||||
"id integer primary key AUTOINCREMENT,"
|
||||
"preview TEXT,"
|
||||
"source TEXT,"
|
||||
"title TEXT,"
|
||||
"totals TEXT,"
|
||||
"user TEXT"
|
||||
")");
|
||||
|
||||
/// 创建Menu 菜单 Principal(默认菜单) 表
|
||||
await db.execute("CREATE TABLE Principal ("
|
||||
"id integer primary key AUTOINCREMENT,"
|
||||
"title TEXT,"
|
||||
"page integer"
|
||||
")");
|
||||
|
||||
/// 创建Menu 菜单 Additional(可选菜单) 表
|
||||
await db.execute("CREATE TABLE Additional ("
|
||||
"id integer primary key AUTOINCREMENT,"
|
||||
"title TEXT,"
|
||||
"page integer"
|
||||
")");
|
||||
|
||||
/// 创建 单图收藏 表
|
||||
await db.execute("CREATE TABLE SingleGraph ("
|
||||
"id integer primary key AUTOINCREMENT,"
|
||||
"src TEXT"
|
||||
")");
|
||||
}
|
||||
|
||||
}
|
||||
1
untitled/lib/entity/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
ec25c7b1-6f31-44ab-90df-f11a67fdde74
|
||||
164
untitled/lib/entity/AgentClassListEntity.dart
Normal file
@@ -0,0 +1,164 @@
|
||||
import 'AgentInfoEntity.dart';
|
||||
|
||||
class AgentClassListEntity {
|
||||
int status;
|
||||
AgentClassListData data;
|
||||
|
||||
AgentClassListEntity({this.status, this.data});
|
||||
|
||||
AgentClassListEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
data = json['data'] != null ? new AgentClassListData.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AgentClassListData {
|
||||
dynamic total;
|
||||
int num;
|
||||
List<ItemList> list;
|
||||
String page;
|
||||
|
||||
AgentClassListData({this.total, this.num, this.list, this.page});
|
||||
|
||||
AgentClassListData.fromJson(Map<String, dynamic> json) {
|
||||
total = json['total'];
|
||||
num = json['num'];
|
||||
page = json['page'];
|
||||
if (json['list'] != null) {
|
||||
list = new List<ItemList>();
|
||||
json['list'].forEach((v) {
|
||||
list.add(new ItemList.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['total'] = this.total;
|
||||
data['num'] = this.num;
|
||||
data['page'] = this.page;
|
||||
if (this.list != null) {
|
||||
data['list'] = this.list.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ItemList {
|
||||
String id;
|
||||
String catid;
|
||||
String title;
|
||||
String renwu;
|
||||
String biaoqian;
|
||||
String jigou;
|
||||
String bianhao;
|
||||
String faxingshijian;
|
||||
String shuliang;
|
||||
String zhuangtai;
|
||||
String shijian;
|
||||
String tuijian;
|
||||
String classname;
|
||||
List<Biaoqianlist> biaoqianlist;
|
||||
List<Biaoqianlist> jigoulist;
|
||||
String renwunlist;
|
||||
String isgood;
|
||||
String imgSrc;
|
||||
List<Biaoqianlist> renwulist;
|
||||
|
||||
ItemList(
|
||||
{this.id,
|
||||
this.catid,
|
||||
this.title,
|
||||
this.renwu,
|
||||
this.biaoqian,
|
||||
this.jigou,
|
||||
this.bianhao,
|
||||
this.faxingshijian,
|
||||
this.shuliang,
|
||||
this.zhuangtai,
|
||||
this.shijian,
|
||||
this.tuijian,
|
||||
this.classname,
|
||||
this.biaoqianlist,
|
||||
this.jigoulist,
|
||||
this.renwunlist,
|
||||
this.isgood,
|
||||
this.imgSrc,
|
||||
this.renwulist});
|
||||
|
||||
ItemList.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
catid = json['catid'];
|
||||
title = json['title'];
|
||||
renwu = json['renwu'];
|
||||
biaoqian = json['biaoqian'];
|
||||
jigou = json['jigou'];
|
||||
bianhao = json['bianhao'];
|
||||
faxingshijian = json['faxingshijian'];
|
||||
shuliang = json['shuliang'];
|
||||
zhuangtai = json['zhuangtai'];
|
||||
shijian = json['shijian'];
|
||||
tuijian = json['tuijian'];
|
||||
classname = json['classname'];
|
||||
if (json['biaoqianlist'] != null) {
|
||||
biaoqianlist = new List<Biaoqianlist>();
|
||||
json['biaoqianlist'].forEach((v) {
|
||||
biaoqianlist.add(new Biaoqianlist.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['jigoulist'] != null) {
|
||||
jigoulist = new List<Biaoqianlist>();
|
||||
json['jigoulist'].forEach((v) {
|
||||
jigoulist.add(new Biaoqianlist.fromJson(v));
|
||||
});
|
||||
}
|
||||
renwunlist = json['renwunlist'];
|
||||
isgood = json['isgood'];
|
||||
imgSrc = json['img_src'];
|
||||
if (json['renwulist'] != null) {
|
||||
renwulist = new List<Biaoqianlist>();
|
||||
json['renwulist'].forEach((v) {
|
||||
renwulist.add(new Biaoqianlist.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['catid'] = this.catid;
|
||||
data['title'] = this.title;
|
||||
data['renwu'] = this.renwu;
|
||||
data['biaoqian'] = this.biaoqian;
|
||||
data['jigou'] = this.jigou;
|
||||
data['bianhao'] = this.bianhao;
|
||||
data['faxingshijian'] = this.faxingshijian;
|
||||
data['shuliang'] = this.shuliang;
|
||||
data['zhuangtai'] = this.zhuangtai;
|
||||
data['shijian'] = this.shijian;
|
||||
data['tuijian'] = this.tuijian;
|
||||
data['classname'] = this.classname;
|
||||
if (this.biaoqianlist != null) {
|
||||
data['biaoqianlist'] = this.biaoqianlist.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.jigoulist != null) {
|
||||
data['jigoulist'] = this.jigoulist.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['renwunlist'] = this.renwunlist;
|
||||
data['isgood'] = this.isgood;
|
||||
data['img_src'] = this.imgSrc;
|
||||
if (this.renwulist != null) {
|
||||
data['renwulist'] = this.renwulist.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
153
untitled/lib/entity/AgentInfoEntity.dart
Normal file
@@ -0,0 +1,153 @@
|
||||
class AgentInfoEntity {
|
||||
int status;
|
||||
AgentInfo data;
|
||||
|
||||
AgentInfoEntity({this.status, this.data});
|
||||
|
||||
AgentInfoEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
data = json['data'] != null ? new AgentInfo.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AgentInfo {
|
||||
String id;
|
||||
String catid;
|
||||
String title;
|
||||
String renwu;
|
||||
String biaoqian;
|
||||
String jigou;
|
||||
String bianhao;
|
||||
String faxingshijian;
|
||||
String shuliang;
|
||||
String zhuangtai;
|
||||
String shijian;
|
||||
String tuijian;
|
||||
String classname;
|
||||
List<Biaoqianlist> biaoqianlist;
|
||||
List<Biaoqianlist> jigoulist;
|
||||
String renwunlist;
|
||||
String isgood;
|
||||
String imgSrc;
|
||||
List<Biaoqianlist> renwulist;
|
||||
List<String> imgs;
|
||||
|
||||
AgentInfo(
|
||||
{this.id,
|
||||
this.catid,
|
||||
this.title,
|
||||
this.renwu,
|
||||
this.biaoqian,
|
||||
this.jigou,
|
||||
this.bianhao,
|
||||
this.faxingshijian,
|
||||
this.shuliang,
|
||||
this.zhuangtai,
|
||||
this.shijian,
|
||||
this.tuijian,
|
||||
this.classname,
|
||||
this.biaoqianlist,
|
||||
this.jigoulist,
|
||||
this.renwunlist,
|
||||
this.isgood,
|
||||
this.imgSrc,
|
||||
this.renwulist,
|
||||
this.imgs});
|
||||
|
||||
AgentInfo.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
catid = json['catid'];
|
||||
title = json['title'];
|
||||
renwu = json['renwu'];
|
||||
biaoqian = json['biaoqian'];
|
||||
jigou = json['jigou'];
|
||||
bianhao = json['bianhao'];
|
||||
faxingshijian = json['faxingshijian'];
|
||||
shuliang = json['shuliang'];
|
||||
zhuangtai = json['zhuangtai'];
|
||||
shijian = json['shijian'];
|
||||
tuijian = json['tuijian'];
|
||||
classname = json['classname'];
|
||||
if (json['biaoqianlist'] != null) {
|
||||
biaoqianlist = new List<Biaoqianlist>();
|
||||
json['biaoqianlist'].forEach((v) {
|
||||
biaoqianlist.add(new Biaoqianlist.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['jigoulist'] != null) {
|
||||
jigoulist = new List<Biaoqianlist>();
|
||||
json['jigoulist'].forEach((v) {
|
||||
jigoulist.add(new Biaoqianlist.fromJson(v));
|
||||
});
|
||||
}
|
||||
renwunlist = json['renwunlist'];
|
||||
isgood = json['isgood'];
|
||||
imgSrc = json['img_src'];
|
||||
if (json['renwulist'] != null) {
|
||||
renwulist = new List<Biaoqianlist>();
|
||||
json['renwulist'].forEach((v) {
|
||||
renwulist.add(new Biaoqianlist.fromJson(v));
|
||||
});
|
||||
}
|
||||
imgs = json['imgs'].cast<String>();
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['catid'] = this.catid;
|
||||
data['title'] = this.title;
|
||||
data['renwu'] = this.renwu;
|
||||
data['biaoqian'] = this.biaoqian;
|
||||
data['jigou'] = this.jigou;
|
||||
data['bianhao'] = this.bianhao;
|
||||
data['faxingshijian'] = this.faxingshijian;
|
||||
data['shuliang'] = this.shuliang;
|
||||
data['zhuangtai'] = this.zhuangtai;
|
||||
data['shijian'] = this.shijian;
|
||||
data['tuijian'] = this.tuijian;
|
||||
data['classname'] = this.classname;
|
||||
if (this.biaoqianlist != null) {
|
||||
data['biaoqianlist'] = this.biaoqianlist.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.jigoulist != null) {
|
||||
data['jigoulist'] = this.jigoulist.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['renwunlist'] = this.renwunlist;
|
||||
data['isgood'] = this.isgood;
|
||||
data['img_src'] = this.imgSrc;
|
||||
if (this.renwulist != null) {
|
||||
data['renwulist'] = this.renwulist.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['imgs'] = this.imgs;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Biaoqianlist {
|
||||
dynamic id;
|
||||
String name;
|
||||
|
||||
Biaoqianlist({this.id, this.name});
|
||||
|
||||
Biaoqianlist.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
109
untitled/lib/entity/ClassEntity.dart
Normal file
@@ -0,0 +1,109 @@
|
||||
class ClassEntity {
|
||||
int _status;
|
||||
String _msg;
|
||||
ClassResult _result;
|
||||
|
||||
ClassEntity({int status, String msg, ClassResult result}) {
|
||||
this._status = status;
|
||||
this._msg = msg;
|
||||
this._result = result;
|
||||
}
|
||||
|
||||
int get status => _status;
|
||||
set status(int status) => _status = status;
|
||||
String get msg => _msg;
|
||||
set msg(String msg) => _msg = msg;
|
||||
ClassResult get result => _result;
|
||||
set result(ClassResult result) => _result = result;
|
||||
|
||||
ClassEntity.fromJson(Map<String, dynamic> json) {
|
||||
_status = json['status'];
|
||||
_msg = json['msg'];
|
||||
_result =
|
||||
json['result'] != null ? new ClassResult.fromJson(json['result']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this._status;
|
||||
data['msg'] = this._msg;
|
||||
if (this._result != null) {
|
||||
data['result'] = this._result.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassResult {
|
||||
List<Principal> _principal;
|
||||
List<Principal> _additional;
|
||||
|
||||
Result({List<Principal> principal, List<Principal> additional}) {
|
||||
this._principal = principal;
|
||||
this._additional = additional;
|
||||
}
|
||||
|
||||
List<Principal> get principal => _principal;
|
||||
set principal(List<Principal> principal) => _principal = principal;
|
||||
List<Principal> get additional => _additional;
|
||||
set additional(List<Principal> additional) => _additional = additional;
|
||||
|
||||
ClassResult.fromJson(Map<String, dynamic> json) {
|
||||
if (json['principal'] != null) {
|
||||
_principal = new List<Principal>();
|
||||
json['principal'].forEach((v) {
|
||||
_principal.add(new Principal.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['additional'] != null) {
|
||||
_additional = new List<Principal>();
|
||||
json['additional'].forEach((v) {
|
||||
_additional.add(new Principal.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this._principal != null) {
|
||||
data['principal'] = this._principal.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this._additional != null) {
|
||||
data['additional'] = this._additional.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Principal {
|
||||
int _id;
|
||||
String _title;
|
||||
int _page;
|
||||
|
||||
Principal({int id, String title, int page}) {
|
||||
this._id = id;
|
||||
this._title = title;
|
||||
this._page = page;
|
||||
}
|
||||
|
||||
int get id => _id;
|
||||
set id(int id) => _id = id;
|
||||
String get title => _title;
|
||||
set title(String title) => _title = title;
|
||||
int get page => _page;
|
||||
set page(int page) => _page = page;
|
||||
|
||||
Principal.fromJson(Map<String, dynamic> json) {
|
||||
_id = json['id'];
|
||||
_title = json['title'];
|
||||
_page = json['page'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this._id;
|
||||
data['title'] = this._title;
|
||||
data['page'] = this._page;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
77
untitled/lib/entity/ClassListEntity.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:peach/entity/_.dart';
|
||||
|
||||
class ClassListEntity {
|
||||
int status;
|
||||
String msg;
|
||||
ClassListResult result;
|
||||
|
||||
ClassListEntity({this.status, this.msg, this.result});
|
||||
|
||||
ClassListEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
msg = json['msg'];
|
||||
result =
|
||||
json['result'] != null ? new ClassListResult.fromJson(json['result']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['msg'] = this.msg;
|
||||
if (this.result != null) {
|
||||
data['result'] = this.result.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassListResult {
|
||||
String group;
|
||||
int currentPage;
|
||||
int totalPage;
|
||||
List<HomeEntityData> data;
|
||||
|
||||
ClassListResult({this.group, this.currentPage, this.totalPage, this.data});
|
||||
|
||||
ClassListResult.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'];
|
||||
currentPage = json['current_page'];
|
||||
totalPage = json['total_page'];
|
||||
if (json['data'] != null) {
|
||||
data = new List<HomeEntityData>();
|
||||
json['data'].forEach((v) {
|
||||
data.add(new HomeEntityData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['group'] = this.group;
|
||||
data['current_page'] = this.currentPage;
|
||||
data['total_page'] = this.totalPage;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassTags {
|
||||
String title;
|
||||
int id;
|
||||
|
||||
ClassTags({this.title, this.id});
|
||||
|
||||
ClassTags.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
id = json['id'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['id'] = this.id;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
32
untitled/lib/entity/FreeUseEntity.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
class FreeUseEntity {
|
||||
int _code;
|
||||
String _error;
|
||||
int _freeNumber;
|
||||
|
||||
FreeUseEntity({int code, String error, int freeNumber}) {
|
||||
this._code = code;
|
||||
this._error = error;
|
||||
this._freeNumber = freeNumber;
|
||||
}
|
||||
|
||||
int get code => _code;
|
||||
set code(int code) => _code = code;
|
||||
String get error => _error;
|
||||
set error(String error) => _error = error;
|
||||
int get freeNumber => _freeNumber;
|
||||
set freeNumber(int freeNumber) => _freeNumber = freeNumber;
|
||||
|
||||
FreeUseEntity.fromJson(Map<String, dynamic> json) {
|
||||
_code = json['code'];
|
||||
_error = json['error'];
|
||||
_freeNumber = json['FreeNumber'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['code'] = this._code;
|
||||
data['error'] = this._error;
|
||||
data['FreeNumber'] = this._freeNumber;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
203
untitled/lib/entity/HomeEntity.dart
Normal file
@@ -0,0 +1,203 @@
|
||||
class HomeEntity {
|
||||
int status;
|
||||
String msg;
|
||||
Result result;
|
||||
|
||||
HomeEntity({this.status, this.msg, this.result});
|
||||
HomeEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
msg = json['msg'];
|
||||
result =
|
||||
json['result'] != null ? new Result.fromJson(json['result']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['msg'] = this.msg;
|
||||
if (this.result != null) {
|
||||
data['result'] = this.result.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Result {
|
||||
Recommended recommended;
|
||||
Recommended newest;
|
||||
Models model;
|
||||
|
||||
Result({this.recommended, this.newest, this.model});
|
||||
|
||||
Result.fromJson(Map<String, dynamic> json) {
|
||||
recommended = json['recommended'] != null
|
||||
? new Recommended.fromJson(json['recommended'])
|
||||
: null;
|
||||
newest = json['newest'] != null
|
||||
? new Recommended.fromJson(json['newest'])
|
||||
: null;
|
||||
model = json['model'] != null ? new Models.fromJson(json['model']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.recommended != null) {
|
||||
data['recommended'] = this.recommended.toJson();
|
||||
}
|
||||
if (this.newest != null) {
|
||||
data['newest'] = this.newest.toJson();
|
||||
}
|
||||
if (this.model != null) {
|
||||
data['model'] = this.model.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Recommended {
|
||||
String title;
|
||||
List<HomeEntityData> data;
|
||||
|
||||
Recommended({this.title, this.data});
|
||||
|
||||
Recommended.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
if (json['data'] != null) {
|
||||
data = new List<HomeEntityData>();
|
||||
json['data'].forEach((v) {
|
||||
data.add(new HomeEntityData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class HomeEntityData {
|
||||
int id;
|
||||
int total;
|
||||
int totalPage;
|
||||
String source;
|
||||
String user;
|
||||
List<Tags> tags;
|
||||
String title;
|
||||
String preview;
|
||||
|
||||
HomeEntityData(
|
||||
{this.id,
|
||||
this.total,
|
||||
this.totalPage,
|
||||
this.source,
|
||||
this.user,
|
||||
this.tags,
|
||||
this.title,
|
||||
this.preview});
|
||||
|
||||
HomeEntityData.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
total = json['total'];
|
||||
totalPage = json['total_page'];
|
||||
source = json['source'];
|
||||
user = json['user'];
|
||||
if (json['tags'] != null) {
|
||||
tags = new List<Tags>();
|
||||
json['tags'].forEach((v) {
|
||||
tags.add(new Tags.fromJson(v));
|
||||
});
|
||||
}
|
||||
title = json['title'];
|
||||
preview = json['preview'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['total'] = this.total;
|
||||
data['total_page'] = this.totalPage;
|
||||
data['source'] = this.source;
|
||||
data['user'] = this.user;
|
||||
if (this.tags != null) {
|
||||
data['tags'] = this.tags.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['title'] = this.title;
|
||||
data['preview'] = this.preview;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Tags {
|
||||
String title;
|
||||
int id;
|
||||
|
||||
Tags({this.title, this.id});
|
||||
|
||||
Tags.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
id = json['id'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['id'] = this.id;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Models {
|
||||
String title;
|
||||
List<Res> res;
|
||||
|
||||
Models({this.title, this.res});
|
||||
|
||||
Models.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
if (json['res'] != null) {
|
||||
res = new List<Res>();
|
||||
json['res'].forEach((v) {
|
||||
res.add(new Res.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
if (this.res != null) {
|
||||
data['res'] = this.res.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Res {
|
||||
int id;
|
||||
String title;
|
||||
String total;
|
||||
String preview;
|
||||
|
||||
Res({this.id, this.title, this.total, this.preview});
|
||||
|
||||
Res.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
title = json['title'];
|
||||
total = json['total'];
|
||||
preview = json['preview'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['title'] = this.title;
|
||||
data['total'] = this.total;
|
||||
data['preview'] = this.preview;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
116
untitled/lib/entity/InfoEntity.dart
Normal file
@@ -0,0 +1,116 @@
|
||||
import 'HomeEntity.dart';
|
||||
|
||||
class InfoEntity {
|
||||
int status;
|
||||
String msg;
|
||||
InfoResult result;
|
||||
|
||||
InfoEntity({this.status, this.msg, this.result});
|
||||
|
||||
InfoEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
msg = json['msg'];
|
||||
result =
|
||||
json['result'] != null ? new InfoResult.fromJson(json['result']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['msg'] = this.msg;
|
||||
if (this.result != null) {
|
||||
data['result'] = this.result.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class InfoResult {
|
||||
String title;
|
||||
String source;
|
||||
String total;
|
||||
String info;
|
||||
int currentPage;
|
||||
int totalPage;
|
||||
List<Data> data;
|
||||
List<HomeEntityData> recommend;
|
||||
List<HomeEntityData> relevant;
|
||||
|
||||
InfoResult(
|
||||
{this.title,
|
||||
this.source,
|
||||
this.total,
|
||||
this.info,
|
||||
this.currentPage,
|
||||
this.totalPage,
|
||||
this.data,
|
||||
this.recommend,
|
||||
this.relevant});
|
||||
|
||||
InfoResult.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
source = json['source'];
|
||||
total = json['total'];
|
||||
info = json['info'];
|
||||
currentPage = json['current_page'];
|
||||
totalPage = json['total_page'];
|
||||
if (json['data'] != null) {
|
||||
data = new List<Data>();
|
||||
json['data'].forEach((v) {
|
||||
data.add(new Data.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['recommend'] != null) {
|
||||
recommend = new List<HomeEntityData>();
|
||||
json['recommend'].forEach((v) {
|
||||
recommend.add(new HomeEntityData.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['relevant'] != null) {
|
||||
relevant = new List<HomeEntityData>();
|
||||
json['relevant'].forEach((v) {
|
||||
relevant.add(new HomeEntityData.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['source'] = this.source;
|
||||
data['total'] = this.total;
|
||||
data['info'] = this.info;
|
||||
data['current_page'] = this.currentPage;
|
||||
data['total_page'] = this.totalPage;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.recommend != null) {
|
||||
data['recommend'] = this.recommend.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.relevant != null) {
|
||||
data['relevant'] = this.relevant.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Data {
|
||||
String title;
|
||||
String src;
|
||||
|
||||
Data({this.title, this.src});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
src = json['src'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['src'] = this.src;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
51
untitled/lib/entity/LikeEntity.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'HomeEntity.dart';
|
||||
|
||||
class LikeEntity extends HomeEntityData {
|
||||
int id;
|
||||
String preview;
|
||||
String source;
|
||||
String title;
|
||||
String totals;
|
||||
String user;
|
||||
|
||||
LikeEntity({this.id, this.preview, this.source, this.title, this.totals, this.user});
|
||||
|
||||
LikeEntity.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
preview = json['preview'];
|
||||
source = json['source'];
|
||||
title = json['title'];
|
||||
totals = json['totals'];
|
||||
user = json['user'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['preview'] = this.preview;
|
||||
data['source'] = this.source;
|
||||
data['title'] = this.title;
|
||||
data['totals'] = this.totals;
|
||||
data['user'] = this.user;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class SingleGraphEntity {
|
||||
int id;
|
||||
String src;
|
||||
|
||||
SingleGraphEntity({this.id, this.src});
|
||||
|
||||
SingleGraphEntity.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
src = json['src'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['src'] = this.src;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
34
untitled/lib/entity/LoginEntity.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
class LoginEntity {
|
||||
int code;
|
||||
String error;
|
||||
String username;
|
||||
String createdAt;
|
||||
String objectId;
|
||||
String userType;
|
||||
String userWeiXin;
|
||||
|
||||
|
||||
LoginEntity({this.code, this.error, this.username, this.createdAt, this.objectId, this.userType, this.userWeiXin});
|
||||
|
||||
LoginEntity.fromJson(Map<String, dynamic> json) {
|
||||
code = json['code'];
|
||||
error = json['error'];
|
||||
username = json['username'];
|
||||
createdAt = json['createdAt'];
|
||||
objectId = json['objectId'];
|
||||
userType = json['userType'];
|
||||
userWeiXin = json['userWeiXin'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['code'] = this.code;
|
||||
data['error'] = this.error;
|
||||
data['username'] = this.username;
|
||||
data['createdAt'] = this.createdAt;
|
||||
data['objectId'] = this.objectId;
|
||||
data['userType'] = this.userType;
|
||||
data['userWeiXin'] = this.userWeiXin;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
50
untitled/lib/entity/MechanismEntity.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
class MechanismEntity {
|
||||
int status;
|
||||
String msg;
|
||||
List<MechanismResult> result;
|
||||
|
||||
MechanismEntity({this.status, this.msg, this.result});
|
||||
|
||||
MechanismEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
msg = json['msg'];
|
||||
if (json['result'] != null) {
|
||||
result = new List<MechanismResult>();
|
||||
json['result'].forEach((v) {
|
||||
result.add(new MechanismResult.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['msg'] = this.msg;
|
||||
if (this.result != null) {
|
||||
data['result'] = this.result.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class MechanismResult {
|
||||
int id;
|
||||
String title;
|
||||
String quantity;
|
||||
|
||||
MechanismResult({this.id, this.title, this.quantity});
|
||||
|
||||
MechanismResult.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
title = json['title'];
|
||||
quantity = json['quantity'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['title'] = this.title;
|
||||
data['quantity'] = this.quantity;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
84
untitled/lib/entity/ModelEntity.dart
Normal file
@@ -0,0 +1,84 @@
|
||||
import 'HomeEntity.dart';
|
||||
|
||||
class ModelEntity {
|
||||
int status;
|
||||
String msg;
|
||||
ModelResult result;
|
||||
|
||||
ModelEntity({this.status, this.msg, this.result});
|
||||
|
||||
ModelEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
msg = json['msg'];
|
||||
result =
|
||||
json['result'] != null ? new ModelResult.fromJson(json['result']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['msg'] = this.msg;
|
||||
if (this.result != null) {
|
||||
data['result'] = this.result.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelResult {
|
||||
List<Res> hotModels;
|
||||
List<Res> newest;
|
||||
|
||||
ModelResult({this.hotModels, this.newest});
|
||||
|
||||
ModelResult.fromJson(Map<String, dynamic> json) {
|
||||
if (json['hot_models'] != null) {
|
||||
hotModels = new List<Res>();
|
||||
json['hot_models'].forEach((v) {
|
||||
hotModels.add(new Res.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['newest'] != null) {
|
||||
newest = new List<Res>();
|
||||
json['newest'].forEach((v) {
|
||||
newest.add(new Res.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.hotModels != null) {
|
||||
data['hot_models'] = this.hotModels.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.newest != null) {
|
||||
data['newest'] = this.newest.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class HotModels {
|
||||
int id;
|
||||
String title;
|
||||
String total;
|
||||
String preview;
|
||||
|
||||
HotModels({this.id, this.title, this.total, this.preview});
|
||||
|
||||
HotModels.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
title = json['title'];
|
||||
total = json['total'];
|
||||
preview = json['preview'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['title'] = this.title;
|
||||
data['total'] = this.total;
|
||||
data['preview'] = this.preview;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
102
untitled/lib/entity/ModelInfoEntity.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'HomeEntity.dart';
|
||||
|
||||
class ModelInfoEntity {
|
||||
int status;
|
||||
String msg;
|
||||
ModelInfoResult result;
|
||||
|
||||
ModelInfoEntity({this.status, this.msg, this.result});
|
||||
|
||||
ModelInfoEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
msg = json['msg'];
|
||||
result =
|
||||
json['result'] != null ? new ModelInfoResult.fromJson(json['result']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['msg'] = this.msg;
|
||||
if (this.result != null) {
|
||||
data['result'] = this.result.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelInfoResult {
|
||||
int currentPage;
|
||||
int totalPage;
|
||||
ModelInfo modelInfo;
|
||||
List<HomeEntityData> data;
|
||||
List<Res> similar;
|
||||
|
||||
ModelInfoResult(
|
||||
{this.currentPage,
|
||||
this.totalPage,
|
||||
this.modelInfo,
|
||||
this.data,
|
||||
this.similar});
|
||||
|
||||
ModelInfoResult.fromJson(Map<String, dynamic> json) {
|
||||
currentPage = json['current_page'];
|
||||
totalPage = json['total_page'];
|
||||
modelInfo = json['model_info'] != null
|
||||
? new ModelInfo.fromJson(json['model_info'])
|
||||
: null;
|
||||
if (json['data'] != null) {
|
||||
data = new List<HomeEntityData>();
|
||||
json['data'].forEach((v) {
|
||||
data.add(new HomeEntityData.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['similar'] != null) {
|
||||
similar = new List<Res>();
|
||||
json['similar'].forEach((v) {
|
||||
similar.add(new Res.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['current_page'] = this.currentPage;
|
||||
data['total_page'] = this.totalPage;
|
||||
if (this.modelInfo != null) {
|
||||
data['model_info'] = this.modelInfo.toJson();
|
||||
}
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.similar != null) {
|
||||
data['similar'] = this.similar.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelInfo {
|
||||
String portrait;
|
||||
String name;
|
||||
String explain;
|
||||
String total;
|
||||
|
||||
ModelInfo({this.portrait, this.name, this.explain, this.total});
|
||||
|
||||
ModelInfo.fromJson(Map<String, dynamic> json) {
|
||||
portrait = json['portrait'];
|
||||
name = json['name'];
|
||||
explain = json['explain'];
|
||||
total = json['total'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['portrait'] = this.portrait;
|
||||
data['name'] = this.name;
|
||||
data['explain'] = this.explain;
|
||||
data['total'] = this.total;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
38
untitled/lib/entity/RegisterEntity.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
class RegisterEntity {
|
||||
int _code;
|
||||
String _error;
|
||||
String _createdAt;
|
||||
String _objectId;
|
||||
|
||||
RegisterEntity({int code, String error, String createdAt, String objectId}) {
|
||||
this._code = code;
|
||||
this._error = error;
|
||||
this._createdAt = createdAt;
|
||||
this._objectId = objectId;
|
||||
}
|
||||
|
||||
int get code => _code;
|
||||
set code(int code) => _code = code;
|
||||
String get error => _error;
|
||||
set error(String error) => _error = error;
|
||||
String get createdAt => _createdAt;
|
||||
set createdAt(String createdAt) => _createdAt = createdAt;
|
||||
String get objectId => _objectId;
|
||||
set objectId(String objectId) => _objectId = objectId;
|
||||
|
||||
RegisterEntity.fromJson(Map<String, dynamic> json) {
|
||||
_code = json['code'];
|
||||
_error = json['error'];
|
||||
_createdAt = json['createdAt'];
|
||||
_objectId = json['objectId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['code'] = this._code;
|
||||
data['error'] = this._error;
|
||||
data['createdAt'] = this._createdAt;
|
||||
data['objectId'] = this._objectId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
28
untitled/lib/entity/SearchEntity.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'AgentClassListEntity.dart';
|
||||
|
||||
class SearchEntity {
|
||||
int status;
|
||||
List<ItemList> data;
|
||||
|
||||
SearchEntity({this.status, this.data});
|
||||
|
||||
SearchEntity.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
if (json['data'] != null) {
|
||||
data = new List<ItemList>();
|
||||
json['data'].forEach((v) {
|
||||
data.add(new ItemList.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
40
untitled/lib/entity/UpdateVersionEntity.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
class UpdateVersionEntity {
|
||||
String createdAt;
|
||||
String downUrl;
|
||||
String objectId;
|
||||
List<String> updateMsg;
|
||||
String updatedAt;
|
||||
String version;
|
||||
int versionCode;
|
||||
|
||||
UpdateVersionEntity(
|
||||
{this.createdAt,
|
||||
this.downUrl,
|
||||
this.objectId,
|
||||
this.updateMsg,
|
||||
this.updatedAt,
|
||||
this.version,
|
||||
this.versionCode});
|
||||
|
||||
UpdateVersionEntity.fromJson(Map<String, dynamic> json) {
|
||||
createdAt = json['createdAt'];
|
||||
downUrl = json['downUrl'];
|
||||
objectId = json['objectId'];
|
||||
updateMsg = json['updateMsg'].cast<String>();
|
||||
updatedAt = json['updatedAt'];
|
||||
version = json['version'];
|
||||
versionCode = json['versionCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['createdAt'] = this.createdAt;
|
||||
data['downUrl'] = this.downUrl;
|
||||
data['objectId'] = this.objectId;
|
||||
data['updateMsg'] = this.updateMsg;
|
||||
data['updatedAt'] = this.updatedAt;
|
||||
data['version'] = this.version;
|
||||
data['versionCode'] = this.versionCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
418
untitled/lib/entity/VideoListEntity.dart
Normal file
@@ -0,0 +1,418 @@
|
||||
class VideoListEntity {
|
||||
int _result;
|
||||
String _llsid;
|
||||
String _webPageArea;
|
||||
List<Feeds> _feeds;
|
||||
Null _hostName;
|
||||
String _pcursor;
|
||||
String _sTypename;
|
||||
|
||||
VideoListEntity(
|
||||
{int result,
|
||||
String llsid,
|
||||
String webPageArea,
|
||||
List<Feeds> feeds,
|
||||
Null hostName,
|
||||
String pcursor,
|
||||
String sTypename}) {
|
||||
this._result = result;
|
||||
this._llsid = llsid;
|
||||
this._webPageArea = webPageArea;
|
||||
this._feeds = feeds;
|
||||
this._hostName = hostName;
|
||||
this._pcursor = pcursor;
|
||||
this._sTypename = sTypename;
|
||||
}
|
||||
|
||||
int get result => _result;
|
||||
set result(int result) => _result = result;
|
||||
String get llsid => _llsid;
|
||||
set llsid(String llsid) => _llsid = llsid;
|
||||
String get webPageArea => _webPageArea;
|
||||
set webPageArea(String webPageArea) => _webPageArea = webPageArea;
|
||||
List<Feeds> get feeds => _feeds;
|
||||
set feeds(List<Feeds> feeds) => _feeds = feeds;
|
||||
Null get hostName => _hostName;
|
||||
set hostName(Null hostName) => _hostName = hostName;
|
||||
String get pcursor => _pcursor;
|
||||
set pcursor(String pcursor) => _pcursor = pcursor;
|
||||
String get sTypename => _sTypename;
|
||||
set sTypename(String sTypename) => _sTypename = sTypename;
|
||||
|
||||
VideoListEntity.fromJson(Map<String, dynamic> json) {
|
||||
_result = json['result'];
|
||||
_llsid = json['llsid'];
|
||||
_webPageArea = json['webPageArea'];
|
||||
if (json['feeds'] != null) {
|
||||
_feeds = new List<Feeds>();
|
||||
json['feeds'].forEach((v) {
|
||||
_feeds.add(new Feeds.fromJson(v));
|
||||
});
|
||||
}
|
||||
_hostName = json['hostName'];
|
||||
_pcursor = json['pcursor'];
|
||||
_sTypename = json['__typename'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['result'] = this._result;
|
||||
data['llsid'] = this._llsid;
|
||||
data['webPageArea'] = this._webPageArea;
|
||||
if (this._feeds != null) {
|
||||
data['feeds'] = this._feeds.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['hostName'] = this._hostName;
|
||||
data['pcursor'] = this._pcursor;
|
||||
data['__typename'] = this._sTypename;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Feeds {
|
||||
int _type;
|
||||
Author _author;
|
||||
List<Tag> _tag;
|
||||
Photo _photo;
|
||||
int _canAddComment;
|
||||
String _currentPcursor;
|
||||
String _llsid;
|
||||
int _status;
|
||||
String _sTypename;
|
||||
|
||||
Feeds(
|
||||
{int type,
|
||||
Author author,
|
||||
List<Tag> tag,
|
||||
Photo photo,
|
||||
int canAddComment,
|
||||
String currentPcursor,
|
||||
String llsid,
|
||||
int status,
|
||||
String sTypename}) {
|
||||
this._type = type;
|
||||
this._author = author;
|
||||
this._tag = tag;
|
||||
this._photo = photo;
|
||||
this._canAddComment = canAddComment;
|
||||
this._currentPcursor = currentPcursor;
|
||||
this._llsid = llsid;
|
||||
this._status = status;
|
||||
this._sTypename = sTypename;
|
||||
}
|
||||
|
||||
int get type => _type;
|
||||
set type(int type) => _type = type;
|
||||
Author get author => _author;
|
||||
set author(Author author) => _author = author;
|
||||
List<Tag> get tag => _tag;
|
||||
set tag(List<Tag> tag) => _tag = tag;
|
||||
Photo get photo => _photo;
|
||||
set photo(Photo photo) => _photo = photo;
|
||||
int get canAddComment => _canAddComment;
|
||||
set canAddComment(int canAddComment) => _canAddComment = canAddComment;
|
||||
String get currentPcursor => _currentPcursor;
|
||||
set currentPcursor(String currentPcursor) => _currentPcursor = currentPcursor;
|
||||
String get llsid => _llsid;
|
||||
set llsid(String llsid) => _llsid = llsid;
|
||||
int get status => _status;
|
||||
set status(int status) => _status = status;
|
||||
String get sTypename => _sTypename;
|
||||
set sTypename(String sTypename) => _sTypename = sTypename;
|
||||
|
||||
Feeds.fromJson(Map<String, dynamic> json) {
|
||||
_type = json['type'];
|
||||
_author =
|
||||
json['author'] != null ? new Author.fromJson(json['author']) : null;
|
||||
if (json['tag'] != null) {
|
||||
_tag = new List<Tag>();
|
||||
json['tag'].forEach((v) {
|
||||
_tag.add(new Tag.fromJson(v));
|
||||
});
|
||||
}
|
||||
_photo = json['photo'] != null ? new Photo.fromJson(json['photo']) : null;
|
||||
_canAddComment = json['canAddComment'];
|
||||
_currentPcursor = json['currentPcursor'];
|
||||
_llsid = json['llsid'];
|
||||
_status = json['status'];
|
||||
_sTypename = json['__typename'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['type'] = this._type;
|
||||
if (this._author != null) {
|
||||
data['author'] = this._author.toJson();
|
||||
}
|
||||
if (this._tag != null) {
|
||||
data['tag'] = this._tag.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this._photo != null) {
|
||||
data['photo'] = this._photo.toJson();
|
||||
}
|
||||
data['canAddComment'] = this._canAddComment;
|
||||
data['currentPcursor'] = this._currentPcursor;
|
||||
data['llsid'] = this._llsid;
|
||||
data['status'] = this._status;
|
||||
data['__typename'] = this._sTypename;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Author {
|
||||
String _id;
|
||||
String _name;
|
||||
bool _following;
|
||||
String _headerUrl;
|
||||
Null _headerUrls;
|
||||
String _sTypename;
|
||||
|
||||
Author(
|
||||
{String id,
|
||||
String name,
|
||||
bool following,
|
||||
String headerUrl,
|
||||
Null headerUrls,
|
||||
String sTypename}) {
|
||||
this._id = id;
|
||||
this._name = name;
|
||||
this._following = following;
|
||||
this._headerUrl = headerUrl;
|
||||
this._headerUrls = headerUrls;
|
||||
this._sTypename = sTypename;
|
||||
}
|
||||
|
||||
String get id => _id;
|
||||
set id(String id) => _id = id;
|
||||
String get name => _name;
|
||||
set name(String name) => _name = name;
|
||||
bool get following => _following;
|
||||
set following(bool following) => _following = following;
|
||||
String get headerUrl => _headerUrl;
|
||||
set headerUrl(String headerUrl) => _headerUrl = headerUrl;
|
||||
Null get headerUrls => _headerUrls;
|
||||
set headerUrls(Null headerUrls) => _headerUrls = headerUrls;
|
||||
String get sTypename => _sTypename;
|
||||
set sTypename(String sTypename) => _sTypename = sTypename;
|
||||
|
||||
Author.fromJson(Map<String, dynamic> json) {
|
||||
_id = json['id'];
|
||||
_name = json['name'];
|
||||
_following = json['following'];
|
||||
_headerUrl = json['headerUrl'];
|
||||
_headerUrls = json['headerUrls'];
|
||||
_sTypename = json['__typename'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this._id;
|
||||
data['name'] = this._name;
|
||||
data['following'] = this._following;
|
||||
data['headerUrl'] = this._headerUrl;
|
||||
data['headerUrls'] = this._headerUrls;
|
||||
data['__typename'] = this._sTypename;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Tag {
|
||||
int _type;
|
||||
String _name;
|
||||
String _sTypename;
|
||||
|
||||
Tag({int type, String name, String sTypename}) {
|
||||
this._type = type;
|
||||
this._name = name;
|
||||
this._sTypename = sTypename;
|
||||
}
|
||||
|
||||
int get type => _type;
|
||||
set type(int type) => _type = type;
|
||||
String get name => _name;
|
||||
set name(String name) => _name = name;
|
||||
String get sTypename => _sTypename;
|
||||
set sTypename(String sTypename) => _sTypename = sTypename;
|
||||
|
||||
Tag.fromJson(Map<String, dynamic> json) {
|
||||
_type = json['type'];
|
||||
_name = json['name'];
|
||||
_sTypename = json['__typename'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['type'] = this._type;
|
||||
data['name'] = this._name;
|
||||
data['__typename'] = this._sTypename;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Photo {
|
||||
String _id;
|
||||
int _duration;
|
||||
String _caption;
|
||||
String _likeCount;
|
||||
int _realLikeCount;
|
||||
String _coverUrl;
|
||||
Null _coverUrls;
|
||||
List<PhotoUrls> _photoUrls;
|
||||
String _photoUrl;
|
||||
bool _liked;
|
||||
int _timestamp;
|
||||
String _expTag;
|
||||
String _animatedCoverUrl;
|
||||
int _stereoType;
|
||||
double _videoRatio;
|
||||
String _sTypename;
|
||||
|
||||
Photo(
|
||||
{String id,
|
||||
int duration,
|
||||
String caption,
|
||||
String likeCount,
|
||||
int realLikeCount,
|
||||
String coverUrl,
|
||||
Null coverUrls,
|
||||
List<PhotoUrls> photoUrls,
|
||||
String photoUrl,
|
||||
bool liked,
|
||||
int timestamp,
|
||||
String expTag,
|
||||
String animatedCoverUrl,
|
||||
int stereoType,
|
||||
double videoRatio,
|
||||
String sTypename}) {
|
||||
this._id = id;
|
||||
this._duration = duration;
|
||||
this._caption = caption;
|
||||
this._likeCount = likeCount;
|
||||
this._realLikeCount = realLikeCount;
|
||||
this._coverUrl = coverUrl;
|
||||
this._coverUrls = coverUrls;
|
||||
this._photoUrls = photoUrls;
|
||||
this._photoUrl = photoUrl;
|
||||
this._liked = liked;
|
||||
this._timestamp = timestamp;
|
||||
this._expTag = expTag;
|
||||
this._animatedCoverUrl = animatedCoverUrl;
|
||||
this._stereoType = stereoType;
|
||||
this._videoRatio = videoRatio;
|
||||
this._sTypename = sTypename;
|
||||
}
|
||||
|
||||
String get id => _id;
|
||||
set id(String id) => _id = id;
|
||||
int get duration => _duration;
|
||||
set duration(int duration) => _duration = duration;
|
||||
String get caption => _caption;
|
||||
set caption(String caption) => _caption = caption;
|
||||
String get likeCount => _likeCount;
|
||||
set likeCount(String likeCount) => _likeCount = likeCount;
|
||||
int get realLikeCount => _realLikeCount;
|
||||
set realLikeCount(int realLikeCount) => _realLikeCount = realLikeCount;
|
||||
String get coverUrl => _coverUrl;
|
||||
set coverUrl(String coverUrl) => _coverUrl = coverUrl;
|
||||
Null get coverUrls => _coverUrls;
|
||||
set coverUrls(Null coverUrls) => _coverUrls = coverUrls;
|
||||
List<PhotoUrls> get photoUrls => _photoUrls;
|
||||
set photoUrls(List<PhotoUrls> photoUrls) => _photoUrls = photoUrls;
|
||||
String get photoUrl => _photoUrl;
|
||||
set photoUrl(String photoUrl) => _photoUrl = photoUrl;
|
||||
bool get liked => _liked;
|
||||
set liked(bool liked) => _liked = liked;
|
||||
int get timestamp => _timestamp;
|
||||
set timestamp(int timestamp) => _timestamp = timestamp;
|
||||
String get expTag => _expTag;
|
||||
set expTag(String expTag) => _expTag = expTag;
|
||||
String get animatedCoverUrl => _animatedCoverUrl;
|
||||
set animatedCoverUrl(String animatedCoverUrl) =>
|
||||
_animatedCoverUrl = animatedCoverUrl;
|
||||
int get stereoType => _stereoType;
|
||||
set stereoType(int stereoType) => _stereoType = stereoType;
|
||||
double get videoRatio => _videoRatio;
|
||||
set videoRatio(double videoRatio) => _videoRatio = videoRatio;
|
||||
String get sTypename => _sTypename;
|
||||
set sTypename(String sTypename) => _sTypename = sTypename;
|
||||
|
||||
Photo.fromJson(Map<String, dynamic> json) {
|
||||
_id = json['id'];
|
||||
_duration = json['duration'];
|
||||
_caption = json['caption'];
|
||||
_likeCount = json['likeCount'];
|
||||
_realLikeCount = json['realLikeCount'];
|
||||
_coverUrl = json['coverUrl'];
|
||||
_coverUrls = json['coverUrls'];
|
||||
if (json['photoUrls'] != null) {
|
||||
_photoUrls = new List<PhotoUrls>();
|
||||
json['photoUrls'].forEach((v) {
|
||||
_photoUrls.add(new PhotoUrls.fromJson(v));
|
||||
});
|
||||
}
|
||||
_photoUrl = json['photoUrl'];
|
||||
_liked = json['liked'];
|
||||
_timestamp = json['timestamp'];
|
||||
_expTag = json['expTag'];
|
||||
_animatedCoverUrl = json['animatedCoverUrl'];
|
||||
_stereoType = json['stereoType'];
|
||||
_videoRatio = json['videoRatio'];
|
||||
_sTypename = json['__typename'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this._id;
|
||||
data['duration'] = this._duration;
|
||||
data['caption'] = this._caption;
|
||||
data['likeCount'] = this._likeCount;
|
||||
data['realLikeCount'] = this._realLikeCount;
|
||||
data['coverUrl'] = this._coverUrl;
|
||||
data['coverUrls'] = this._coverUrls;
|
||||
if (this._photoUrls != null) {
|
||||
data['photoUrls'] = this._photoUrls.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['photoUrl'] = this._photoUrl;
|
||||
data['liked'] = this._liked;
|
||||
data['timestamp'] = this._timestamp;
|
||||
data['expTag'] = this._expTag;
|
||||
data['animatedCoverUrl'] = this._animatedCoverUrl;
|
||||
data['stereoType'] = this._stereoType;
|
||||
data['videoRatio'] = this._videoRatio;
|
||||
data['__typename'] = this._sTypename;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class PhotoUrls {
|
||||
String _cdn;
|
||||
String _url;
|
||||
String _sTypename;
|
||||
|
||||
PhotoUrls({String cdn, String url, String sTypename}) {
|
||||
this._cdn = cdn;
|
||||
this._url = url;
|
||||
this._sTypename = sTypename;
|
||||
}
|
||||
|
||||
String get cdn => _cdn;
|
||||
set cdn(String cdn) => _cdn = cdn;
|
||||
String get url => _url;
|
||||
set url(String url) => _url = url;
|
||||
String get sTypename => _sTypename;
|
||||
set sTypename(String sTypename) => _sTypename = sTypename;
|
||||
|
||||
PhotoUrls.fromJson(Map<String, dynamic> json) {
|
||||
_cdn = json['cdn'];
|
||||
_url = json['url'];
|
||||
_sTypename = json['__typename'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['cdn'] = this._cdn;
|
||||
data['url'] = this._url;
|
||||
data['__typename'] = this._sTypename;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
19
untitled/lib/entity/_.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
library entity;
|
||||
|
||||
export 'HomeEntity.dart';
|
||||
export 'InfoEntity.dart';
|
||||
export 'ClassListEntity.dart';
|
||||
export 'ClassEntity.dart';
|
||||
export 'MechanismEntity.dart';
|
||||
export 'ModelEntity.dart';
|
||||
export 'LikeEntity.dart';
|
||||
export 'ModelInfoEntity.dart';
|
||||
export 'AgentInfoEntity.dart';
|
||||
export 'AgentClassListEntity.dart';
|
||||
export 'UpdateVersionEntity.dart';
|
||||
export 'SearchEntity.dart';
|
||||
export 'VideoListEntity.dart';
|
||||
export 'LoginEntity.dart';
|
||||
export 'RegisterEntity.dart';
|
||||
export 'FreeUseEntity.dart';
|
||||
export 'orderStatusEntity.dart';
|
||||
110
untitled/lib/entity/orderStatusEntity.dart
Normal file
@@ -0,0 +1,110 @@
|
||||
class orderStatusEntity {
|
||||
int _code;
|
||||
String _error;
|
||||
List<Arr> _arr;
|
||||
|
||||
orderStatusEntity({int code, String error, List<Arr> arr}) {
|
||||
this._code = code;
|
||||
this._error = error;
|
||||
this._arr = arr;
|
||||
}
|
||||
|
||||
int get code => _code;
|
||||
set code(int code) => _code = code;
|
||||
String get error => _error;
|
||||
set error(String error) => _error = error;
|
||||
List<Arr> get arr => _arr;
|
||||
set arr(List<Arr> arr) => _arr = arr;
|
||||
|
||||
orderStatusEntity.fromJson(Map<String, dynamic> json) {
|
||||
_code = json['code'];
|
||||
_error = json['error'];
|
||||
if (json['arr'] != null) {
|
||||
_arr = new List<Arr>();
|
||||
json['arr'].forEach((v) {
|
||||
_arr.add(new Arr.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['code'] = this._code;
|
||||
data['error'] = this._error;
|
||||
if (this._arr != null) {
|
||||
data['arr'] = this._arr.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Arr {
|
||||
String _activateStatus;
|
||||
String _createdAt;
|
||||
String _objectId;
|
||||
String _orderNumber;
|
||||
String _superiorWeixin;
|
||||
String _updatedAt;
|
||||
String _userObjectId;
|
||||
String _vipLevel;
|
||||
|
||||
Arr(
|
||||
{String activateStatus,
|
||||
String createdAt,
|
||||
String objectId,
|
||||
String orderNumber,
|
||||
String superiorWeixin,
|
||||
String updatedAt,
|
||||
String userObjectId,
|
||||
String vipLevel}) {
|
||||
this._activateStatus = activateStatus;
|
||||
this._createdAt = createdAt;
|
||||
this._objectId = objectId;
|
||||
this._orderNumber = orderNumber;
|
||||
this._superiorWeixin = superiorWeixin;
|
||||
this._updatedAt = updatedAt;
|
||||
this._userObjectId = userObjectId;
|
||||
this._vipLevel = vipLevel;
|
||||
}
|
||||
|
||||
String get activateStatus => _activateStatus;
|
||||
set activateStatus(String activateStatus) => _activateStatus = activateStatus;
|
||||
String get createdAt => _createdAt;
|
||||
set createdAt(String createdAt) => _createdAt = createdAt;
|
||||
String get objectId => _objectId;
|
||||
set objectId(String objectId) => _objectId = objectId;
|
||||
String get orderNumber => _orderNumber;
|
||||
set orderNumber(String orderNumber) => _orderNumber = orderNumber;
|
||||
String get superiorWeixin => _superiorWeixin;
|
||||
set superiorWeixin(String superiorWeixin) => _superiorWeixin = superiorWeixin;
|
||||
String get updatedAt => _updatedAt;
|
||||
set updatedAt(String updatedAt) => _updatedAt = updatedAt;
|
||||
String get userObjectId => _userObjectId;
|
||||
set userObjectId(String userObjectId) => _userObjectId = userObjectId;
|
||||
String get vipLevel => _vipLevel;
|
||||
set vipLevel(String vipLevel) => _vipLevel = vipLevel;
|
||||
|
||||
Arr.fromJson(Map<String, dynamic> json) {
|
||||
_activateStatus = json['activateStatus'];
|
||||
_createdAt = json['createdAt'];
|
||||
_objectId = json['objectId'];
|
||||
_orderNumber = json['orderNumber'];
|
||||
_superiorWeixin = json['superiorWeixin'];
|
||||
_updatedAt = json['updatedAt'];
|
||||
_userObjectId = json['userObjectId'];
|
||||
_vipLevel = json['vipLevel'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['activateStatus'] = this._activateStatus;
|
||||
data['createdAt'] = this._createdAt;
|
||||
data['objectId'] = this._objectId;
|
||||
data['orderNumber'] = this._orderNumber;
|
||||
data['superiorWeixin'] = this._superiorWeixin;
|
||||
data['updatedAt'] = this._updatedAt;
|
||||
data['userObjectId'] = this._userObjectId;
|
||||
data['vipLevel'] = this._vipLevel;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
1
untitled/lib/event/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
0c3c1fdf-d565-4af5-a1d0-eb4e01b9a5b9
|
||||
4
untitled/lib/event/ClassEditEvent.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
class ClassEditEvent {
|
||||
bool update;
|
||||
ClassEditEvent(this.update);
|
||||
}
|
||||
3
untitled/lib/event/_.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
library event;
|
||||
|
||||
export 'ClassEditEvent.dart';
|
||||
1
untitled/lib/http/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
e8aca102-28d2-4562-a27e-b7fa6475de4d
|
||||
68
untitled/lib/http/Dio.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
/// 单例模式封装 dio
|
||||
class HttpApi {
|
||||
Dio _Dio;
|
||||
static HttpApi _instance = HttpApi.instance();
|
||||
factory HttpApi() => _instance;
|
||||
|
||||
HttpApi.instance() {
|
||||
if (null == _Dio) {
|
||||
BaseOptions options = new BaseOptions(
|
||||
baseUrl: Config.ApiUrl['PhotoBaseUrl'],
|
||||
connectTimeout: 30000,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
responseType: ResponseType.json,
|
||||
);
|
||||
|
||||
_Dio = new Dio(options);
|
||||
_Dio.interceptors.add(InterceptorsWrapper(onRequest: (RequestOptions options) {
|
||||
// 请求拦截器
|
||||
return options;
|
||||
},onResponse: (Response response) {
|
||||
// 响应拦截器
|
||||
return response;
|
||||
},onError: (DioError e) {
|
||||
|
||||
print("网络请求出现错误 ====== ${e.message}");
|
||||
// 错误拦截器
|
||||
return e;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/// GET 请求
|
||||
Future get({@required String url, Options options, dynamic params}) async {
|
||||
SetBaseUrl(url);
|
||||
Response res = await _Dio.get(url, queryParameters: params, options: options);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/// POST 请求
|
||||
Future post({@required String url, Options options, dynamic params}) async {
|
||||
SetBaseUrl(url);
|
||||
Response res = await _Dio.post(url, data: params, options: options);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
void SetBaseUrl(String url) {
|
||||
if (url == "/likeList") {
|
||||
_Dio.options.baseUrl = Config.ApiUrl['VideoBaseUrl'];
|
||||
} else {
|
||||
_Dio.options.baseUrl = Config.ApiUrl['PhotoBaseUrl'];
|
||||
}
|
||||
}
|
||||
|
||||
/// 下载文件
|
||||
Future downloadFile(String urlPath, String savePath, { ProgressCallback onReceiveProgress }) async {
|
||||
Response response = await _Dio.download(
|
||||
urlPath,
|
||||
savePath,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
options: Options(sendTimeout: 25000, receiveTimeout: 25000));
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
11
untitled/lib/main.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/router/AppRouter.dart';
|
||||
import 'package:peach/Configure.dart';
|
||||
/*
|
||||
* 程序的核心入口
|
||||
*/
|
||||
void main() async {
|
||||
await Configure.init();
|
||||
runApp(ModularApp(module: AppRouter()));
|
||||
}
|
||||
1
untitled/lib/router/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
20417602-3855-4ff6-ab44-b3fb62c8fd5b
|
||||
22
untitled/lib/router/AppNode.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
/*
|
||||
* 根组件
|
||||
*/
|
||||
class AppNode extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ScreenUtilInit(
|
||||
designSize: Size(375, 667),
|
||||
allowFontScaling: false,
|
||||
child: MaterialApp(
|
||||
initialRoute: "/",
|
||||
navigatorKey: Modular.navigatorKey,
|
||||
onGenerateRoute: Modular.generateRoute,
|
||||
debugShowCheckedModeBanner: false,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
86
untitled/lib/router/AppRouter.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/router/AppNode.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/views/User/AgentRegister.dart';
|
||||
|
||||
import 'package:peach/views/Welcome.dart';
|
||||
import 'package:peach/views/Details/index.dart';
|
||||
import 'package:peach/views/App.dart';
|
||||
|
||||
import 'package:peach/views/Me/Like.dart';
|
||||
import 'package:peach/views/Me/Agreement.dart';
|
||||
import 'package:peach/views/Me/Recently.dart';
|
||||
import 'package:peach/views/Me/SingleGraph.dart';
|
||||
import 'package:peach/views/Me/About.dart';
|
||||
import 'package:peach/views/Me/Vip/Vip.dart';
|
||||
import 'package:peach/views/Me/Vip/BuyStatus.dart';
|
||||
|
||||
import 'package:peach/views/Me/Agent.dart';
|
||||
import 'package:peach/views/Me/Video/Video.dart';
|
||||
// import 'package:peach/views/Me/Video/VideoDetails.dart';
|
||||
|
||||
import 'package:peach/views/Home/Edit.dart';
|
||||
import 'package:peach/views/Home/Search.dart';
|
||||
|
||||
import 'package:peach/views/Model/ModelInfo.dart';
|
||||
import 'package:peach/views/Mechanism/MechanismList.dart';
|
||||
|
||||
import 'package:peach/views/User/Login.dart';
|
||||
import 'package:peach/views/User/Register.dart';
|
||||
import 'package:peach/views/User/AgentRegister.dart';
|
||||
/*
|
||||
* 路由配置
|
||||
*/
|
||||
class AppRouter extends MainModule {
|
||||
|
||||
@override
|
||||
List<Bind> get binds => [];
|
||||
|
||||
@override
|
||||
List<ModularRouter> get routers => [
|
||||
ModularRouter('/', child: (_, __) => Config.isFirstOpen ? Welcome() : Config.isLogin ? Login() : App(),
|
||||
transition: TransitionType.fadeIn,
|
||||
),
|
||||
ModularRouter('/init', child: (_, __) => App(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/like', child: (_, __) => Like(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/edit', child: (_, __) => Edit(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/agreement', child: (_, __) => Agreement(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/about', child: (_, __) => About(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/video', child: (_, __) => Video(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/singlegraph', child: (_, __) => SingleGraph(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/recently', child: (_, __) => Recently(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/search', child: (_, __) => Search(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/login', child: (_, __) => Login(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/reg', child: (_, __) => Register(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/vip', child: (_, __) => Vip(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/status', child: (_, __) => BuyStatus(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/agent', child: (_, __) => Agent(), transition: TransitionType.fadeIn,),
|
||||
ModularRouter('/agentReg', child: (_, __) => AgentRegister(), transition: TransitionType.fadeIn,),
|
||||
// ModularRouter('/videoDetails/:title/:mp4/:m3u8/:gif', child: (_, args) => VideoDetails(
|
||||
// title: args.params['title'],
|
||||
// mp4: args.params['mp4'],
|
||||
// m3u8: args.params['m3u8'],
|
||||
// gif: args.params['gif'],
|
||||
// ), transition: TransitionType.fadeIn,),
|
||||
|
||||
ModularRouter('/modelInfo/:id/:title', child: (_, args) => ModelInfo(
|
||||
id: args.params['id'],
|
||||
title: args.params['title'],
|
||||
), transition: TransitionType.fadeIn,),
|
||||
|
||||
ModularRouter('/mechanismList/:id/:title/:type', child: (_, args) => MechanismList(
|
||||
id: args.params['id'],
|
||||
title: args.params['title'],
|
||||
type: args.params['type']
|
||||
), transition: TransitionType.fadeIn,),
|
||||
|
||||
ModularRouter('/details/:id', child: (_, args) => DetailsIndex(
|
||||
id: args.params['id']
|
||||
), transition: TransitionType.fadeIn,
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget get bootstrap => AppNode();
|
||||
}
|
||||
1
untitled/lib/service/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
00f50071-d360-4bcc-aaeb-8c1a183444f7
|
||||
48
untitled/lib/service/ClassService.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/db/SQLite.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
|
||||
class ClassService {
|
||||
|
||||
static String tableNamePrincipal = "Principal"; // 默认菜单
|
||||
static String tableNameAdditional = "Additional";// 可选菜单
|
||||
|
||||
/// 向指定表插入List数据
|
||||
static Future<void> addList(String tableName, List<Principal> res) async {
|
||||
List<Map<String, dynamic>> data = await ClassService.findAll(tableName);
|
||||
// 如果表中没有数据,执行插入
|
||||
if (data.isEmpty) {
|
||||
var _db = await SQLite().db;
|
||||
res.forEach((e) async {
|
||||
await _db.insert(tableName, e.toJson());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// 查询指定表中菜单数据
|
||||
static Future<List<Map<String, dynamic>>> findAll(String tableName) async {
|
||||
var _db = await await SQLite().db;
|
||||
List<Map<String, dynamic>> result = await _db.query(tableName, orderBy: "id DESC");
|
||||
return result.isNotEmpty
|
||||
? result
|
||||
: [];
|
||||
}
|
||||
|
||||
/// 添加菜单到指定表
|
||||
static Future<int> add({ String tableName , Principal item }) async {
|
||||
var _db = await SQLite().db;
|
||||
return await _db.insert(tableName, item.toJson());
|
||||
}
|
||||
|
||||
/// 从指定表删除菜单
|
||||
static Future<int> delete({ String tableName , Principal item }) async {
|
||||
var _db = await await SQLite().db;
|
||||
return await _db.delete(
|
||||
tableName,
|
||||
where: 'id = ?',
|
||||
whereArgs: [item.id]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
14
untitled/lib/service/DownloadService.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
|
||||
class DownloadService {
|
||||
|
||||
/// 下载图片
|
||||
static Future downImage({ String url, Map<String, dynamic> params}) async {
|
||||
return await HttpApi().get(
|
||||
url: url,
|
||||
params: params,
|
||||
options: Options(responseType: ResponseType.bytes)
|
||||
);
|
||||
}
|
||||
}
|
||||
105
untitled/lib/service/HomeService.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/ClassService.dart';
|
||||
|
||||
class HomeService {
|
||||
|
||||
/// 获取分类菜单
|
||||
static Future<ClassResult> GetClassData({ Map<String, dynamic> params }) async {
|
||||
List<Map<String, dynamic>> a = await ClassService.findAll("Principal");
|
||||
|
||||
// 如果数据库有数据,那么直接返回数据库的数据
|
||||
if (a.isNotEmpty) {
|
||||
print("如果数据库有分类的数据,那么直接");
|
||||
List<Map<String, dynamic>> b = await ClassService.findAll("Additional");
|
||||
return ClassResult.fromJson({
|
||||
'principal': a,
|
||||
'additional': b,
|
||||
});
|
||||
// 没有数据调接口请求新的分类
|
||||
} else {
|
||||
print("如果数据库没有分类的数据,那么掉接口");
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['class'],
|
||||
params: params
|
||||
);
|
||||
var resJson = ClassEntity.fromJson(res).result;
|
||||
resJson.principal.forEach((v) {
|
||||
print("principal =============== ${v.id}");
|
||||
});
|
||||
|
||||
resJson.additional.forEach((v) {
|
||||
print("additional ++++++++++++++++++ ${v.id}");
|
||||
});
|
||||
await ClassService.addList("Principal",resJson.principal);
|
||||
await ClassService.addList("Additional",resJson.additional);
|
||||
return resJson;
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取分类下的数据列表
|
||||
static Future<AgentClassListData> GetClassListData({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentClassList'],
|
||||
params: params
|
||||
);
|
||||
return AgentClassListEntity.fromJson(res).data;
|
||||
}
|
||||
|
||||
/// 获取详情页数据
|
||||
static Future<AgentInfo> GetInfoData({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentInfo'],
|
||||
params: params
|
||||
);
|
||||
return AgentInfoEntity.fromJson(res).data;
|
||||
}
|
||||
|
||||
/// 获取首页数据
|
||||
static Future<Result> GetHomeData({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['index'],
|
||||
params: params
|
||||
);
|
||||
return HomeEntity.fromJson(res).result;
|
||||
}
|
||||
|
||||
/// App更新接口
|
||||
static Future<UpdateVersionEntity> update({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['update'],
|
||||
params: params
|
||||
);
|
||||
return UpdateVersionEntity.fromJson(res);
|
||||
}
|
||||
|
||||
|
||||
static Future<AgentClassListData> GetRecently({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentRecently'],
|
||||
params: params
|
||||
);
|
||||
return AgentClassListEntity.fromJson(res).data;
|
||||
}
|
||||
|
||||
/// 获取搜索的数据
|
||||
static Future<List<ItemList>> GetSearchData({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentSearch'],
|
||||
params: params
|
||||
);
|
||||
return SearchEntity.fromJson(res).data;
|
||||
}
|
||||
|
||||
// 获取随机数据
|
||||
static Future<AgentClassListData> GetAgentRandom({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentRandom'],
|
||||
params: params
|
||||
);
|
||||
return AgentClassListEntity.fromJson(res).data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
93
untitled/lib/service/LikeService.dart
Normal file
@@ -0,0 +1,93 @@
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/db/SQLite.dart';
|
||||
|
||||
class LikeService {
|
||||
|
||||
static String TableName = "Like";
|
||||
static String tabsNameSingleGraph = "SingleGraph";
|
||||
|
||||
///====================== 写真收藏 ======================///
|
||||
|
||||
/// 添加喜欢
|
||||
static Future<int> addLike(LikeEntity user) async {
|
||||
var _db = await SQLite().db;
|
||||
return await _db.insert(LikeService.TableName, user.toJson());
|
||||
}
|
||||
|
||||
/// 查询所有喜欢数据
|
||||
static Future<List<LikeEntity>> findAll() async {
|
||||
var _db = await await SQLite().db;
|
||||
List<Map<String, dynamic>> result = await _db.query(LikeService.TableName);
|
||||
|
||||
return result.isNotEmpty
|
||||
? result.map((e) {
|
||||
return LikeEntity.fromJson(e);
|
||||
}).toList()
|
||||
:[];
|
||||
}
|
||||
|
||||
/// 根据id查询数据,注意这里返回 true,false,
|
||||
/// 主要为了在详情页控制收藏按钮的样式,如果需要返回数据
|
||||
/// 需要修改类型为: Future<List<LikeEntity>> 和 return的结果
|
||||
/// LikeEntity.fromJson(e);
|
||||
static Future<bool> find(int id) async {
|
||||
var _db = await SQLite().db;
|
||||
List<Map<String, dynamic>> result = await _db.query(
|
||||
LikeService.TableName,
|
||||
where: 'id = ?',
|
||||
whereArgs: [id]
|
||||
);
|
||||
return result.isNotEmpty ? true : false;
|
||||
}
|
||||
|
||||
/// 根据id删除数据
|
||||
static Future<int> delete(int id) async {
|
||||
var _db = await await SQLite().db;
|
||||
return await _db.delete(
|
||||
LikeService.TableName,
|
||||
where: 'id = ?',
|
||||
whereArgs: [id]
|
||||
);
|
||||
}
|
||||
|
||||
///====================== 单图收藏 ======================
|
||||
|
||||
// 查询所有收藏的图片
|
||||
static Future<List<SingleGraphEntity>> findAllImg() async {
|
||||
var _db = await await SQLite().db;
|
||||
List<Map<String, dynamic>> result = await _db.query(LikeService.tabsNameSingleGraph, orderBy: "id DESC");
|
||||
return result.isNotEmpty
|
||||
? result.map((e) {
|
||||
return SingleGraphEntity.fromJson(e);
|
||||
}).toList()
|
||||
:[];
|
||||
}
|
||||
|
||||
// 添加图片
|
||||
static Future<int> addImg(SingleGraphEntity Img) async {
|
||||
var _db = await SQLite().db;
|
||||
return await _db.insert(LikeService.tabsNameSingleGraph, Img.toJson());
|
||||
}
|
||||
|
||||
// 检测图片是否已经收藏过
|
||||
static Future<bool> checkIsLike(String src) async {
|
||||
var _db = await SQLite().db;
|
||||
List<Map<String, dynamic>> result = await _db.query(
|
||||
LikeService.tabsNameSingleGraph,
|
||||
where: 'src = ?',
|
||||
whereArgs: [src]
|
||||
);
|
||||
return result.isNotEmpty ? true : false;
|
||||
}
|
||||
|
||||
// 根据 地址删除收藏的图片
|
||||
static Future<int> deleteImg(String src) async {
|
||||
var _db = await await SQLite().db;
|
||||
return await _db.delete(
|
||||
LikeService.tabsNameSingleGraph,
|
||||
where: 'src = ?',
|
||||
whereArgs: [src]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
25
untitled/lib/service/MechanismService.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
|
||||
class MechanismService {
|
||||
|
||||
/// 获取分类列表的数据
|
||||
static Future<List<MechanismResult>> GetMechanismData({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['mechanism'],
|
||||
params: params
|
||||
);
|
||||
return MechanismEntity.fromJson(res).result;
|
||||
}
|
||||
|
||||
/// 机构列表点击进入详情
|
||||
static Future<AgentClassListData> GetmechanismList({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentMechanismList'],
|
||||
params: params
|
||||
);
|
||||
return AgentClassListEntity.fromJson(res).data;
|
||||
}
|
||||
|
||||
}
|
||||
27
untitled/lib/service/ModelService.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
|
||||
class ModelService {
|
||||
|
||||
/// 模特列表
|
||||
static Future<ModelResult> GetModelData({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['allModel'],
|
||||
params: params
|
||||
);
|
||||
return ModelEntity.fromJson(res).result;
|
||||
}
|
||||
|
||||
|
||||
/// 进入模特主页
|
||||
static Future<ModelInfoResult> GetModelInfo({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['modelList'],
|
||||
params: params
|
||||
);
|
||||
print(" ===== > ${res}");
|
||||
return ModelInfoEntity.fromJson(res).result;
|
||||
}
|
||||
|
||||
}
|
||||
60
untitled/lib/service/UserService.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
|
||||
class UserService {
|
||||
|
||||
/// 用户登录接口
|
||||
static Future<LoginEntity> userLogin({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['login'],
|
||||
params: params
|
||||
);
|
||||
return LoginEntity.fromJson(res);
|
||||
}
|
||||
|
||||
/// 用户注册接口
|
||||
static Future<RegisterEntity> userRegister({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['register'],
|
||||
params: params
|
||||
);
|
||||
return RegisterEntity.fromJson(res);
|
||||
}
|
||||
|
||||
/// 代理用户注册
|
||||
static Future<RegisterEntity> agentUserRegister({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['agentreg'],
|
||||
params: params
|
||||
);
|
||||
return RegisterEntity.fromJson(res);
|
||||
}
|
||||
|
||||
/// 免费试看的次数限制
|
||||
static Future<FreeUseEntity> freeUse({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['freeUse'],
|
||||
params: params
|
||||
);
|
||||
return FreeUseEntity.fromJson(res);
|
||||
}
|
||||
|
||||
/// 办理会员的时候的 下单接口
|
||||
static Future<RegisterEntity> placeOrder({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['place'],
|
||||
params: params
|
||||
);
|
||||
return RegisterEntity.fromJson(res);
|
||||
}
|
||||
|
||||
/// 办理会员的时候的 下单接口
|
||||
static Future<orderStatusEntity> orderStatus({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().post(
|
||||
url: Config.ApiUrl['ApiList']['orderStatus'],
|
||||
params: params
|
||||
);
|
||||
return orderStatusEntity.fromJson(res);
|
||||
}
|
||||
}
|
||||
17
untitled/lib/service/VideoService.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
|
||||
class VideoService {
|
||||
|
||||
/// 视频列表
|
||||
static Future<VideoListEntity> GetVideoList({ Map<String, dynamic> params }) async {
|
||||
var res = await HttpApi().get(
|
||||
url: Config.ApiUrl['ApiList']['videoType'],
|
||||
params: params
|
||||
);
|
||||
return VideoListEntity.fromJson(res);
|
||||
}
|
||||
|
||||
}
|
||||
10
untitled/lib/service/_.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
library Service;
|
||||
|
||||
export 'HomeService.dart';
|
||||
export 'MechanismService.dart';
|
||||
export 'ModelService.dart';
|
||||
export 'LikeService.dart';
|
||||
export 'DownloadService.dart';
|
||||
export 'ClassService.dart';
|
||||
export 'VideoService.dart';
|
||||
export 'UserService.dart';
|
||||
1
untitled/lib/static/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
769ddd7d-bc0a-4cbf-8b4b-9bd0452966ce
|
||||
1
untitled/lib/static/fonts/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
fa247bc9-574e-451b-96d2-f5b4aafdd46a
|
||||
BIN
untitled/lib/static/fonts/iconfont.ttf
Normal file
1
untitled/lib/static/img/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
cdb19a1b-12d2-411a-9fc9-f98200576e60
|
||||
BIN
untitled/lib/static/img/back.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
untitled/lib/static/img/logo.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
untitled/lib/static/img/taxi.png
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
untitled/lib/static/img/update_bg_app_top.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
untitled/lib/static/img/update_ic_close.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
untitled/lib/static/img/vipLogo.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
untitled/lib/static/img/welcome2.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
untitled/lib/static/img/welcome3.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
1
untitled/lib/utils/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
3ab93c5c-ff68-4b41-87a2-fbcbc04b6bdd
|
||||
74
untitled/lib/utils/AuthorityApplication.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
/*
|
||||
* 动态申请App的权限
|
||||
*/
|
||||
class AuthorityApplication {
|
||||
/// App需要动态申请的权限
|
||||
static List<Permission> permissionList = [ Permission.storage, Permission.photos ];
|
||||
|
||||
static Future<bool> init(BuildContext context) async {
|
||||
if (Config.isAndroid) {
|
||||
Map<Permission, PermissionStatus> status = await permissionList.request();
|
||||
if (status[Permission.storage].isGranted) {
|
||||
print("用户同意了权限");
|
||||
return true;
|
||||
} else if (status[Permission.storage].isDenied) {
|
||||
print("用户拒绝了权限");
|
||||
AuthorityApplication.ShowTips(
|
||||
context: context, content: "请允许App获取权限,否则App功能不能正常使用!",
|
||||
isShowcancel: false,
|
||||
confirmCall: () async {
|
||||
AuthorityApplication.init(context);
|
||||
},
|
||||
);
|
||||
return false;
|
||||
} else if (status[Permission.storage].isPermanentlyDenied) {
|
||||
print("用户永久拒绝了权限");
|
||||
AuthorityApplication.ShowTips(
|
||||
context: context, content: "您禁用了应用的必要权限,请到设置里开启!",
|
||||
isShowcancel: false, confirmText: '打开设置',
|
||||
confirmCall: () async {
|
||||
await openAppSettings();
|
||||
},
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future ShowTips({
|
||||
BuildContext context, String content,
|
||||
bool isShowcancel: true, Function confirmCall,
|
||||
confirmText = "重新请求", title = '提示'
|
||||
}) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(content),
|
||||
actions: <Widget>[
|
||||
isShowcancel
|
||||
? FlatButton(
|
||||
child: Text('取消', style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
})
|
||||
: Text(''),
|
||||
FlatButton(
|
||||
child: Text(confirmText, style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () async {
|
||||
confirmCall();
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
94
untitled/lib/utils/CLearCache.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
import 'dart:io';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
/*
|
||||
* 计算清除缓存
|
||||
*/
|
||||
class ClearCache {
|
||||
|
||||
///加载缓存
|
||||
static Future<String> loadCache() async {
|
||||
try {
|
||||
Directory tempDir = await getTemporaryDirectory();
|
||||
double value = await ClearCache._getTotalSizeOfFilesInDir(tempDir);
|
||||
// tempDir.list(followLinks: false,recursive: true).listen((file){
|
||||
// //打印每个缓存文件的路径
|
||||
// print(file.path);
|
||||
// });
|
||||
return ClearCache._renderSize(value);
|
||||
} catch (err) {
|
||||
print(err);
|
||||
}
|
||||
}
|
||||
|
||||
// 清理缓存
|
||||
static Future<bool> clearCache() async {
|
||||
//此处展示加载loading
|
||||
try {
|
||||
Directory tempDir = await getTemporaryDirectory();
|
||||
//删除缓存目录
|
||||
await ClearCache.delDir(tempDir);
|
||||
await ClearCache.loadCache();
|
||||
return true;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
return false;
|
||||
} finally {
|
||||
//此处隐藏加载loading
|
||||
}
|
||||
}
|
||||
|
||||
/// 递归方式 计算文件的大小
|
||||
static Future<double> _getTotalSizeOfFilesInDir(final FileSystemEntity file) async {
|
||||
try {
|
||||
if (file is File) {
|
||||
int length = await file.length();
|
||||
return double.parse(length.toString());
|
||||
}
|
||||
if (file is Directory) {
|
||||
final List<FileSystemEntity> children = file.listSync();
|
||||
double total = 0;
|
||||
if (children != null)
|
||||
for (final FileSystemEntity child in children)
|
||||
total += await ClearCache._getTotalSizeOfFilesInDir(child);
|
||||
return total;
|
||||
}
|
||||
return 0;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
///递归方式删除目录
|
||||
static Future<Null> delDir(FileSystemEntity file) async {
|
||||
try {
|
||||
if (file is Directory) {
|
||||
final List<FileSystemEntity> children = file.listSync();
|
||||
for (final FileSystemEntity child in children) {
|
||||
await delDir(child);
|
||||
}
|
||||
}
|
||||
await file.delete();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// 格式化文件大小
|
||||
static String _renderSize(double value) {
|
||||
if (null == value) {
|
||||
return '0';
|
||||
}
|
||||
List<String> unitArr = List()..add('B')..add('K')..add('M')..add('G');
|
||||
int index = 0;
|
||||
while (value > 1024) {
|
||||
index++;
|
||||
// value = value / 1024;
|
||||
value = value / 8024;
|
||||
}
|
||||
String size = value.toStringAsFixed(2);
|
||||
return size + unitArr[index];
|
||||
}
|
||||
|
||||
}
|
||||
119
untitled/lib/utils/CheckUpdate.dart
Normal file
@@ -0,0 +1,119 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_update_dialog/update_dialog.dart';
|
||||
import 'package:install_plugin/install_plugin.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/http/Dio.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
|
||||
/*
|
||||
* 检测新版本
|
||||
*/
|
||||
class CheckUpdate {
|
||||
// 保存升级弹窗
|
||||
UpdateDialog _dialog;
|
||||
double _progress = 0.0;
|
||||
File _apkFile;
|
||||
|
||||
Future<bool> check(BuildContext context) async {
|
||||
// 检查版本
|
||||
UpdateVersionEntity res = await HomeService.update(params: {});
|
||||
|
||||
// 如果需要升级
|
||||
if (int.parse(Config.packageInfo.buildNumber) < res.versionCode) {
|
||||
if (_dialog != null && _dialog.isShowing()) {
|
||||
return false;
|
||||
}
|
||||
// 升级的内容信息
|
||||
String updateContent = "";
|
||||
res.updateMsg.forEach((v) => updateContent = updateContent + "${v}\n");
|
||||
|
||||
// 显示弹窗
|
||||
_dialog = UpdateDialog.showUpdate(context,
|
||||
title: "发现新版本v${res.version},请升级!",
|
||||
updateContent: updateContent,
|
||||
width: 250,
|
||||
topImage: Image.asset(R.libStaticImgUpdateBgAppTopPng),
|
||||
themeColor: ColorConfig.ThemeColor,
|
||||
updateButtonText: '升级',
|
||||
isForce: true,
|
||||
onUpdate: () async {
|
||||
// 如果是android 那么下载app
|
||||
if (Config.isAndroid) {
|
||||
// 获取临时下载地址
|
||||
_apkFile = await getApkFileByUpdateEntity(res);
|
||||
await onUpdate(res);
|
||||
// 如果是ios 那么打开appstore
|
||||
} else {
|
||||
InstallPlugin.gotoAppStore(Config.iosDownApkUrl);
|
||||
}
|
||||
}
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 下载文件,更新进度条
|
||||
Future<void> onUpdate(UpdateVersionEntity res) async {
|
||||
await HttpApi().downloadFile(
|
||||
res.downUrl, _apkFile.path,
|
||||
onReceiveProgress: (int count, int total) {
|
||||
_progress = count.toDouble() / total;
|
||||
if (_progress <= 1.0001) {
|
||||
_dialog.update(_progress);
|
||||
}
|
||||
}).then((value) {
|
||||
_dialog.dismiss();
|
||||
installAPP();
|
||||
}).catchError((value) {
|
||||
_dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
/// android 安装app
|
||||
void installAPP() async {
|
||||
String packageName = Config.packageInfo.packageName;
|
||||
InstallPlugin.installApk(_apkFile.path, packageName);
|
||||
}
|
||||
|
||||
/// 根据更新信息获取apk安装文件
|
||||
Future<File> getApkFileByUpdateEntity(UpdateVersionEntity res) async {
|
||||
// 获取app文件名
|
||||
String appName = getApkNameByDownloadUrl(res.downUrl);
|
||||
// 获取下载的缓存路径
|
||||
String dirPath = await getDownloadDirPath();
|
||||
return File("$dirPath/${res.versionCode}/$appName");
|
||||
}
|
||||
|
||||
///获取下载缓存路径
|
||||
Future<String> getDownloadDirPath() async {
|
||||
Directory directory = Config.isAndroid
|
||||
? await getExternalStorageDirectory()
|
||||
: await getApplicationDocumentsDirectory();
|
||||
return directory.path;
|
||||
}
|
||||
|
||||
///根据下载地址获取文件名
|
||||
String getApkNameByDownloadUrl(String downloadUrl) {
|
||||
if (downloadUrl.isEmpty) {
|
||||
return "temp_${currentTimeMillis()}.apk";
|
||||
} else {
|
||||
String appName = downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1);
|
||||
if (!appName.endsWith(".apk")) {
|
||||
appName = "temp_${currentTimeMillis()}.apk";
|
||||
}
|
||||
return appName;
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回随机文件名
|
||||
int currentTimeMillis() {
|
||||
return DateTime.now().millisecondsSinceEpoch;
|
||||
}
|
||||
}
|
||||
101
untitled/lib/utils/Core.dart
Normal file
@@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import '_.dart';
|
||||
|
||||
/*
|
||||
* 核心的utils,主要封装UI相关的操作
|
||||
*/
|
||||
class Core {
|
||||
|
||||
static FreeUseEntity freeUseStatus;
|
||||
|
||||
/// 修改状态栏颜色
|
||||
static void SetStatusThemeColor({Color color : ColorConfig.ThemeColor}) {
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
statusBarColor: ColorConfig.ThemeColor
|
||||
));
|
||||
}
|
||||
|
||||
static void deleteDialog(BuildContext context, Function callback,{ String content: "确认删除该收藏吗?" }) async {
|
||||
return await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text(content),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text('取消',style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text('确认',style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () async {
|
||||
callback();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// 调用接口,减少免费试看的次数
|
||||
static Future<FreeUseEntity> freeUse(BuildContext context, Function vipCallBack) async {
|
||||
freeUseStatus = await UserService.freeUse(params: { 'objectId': Tool.userInfo()['objectId'] });
|
||||
// 如果已经没有免费试看的次数了,弹窗提醒
|
||||
if (freeUseStatus.freeNumber == 0) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
title: Text('温馨提示'),
|
||||
content: Text("免费体验到期,请开通VIP,享受更多特权和功能!"),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text('取消',style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () {
|
||||
Modular.to.pop();
|
||||
Modular.to.pop();
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text('开通VIP',style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () async {
|
||||
Modular.to.pushNamed('/vip');
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
vipCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
// -1 表示已经开通了vip
|
||||
static bool isVip(BuildContext context) {
|
||||
print("freeUseStatus.freeNumber ======= ${freeUseStatus.freeNumber}");
|
||||
if (freeUseStatus.freeNumber == -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// 复制文字到剪切板
|
||||
static void copy (String message) {
|
||||
Clipboard.setData(ClipboardData(text: message));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
160
untitled/lib/utils/IconFont.dart
Normal file
@@ -0,0 +1,160 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
/*
|
||||
* IconFont 字体图标
|
||||
*/
|
||||
class IconFont {
|
||||
|
||||
static Icon LogoIcon ({double size = 24.0, Color color = ColorConfig.WhiteBackColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe61c, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon ModelIcon ({double size = 24.0, Color color = ColorConfig.WhiteBackColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe61f, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon MeIcon ({double size = 24.0, Color color = ColorConfig.WhiteBackColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe611, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon MechanismIcon ({double size = 24.0, Color color = ColorConfig.WhiteBackColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe61a, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon HomeIcon ({double size = 24.0, Color color = ColorConfig.WhiteBackColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe617, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon HistoryIcon ({double size = 24.0, Color color = ColorConfig.WhiteBackColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe600, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon VipIcon ({double size = 24.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe6ba, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon DaLiIcon ({double size = 24.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe618, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon UpdateIcon ({double size = 24.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe63c, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon ClearIcon ({double size = 22.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe616, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon XieYiIcon ({double size = 22.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe6b2, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon AboutIcon ({double size = 22.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe637, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon NewsIcon ({double size = 22.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe6c0, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon VideoIcon ({double size = 22.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe60c, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon PictureIcon ({double size = 20.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe61e, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon BuyIcon ({double size = 20.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe73b, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon StatusIcon ({double size = 20.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe655, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon OrderIcon ({double size = 20.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe620, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
|
||||
static Icon WeiXinIcon ({double size = 20.0, Color color = ColorConfig.TextColor}) {
|
||||
return Icon(
|
||||
const IconData(0xe64f, fontFamily: 'iconfont'),
|
||||
size: size,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
}
|
||||
42
untitled/lib/utils/JiGuangPush.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
/*
|
||||
* 极光消息推送
|
||||
*/
|
||||
class JiGuangPush {
|
||||
JPush _jpush;
|
||||
static JiGuangPush _instance = JiGuangPush.instance();
|
||||
factory JiGuangPush() => _instance;
|
||||
|
||||
JiGuangPush.instance() {
|
||||
if (null == _jpush) {
|
||||
_jpush = new JPush();
|
||||
addEventHandler();
|
||||
_jpush.setup(
|
||||
appKey: Config.JgConfig['appKey'],
|
||||
channel: Config.JgConfig['channel'],
|
||||
production: Config.JgConfig['production'],
|
||||
debug: Config.JgConfig['debug'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
addEventHandler() {
|
||||
_jpush.addEventHandler(
|
||||
// 接收通知回调方法。
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
print("收到的消息为:: $message");
|
||||
},
|
||||
// 点击通知回调方法。
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
print("消息被点击了: $message");
|
||||
},
|
||||
// 接收自定义消息回调方法。
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
print("flutter onReceiveMessage: $message");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
27
untitled/lib/utils/Screen.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
/*
|
||||
* 尺寸兼容,类似前端的rem
|
||||
*/
|
||||
class Screen {
|
||||
static double setWidth (double width) {
|
||||
return ScreenUtil().setWidth(width);
|
||||
}
|
||||
|
||||
static double setHeight (double height) {
|
||||
return ScreenUtil().setHeight(height);
|
||||
}
|
||||
|
||||
static double setFontSize(double Size) {
|
||||
return ScreenUtil().setSp(Size, allowFontScalingSelf: true);
|
||||
}
|
||||
|
||||
static double width(BuildContext context) {
|
||||
return MediaQuery.of(context).size.width;
|
||||
}
|
||||
|
||||
static double height(BuildContext context) {
|
||||
return MediaQuery.of(context).size.height;
|
||||
}
|
||||
}
|
||||
55
untitled/lib/utils/SharedPreferences.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/*
|
||||
* shared_preferences 配置
|
||||
*/
|
||||
class SPreferences {
|
||||
|
||||
static final SPreferences _instance = SPreferences._();
|
||||
factory SPreferences() => _instance;
|
||||
SPreferences._();
|
||||
static SharedPreferences _prefs;
|
||||
|
||||
|
||||
static Future<void> init() async {
|
||||
if (_prefs == null) {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
// 设置数字类型
|
||||
Future<bool> setInt(String key, int value) async {
|
||||
return await _prefs.setInt(key, value);
|
||||
}
|
||||
|
||||
// 设置bool
|
||||
Future<bool> setBool(String key, bool value) async {
|
||||
return await _prefs.setBool(key, value);
|
||||
}
|
||||
|
||||
// 设置String
|
||||
Future<bool> setString(String key, String value) async {
|
||||
return await _prefs.setString(key, value);
|
||||
}
|
||||
|
||||
String getString(String key) {
|
||||
return _prefs.getString(key);
|
||||
}
|
||||
|
||||
bool getIsLogin() {
|
||||
if (_prefs.containsKey("isLogin")) {
|
||||
return _prefs.getBool("isLogin");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool getBool(String key) {
|
||||
if (!(_prefs.containsKey(key))) {
|
||||
_prefs.setBool(key, true);
|
||||
return false;
|
||||
}
|
||||
return _prefs.getBool(key);
|
||||
}
|
||||
|
||||
}
|
||||
105
untitled/lib/utils/Tool.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
import 'dart:convert';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
|
||||
/*
|
||||
* 工具函数,主要给dart逻辑使用
|
||||
*/
|
||||
class Tool {
|
||||
|
||||
/// 按照指定下标将数组分割为二维数组
|
||||
static List<List<T>> splitList<T>(List<T> list, int len) {
|
||||
if (len <= 1) {
|
||||
return [list];
|
||||
}
|
||||
|
||||
List<List<T>> result = List();
|
||||
int index = 1;
|
||||
|
||||
while (true) {
|
||||
if (index * len < list.length) {
|
||||
List<T> temp = list.skip((index - 1) * len).take(len).toList();
|
||||
result.add(temp);
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
List<T> temp = list.skip((index - 1) * len).toList();
|
||||
result.add(temp);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// 生成N位随机数
|
||||
static String randomBit([int len = 15]) {
|
||||
String scopeF = '123456789'; //首位
|
||||
String scopeC = '0123456789'; //中间
|
||||
String result = '';
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (i == 0) {
|
||||
result = scopeF[Random().nextInt(scopeF.length)];
|
||||
} else {
|
||||
result = result + scopeC[Random().nextInt(scopeC.length)];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// 检查用户是否有权限打开【单手模式】
|
||||
/// 权限规则:
|
||||
/// 1:对弹窗给的 androidid 进行 MD5 加密
|
||||
/// 2:在 com.example.untitled/files 文件夹中 用第一步的密文来创建文件
|
||||
/// 3:向文件中 写入 设备的 androidid
|
||||
/// 通过验证,正常访问..
|
||||
static Future<bool> checkIsOpen() async {
|
||||
String androidId = Config.androidDeviceInfo.androidId;
|
||||
Directory filesPath = await getExternalStorageDirectory();
|
||||
File completePath = File("${filesPath.path}/${generateMd5(androidId)}");
|
||||
if (completePath.existsSync()) {
|
||||
String textMessage = await completePath.readAsString();
|
||||
return textMessage == androidId ? true : false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* md5 加密
|
||||
*/
|
||||
static String generateMd5(String data) {
|
||||
var content = new Utf8Encoder().convert(data);
|
||||
var digest = md5.convert(content);
|
||||
// 这里其实就是 digest.toString()
|
||||
return hex.encode(digest.bytes);
|
||||
}
|
||||
|
||||
/// 从本地读取用户信息
|
||||
static Map userInfo() {
|
||||
String username = SPreferences().getString("username");
|
||||
String objectId = SPreferences().getString("objectId");
|
||||
String createdAt = SPreferences().getString("createdAt");
|
||||
String userType = SPreferences().getString("userType");
|
||||
String userWeiXin = SPreferences().getString("userWeiXin");
|
||||
Map info = new Map();
|
||||
info.addAll({
|
||||
'username': username,
|
||||
'objectId': objectId,
|
||||
'createdAt': createdAt,
|
||||
'userType': userType,
|
||||
'userWeiXin': userWeiXin,
|
||||
});
|
||||
return info;
|
||||
}
|
||||
|
||||
/// 验证是否为合法的手机号
|
||||
static bool isPhone(String str) {
|
||||
return new RegExp('^((13[0-9])|(15[^4])|(166)|(17[0-8])|(18[0-9])|(19[8-9])|(147,145))\\d{8}\$').hasMatch(str);
|
||||
}
|
||||
|
||||
}
|
||||
11
untitled/lib/utils/_.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
library utils;
|
||||
|
||||
export 'Screen.dart';
|
||||
export 'IconFont.dart';
|
||||
export 'Core.dart';
|
||||
export 'Tool.dart';
|
||||
export 'AuthorityApplication.dart';
|
||||
export 'CLearCache.dart';
|
||||
export 'SharedPreferences.dart';
|
||||
export 'CheckUpdate.dart';
|
||||
export 'JiGuangPush.dart';
|
||||
1
untitled/lib/views/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
2e1182b3-5819-46c1-8a60-e06c23722b1e
|
||||
96
untitled/lib/views/App.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
import 'package:fancy_bottom_navigation/fancy_bottom_navigation.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
|
||||
import 'package:peach/views/Home/Home.dart';
|
||||
import 'package:peach/views/Mechanism/Mechanism.dart';
|
||||
import 'package:peach/views/Model/Model.dart';
|
||||
import 'package:peach/views/Me/Me.dart';
|
||||
|
||||
/*
|
||||
* App的页面框架,底部tabs切换在这实现
|
||||
*/
|
||||
class App extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _App();
|
||||
}
|
||||
|
||||
class _App extends State<App> with AutomaticKeepAliveClientMixin {
|
||||
// 显示第几个页面的下标
|
||||
int currentIndex = 0;
|
||||
// fancy_bottom_navigation 需要的唯一key
|
||||
GlobalKey bottomNavigationKey = GlobalKey();
|
||||
// 存储从 bottomNavigationKey 中获取当前底部导航条的组件
|
||||
FancyBottomNavigationState fState;
|
||||
List<Widget> tabBodies = [ Home(), Mechanism(), Model(), Me() ];
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
CheckUpdate().check(context);
|
||||
Config.tabController = PageController(initialPage: currentIndex);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
Config.tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// 中间内容的组件
|
||||
Widget BodyWidget () {
|
||||
return PageView(
|
||||
controller: Config.tabController,
|
||||
children: tabBodies,
|
||||
// 整个页面滑动的时候,联动切换底部导航
|
||||
onPageChanged: (int index) {
|
||||
setState(() {
|
||||
currentIndex = index;
|
||||
fState = bottomNavigationKey.currentState;
|
||||
fState.setPage(currentIndex);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 底部导航
|
||||
Widget BottomNavigationWidget() {
|
||||
return FancyBottomNavigation(
|
||||
key: bottomNavigationKey,
|
||||
initialSelection: 0,
|
||||
textColor: ColorConfig.ThemeColor,
|
||||
inactiveIconColor: ColorConfig.ThemeColor,
|
||||
activeIconColor: ColorConfig.WhiteBackColor,
|
||||
circleColor: ColorConfig.ThemeColor,
|
||||
onTabChangedListener: (position) {
|
||||
setState(() {
|
||||
currentIndex = position;
|
||||
/// 带动画的去切换
|
||||
Config.tabController.jumpToPage(currentIndex);
|
||||
});
|
||||
},
|
||||
tabs: [
|
||||
TabData(iconData: IconFont.HomeIcon().icon, title: "首页"),
|
||||
TabData(iconData: IconFont.MechanismIcon().icon, title: "机构"),
|
||||
TabData(iconData: IconFont.ModelIcon().icon, title: "模特"),
|
||||
TabData(iconData: IconFont.MeIcon().icon, title: "我的")
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: false,
|
||||
body: BodyWidget(),
|
||||
bottomNavigationBar: BottomNavigationWidget(),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
untitled/lib/views/Details/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
7c2e172d-e970-4e88-8a58-11925c8c6062
|
||||
230
untitled/lib/views/Details/index.dart
Normal file
@@ -0,0 +1,230 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
||||
import 'package:image_pickers/image_pickers.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'package:share_extend/share_extend.dart';
|
||||
|
||||
class DetailsIndex extends StatefulWidget {
|
||||
final String id;
|
||||
DetailsIndex({Key key, this.id }): super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _DetailsIndex();
|
||||
}
|
||||
|
||||
class _DetailsIndex extends State<DetailsIndex> {
|
||||
|
||||
List<String> imagePaths = [];
|
||||
AgentInfo Res;
|
||||
FreeUseEntity freeUseStatus;
|
||||
String title = "";
|
||||
bool LikeStatus = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
checkIdStatus();
|
||||
Core.freeUse(context, () {
|
||||
GetInfoData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<AgentInfo> GetInfoData() async {
|
||||
Res = await HomeService.GetInfoData(params: { 'id': widget.id });
|
||||
setState(() {
|
||||
imagePaths = Res.imgs;
|
||||
title = Res.title;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// 检查写真是否被收藏
|
||||
Future<bool> checkIdStatus () async {
|
||||
var status = await LikeService.find(int.parse(widget.id));
|
||||
setState(() {
|
||||
LikeStatus = status;
|
||||
});
|
||||
}
|
||||
|
||||
/// 检查是否被收藏,爱心的改变样式
|
||||
Widget LikeStatusWidget () {
|
||||
return
|
||||
LikeStatus
|
||||
? IconButton(icon: Icon(Icons.favorite, color: ColorConfig.WhiteBackColor,),iconSize: 24,)
|
||||
: IconButton(
|
||||
iconSize: 24,
|
||||
icon: LikeStatus ? Icon(Icons.favorite_border) : Icon(Icons.favorite_border),
|
||||
onPressed: () async {
|
||||
if (imagePaths.isNotEmpty) {
|
||||
if (Core.isVip(context)) {
|
||||
var User = LikeEntity(
|
||||
id: int.parse(widget.id),
|
||||
preview: imagePaths[0],
|
||||
source: Res.jigoulist[0].name,
|
||||
title: Res.title,
|
||||
totals: Res.shuliang,
|
||||
user: Res.renwulist[0].name
|
||||
);
|
||||
|
||||
int result = await LikeService.addLike(User);
|
||||
if (result > 0) {
|
||||
Toast.show("写真收藏成功!", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
setState(() => LikeStatus = true);
|
||||
} else {
|
||||
Toast.show("写真收藏失败: ${result}", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
}
|
||||
} else {
|
||||
Toast.show("您还未开通VIP,无法使用【收藏图片】【收藏写真】【保存到相册】【成人视频】等功能", context, duration: Toast.LENGTH_LONG, gravity: Toast.CENTER);
|
||||
}
|
||||
} else {
|
||||
Toast.show("请稍后收藏,数据正在加载中...", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 长按的弹出框
|
||||
actionDiaLog (String url) async {
|
||||
if (Core.isVip(context)) {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SimpleDialog(
|
||||
titlePadding: EdgeInsets.all(15),
|
||||
contentPadding: EdgeInsets.all(15),
|
||||
title: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.touch_app,size: 30,color: ColorConfig.ThemeColor,),
|
||||
SizedBox(width: 5,),
|
||||
Text("请选择操作",style: TextStyle(fontSize: 17),)
|
||||
],
|
||||
),
|
||||
),
|
||||
children: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("保存到相册"),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
saveGallery(url);
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("收藏此图片"),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
singleLike(url);
|
||||
}
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Toast.show("您还未开通VIP,无法使用【收藏图片】【收藏写真】【保存到相册】【成人视频】等功能", context, duration: Toast.LENGTH_LONG, gravity: Toast.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
/// 保存图片到相册
|
||||
saveGallery(String url) async {
|
||||
// var path = await ImagePickers.saveImageToGallery(url);
|
||||
// path.length != 0
|
||||
// ? Toast.show("图片存储在 ${path}", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM)
|
||||
// : Toast.show("保存失败", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
|
||||
var response = await DownloadService.downImage(url: url);
|
||||
String fileName = Tool.randomBit();
|
||||
final result = await ImageGallerySaver.saveImage(
|
||||
Uint8List.fromList(response),
|
||||
quality: 100,
|
||||
name: fileName
|
||||
);
|
||||
result['isSuccess']
|
||||
? Toast.show("图片存储在 ${result['filePath']}", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM)
|
||||
: Toast.show("保存失败", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
}
|
||||
|
||||
/// 分享给好友
|
||||
shareImg() async {
|
||||
ShareExtend.share(
|
||||
"[有人@你]\n高清模特写真你要不要??\n\n写真集名称:${Res.title}\n\n写真访问地址:${Config.h5IpUrl}info.html?id=${Res.id}\n\n浏览更多高清模特写真请下载应用:【屁桃儿】",
|
||||
"text",
|
||||
sharePanelTitle: "111",
|
||||
);
|
||||
}
|
||||
|
||||
/// 单张图的收藏功能
|
||||
singleLike(String url) async {
|
||||
// false 可以收藏,true 收藏过了
|
||||
bool status = await LikeService.checkIsLike(url);
|
||||
print("status statusstatusstatusstatus : ${status}");
|
||||
if (status) {
|
||||
Toast.show("此图片已经收藏过啦!!", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
} else {
|
||||
var add = SingleGraphEntity(
|
||||
id: int.parse(widget.id) + int.parse(Tool.randomBit()),
|
||||
src: url
|
||||
);
|
||||
int result = await LikeService.addImg(add);
|
||||
if (result > 0) {
|
||||
Toast.show("图片收藏成功!", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
} else {
|
||||
Toast.show("图片收藏失败!", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
LikeStatusWidget(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.share_outlined,color: ColorConfig.WhiteBackColor,),iconSize: 24,
|
||||
onPressed: () {
|
||||
shareImg();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
body: imagePaths.isEmpty
|
||||
? SpinKitWave(color: ColorConfig.ThemeColor, itemCount: 3, size: 40)
|
||||
: ListView.builder(
|
||||
itemCount: imagePaths.length,
|
||||
cacheExtent: double.maxFinite,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onLongPress: () => actionDiaLog(imagePaths[index]),
|
||||
onTap: () async {
|
||||
ImagePickers.previewImages(imagePaths,index);
|
||||
// Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
|
||||
// return PhotoViewGalleryScreen(
|
||||
// images: imagePaths,
|
||||
// index: index,
|
||||
// title: Res.title,
|
||||
// time: Res.shijian,
|
||||
// heroTag: index.toString(),
|
||||
// );
|
||||
// }));
|
||||
},
|
||||
child: CachedNetworkImg(imagePaths[index]),
|
||||
);
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
1
untitled/lib/views/Home/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
0c5d82c8-0a08-4f49-94e2-57df03cd7df2
|
||||
83
untitled/lib/views/Home/ClassList.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
|
||||
/*
|
||||
* 横向菜单除首页外的布局
|
||||
*/
|
||||
class ClassList extends StatefulWidget {
|
||||
int id;
|
||||
int totalPage = 0;
|
||||
List<ItemList> result = [];
|
||||
|
||||
EasyRefreshController _controller; // EasyRefresh控制器
|
||||
|
||||
ClassList({Key key, @required this.id }) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ClassList();
|
||||
}
|
||||
|
||||
class _ClassList extends State<ClassList> with AutomaticKeepAliveClientMixin {
|
||||
|
||||
int page = 1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget._controller = EasyRefreshController();
|
||||
new Future.delayed(Duration(milliseconds: 500), () async {
|
||||
getClassListData();
|
||||
});
|
||||
}
|
||||
|
||||
/// 请求数据,类型是根据ajax生成的数据实体类
|
||||
Future<AgentClassListData> getClassListData() async {
|
||||
AgentClassListData res = await HomeService.GetClassListData(params: {
|
||||
'id': widget.id,
|
||||
'page': page
|
||||
});
|
||||
setState(() {
|
||||
widget.result.addAll(res.list);
|
||||
widget.totalPage = int.parse(res.total);
|
||||
page = int.parse(res.page);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return EasyRefresh(
|
||||
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
|
||||
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
|
||||
onRefresh: () async {
|
||||
// widget.page = 0;
|
||||
// widget.result = [];
|
||||
// await getClassListData();
|
||||
},
|
||||
onLoad: () async {
|
||||
page += 1;
|
||||
if (page > widget.totalPage) {
|
||||
Toast.show("没有数据", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
} else {
|
||||
await getClassListData();
|
||||
widget._controller.finishRefresh();
|
||||
}
|
||||
},
|
||||
child: ItemWidget(
|
||||
data: widget.result,
|
||||
title: '',
|
||||
longPress: () {}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
66
untitled/lib/views/Home/Default.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
|
||||
/*
|
||||
* 首页的布局
|
||||
*/
|
||||
class DefaultLayout extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Default();
|
||||
|
||||
}
|
||||
|
||||
class _Default extends State<DefaultLayout> with AutomaticKeepAliveClientMixin<DefaultLayout> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
/// 请求数据,被异步数据组件 FutureBuilder 调用
|
||||
Future<Result> GetHomeData() async {
|
||||
return await HomeService.GetHomeData(params: {});
|
||||
}
|
||||
|
||||
/// 首页的列表
|
||||
Widget DeaultPageList(Result result) {
|
||||
var Models = Tool.splitList(result.model.res, 4);
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: Screen.setHeight(18),),
|
||||
// SwiperWidget(
|
||||
// autoplayDelay: 4000,
|
||||
// autoplay: false,
|
||||
// child: [
|
||||
// ModelWidget(data: Models[0]),
|
||||
// ModelWidget(data: Models[1]),
|
||||
// ]
|
||||
// ),
|
||||
OldItemWidget(icon: Icons.new_releases_sharp, title: '最新收录', data: result.newest.data),
|
||||
OldItemWidget(icon: Icons.thumb_up_alt,title: '推荐写真', data: result.recommended.data,)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return FutureBuilderWidget<Result>(
|
||||
future: GetHomeData,
|
||||
success: DeaultPageList,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
}
|
||||
167
untitled/lib/views/Home/Edit.dart
Normal file
@@ -0,0 +1,167 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/event/_.dart';
|
||||
|
||||
/*
|
||||
* 菜单编辑页面
|
||||
*/
|
||||
class Edit extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Edit();
|
||||
}
|
||||
|
||||
class _Edit extends State<Edit> {
|
||||
|
||||
// 已选菜单
|
||||
List<Principal> principal = [];
|
||||
// 未选菜单
|
||||
List<Principal> additional = [];
|
||||
bool isEdit = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
GetList();
|
||||
}
|
||||
|
||||
void GetList () {
|
||||
new Future.delayed(Duration(milliseconds: 280),() async {
|
||||
var a = await ClassService.findAll("Principal");
|
||||
var b = await ClassService.findAll("Additional");
|
||||
|
||||
setState(() {
|
||||
principal = a.map((e) => Principal.fromJson(e) ).toList();
|
||||
additional = b.map((e)=> Principal.fromJson(e)).toList();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 已选菜单 被点击的时候
|
||||
principalClick(Principal item) {
|
||||
// 删除原本的数据
|
||||
principal = principal.where((v) => v.id != item.id).toList();
|
||||
|
||||
var isHave = additional.where((v) => v.id == item.id).toList();
|
||||
if (isHave.length == 0) {
|
||||
// 向 未选菜单 添加数据
|
||||
additional.addAll([item]);
|
||||
ClassService.add(tableName: 'Additional', item: item);
|
||||
}
|
||||
|
||||
isEdit = true;
|
||||
setState(() {});
|
||||
ClassService.delete(tableName: 'Principal', item: item);
|
||||
}
|
||||
|
||||
// 未选菜单 被点击的时候
|
||||
additionalClick(Principal item) {
|
||||
// 删除原本的数据
|
||||
additional = additional.where((v) => v.id != item.id).toList();
|
||||
// 向 已选菜单 添加数据
|
||||
principal.addAll([item]);
|
||||
isEdit = true;
|
||||
setState(() {});
|
||||
ClassService.delete(tableName: 'Additional', item: item);
|
||||
ClassService.add(tableName: 'Principal', item: item);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("分类编辑"),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
Config.eventBus.fire(ClassEditEvent(isEdit));
|
||||
Modular.to.pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.only(top: 15,right: 15,bottom: 0,left: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 20),
|
||||
padding: EdgeInsets.all(8),
|
||||
color: Color(0XFFe1e1e3),
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("注意",style: TextStyle(fontSize: 16,fontWeight: FontWeight.w500),),
|
||||
SizedBox(height: Screen.setHeight(10),),
|
||||
Text("1:如果编辑了分类,首页之前的浏览进度将丢失。",style: TextStyle(),),
|
||||
SizedBox(height: Screen.setHeight(5),),
|
||||
Text("2:如果没有编辑分类,那么返回首页,之前的浏览进度都还会在。",style: TextStyle(),),
|
||||
SizedBox(height: Screen.setHeight(5),),
|
||||
Text("3:如果你删除【已选菜单】的所有分类,那么将默认从服务器请求最新菜单",style: TextStyle(),),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("已选菜单",style: TextStyle(fontSize: Screen.setFontSize(16),fontWeight: FontWeight.w400),),
|
||||
SizedBox(height: Screen.setHeight(5),),
|
||||
Wrap(
|
||||
spacing: Screen.setFontSize(13),
|
||||
children: principal.map((e) => RawChip(
|
||||
label: Text(e.title,style: TextStyle(fontSize: 12,color: ColorConfig.WhiteBackColor)),
|
||||
padding: EdgeInsets.all(1),
|
||||
backgroundColor: ColorConfig.ThemeOtherColor,
|
||||
selectedColor: ColorConfig.ThemeColor,
|
||||
checkmarkColor: Colors.white,
|
||||
onPressed: () {
|
||||
principalClick(e);
|
||||
},
|
||||
)).toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: Screen.setFontSize(20)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("未选菜单",style: TextStyle(fontSize: Screen.setFontSize(16),fontWeight: FontWeight.w400),),
|
||||
SizedBox(height: Screen.setHeight(5),),
|
||||
Wrap(
|
||||
spacing: Screen.setFontSize(18),
|
||||
children: additional.map((e) => RawChip(
|
||||
label: Text(e.title,style: TextStyle(fontSize: Screen.setFontSize(12),color: ColorConfig.WhiteBackColor)),
|
||||
padding: EdgeInsets.all(1),
|
||||
backgroundColor: ColorConfig.ThemeOtherColor,
|
||||
selectedColor: ColorConfig.ThemeColor,
|
||||
checkmarkColor: Colors.white,
|
||||
onPressed: () {
|
||||
additionalClick(e);
|
||||
},
|
||||
)).toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
onWillPop: () async {
|
||||
Config.eventBus.fire(ClassEditEvent(isEdit));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
189
untitled/lib/views/Home/Home.dart
Normal file
@@ -0,0 +1,189 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/event/_.dart';
|
||||
import 'package:peach/views/Home/Default.dart';
|
||||
import 'package:peach/views/Home/ClassList.dart';
|
||||
import 'package:peach/views/Home/Random.dart';
|
||||
|
||||
/*
|
||||
* 首页
|
||||
*/
|
||||
class Home extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Home();
|
||||
}
|
||||
|
||||
class _Home extends State<Home> with AutomaticKeepAliveClientMixin<Home> {
|
||||
|
||||
/// 保存横向菜单的数据
|
||||
ClassResult Tabs = ClassResult.fromJson({
|
||||
'principal': [], 'additional': []
|
||||
});
|
||||
|
||||
int _currentIndex = 0;
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
TabController _tabController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
/// 请求权限
|
||||
AuthorityApplication.init(context);
|
||||
_GetClassData();
|
||||
_EditOnListen();
|
||||
}
|
||||
|
||||
void _EditOnListen () {
|
||||
Config.eventBus.on<ClassEditEvent>().listen((event){
|
||||
print("事件监听 ClassEditEvent ============== :${event.update}");
|
||||
if (event.update) {
|
||||
print("true");
|
||||
_currentIndex = 0;
|
||||
Tabs = ClassResult.fromJson({ 'principal': [], 'additional': [] });
|
||||
_GetClassData();
|
||||
} else {
|
||||
print("false");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _GetClassData() async {
|
||||
if (Tabs.principal.length == 0) {
|
||||
Tabs = await HomeService.GetClassData(params: {});
|
||||
// 插入首页
|
||||
Tabs.principal.insert(0, Principal.fromJson({ 'id': 0, 'title': '随机展示','page': 0, }));
|
||||
Tabs.principal.insert(0, Principal.fromJson({ 'id': 1, 'title': '首页','page': 0,}));
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
/// 横向滑动分类菜单边上的右侧编辑按钮
|
||||
Widget RightEdit() {
|
||||
return Container(
|
||||
width: Screen.setWidth(50),
|
||||
child: IconButton(
|
||||
iconSize: Screen.setFontSize(20.0),
|
||||
icon: const Icon(Icons.edit, color: ColorConfig.NoActiveColor,),
|
||||
onPressed: () {
|
||||
Modular.to.pushNamed('/edit');
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 横向滑动分类菜单
|
||||
Widget MenuList() {
|
||||
return Expanded(
|
||||
child: TabBar(
|
||||
isScrollable: true,
|
||||
unselectedLabelColor: ColorConfig.NoActiveColor,
|
||||
indicatorColor: ColorConfig.ThemeColor,
|
||||
tabs: Tabs.principal.map((e) => Tab(text: e.title,)).toList(),
|
||||
onTap: (int index) {
|
||||
print("你点击的下标为 ============== :$index");
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 左侧Logo按钮
|
||||
Widget Leading () {
|
||||
return Builder(
|
||||
builder: (BuildContext context) {
|
||||
return IconButton(
|
||||
icon: IconFont.LogoIcon(),
|
||||
onPressed: () {
|
||||
|
||||
}
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 标题的容器
|
||||
Widget TitleWidget() {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/search");
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.setHeight(30.0),
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.search, color: Color(0XFF999999), size: 14),
|
||||
SizedBox(width: Screen.setWidth(2.0)),
|
||||
Text("198万张图,有你想要的...", style: TextStyle(color: Color(0xFf999999), fontSize: Screen.setFontSize(13)))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 返回不同的布局
|
||||
List<Widget> TabView() {
|
||||
return Tabs.principal.map((e) =>
|
||||
e.id == 1
|
||||
? DefaultLayout()
|
||||
: e.id == 0 ? Random() : ClassList(id: e.id,key: GlobalKey(),)
|
||||
).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return DefaultTabController(
|
||||
key: GlobalKey(),
|
||||
length: Tabs.principal.length != 0 ? Tabs.principal.length : 0,
|
||||
initialIndex: _currentIndex,
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(90.0),
|
||||
child: AppBar(
|
||||
primary: true,
|
||||
titleSpacing: 0.0,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
leading: Leading(),
|
||||
title: TitleWidget(),
|
||||
elevation: 0,
|
||||
actions: [
|
||||
IconButton(
|
||||
iconSize: 24,
|
||||
icon: Icon(Icons.supervisor_account),
|
||||
onPressed: () {
|
||||
Config.tabController.jumpToPage(3);
|
||||
},
|
||||
)
|
||||
],
|
||||
bottom: PreferredSize(
|
||||
preferredSize: Size.fromHeight(40.0),
|
||||
child: Row(
|
||||
children: [
|
||||
MenuList(),
|
||||
RightEdit()
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: TabView()
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
74
untitled/lib/views/Home/Random.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
|
||||
/*
|
||||
* 随机展示
|
||||
*/
|
||||
class Random extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Random();
|
||||
}
|
||||
|
||||
class _Random extends State<Random> with AutomaticKeepAliveClientMixin{
|
||||
|
||||
AgentClassListData result;
|
||||
List<ItemList> list = [];
|
||||
EasyRefreshController _controller; // EasyRefresh控制器
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
random();
|
||||
}
|
||||
|
||||
Future<AgentClassListData> random() async {
|
||||
result = await HomeService.GetAgentRandom(params: {});
|
||||
setState(() {
|
||||
list.addAll(result.list);
|
||||
});
|
||||
}
|
||||
|
||||
void Refresh() {
|
||||
list = [];
|
||||
setState(() {});
|
||||
random();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
body: EasyRefresh(
|
||||
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
|
||||
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
|
||||
onRefresh: () async {
|
||||
Refresh();
|
||||
},
|
||||
onLoad: () async {
|
||||
random();
|
||||
},
|
||||
child: ItemWidget(
|
||||
data: list,
|
||||
title: '',
|
||||
longPress: () {}
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
child: Icon(Icons.refresh,color: ColorConfig.WhiteBackColor,),
|
||||
onPressed: () {
|
||||
Refresh();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
150
untitled/lib/views/Home/Search.dart
Normal file
@@ -0,0 +1,150 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class Search extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Search();
|
||||
}
|
||||
|
||||
class _Search extends State<Search> {
|
||||
|
||||
// 搜索框控制器
|
||||
TextEditingController _controller = TextEditingController();
|
||||
FocusNode _userFocusNode = FocusNode();
|
||||
|
||||
// 搜索建议
|
||||
List<String> proposalList = [
|
||||
'JK制服','医生','豹纹','清纯','空姐','大胸','黑丝','美腿','主播','香车','教室','学生装','老师', '风骚','蜜桃社','秀人网'
|
||||
];
|
||||
|
||||
List<ItemList> result = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller.addListener(() {});
|
||||
// 监听输入框是否获得焦点,动态返回页面
|
||||
_userFocusNode.addListener(() {
|
||||
SearchProposal();
|
||||
setState(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
// 顶部搜索输入框
|
||||
Widget SearchItem () {
|
||||
return Container(
|
||||
height: Screen.setHeight(30.0),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
focusNode: _userFocusNode,
|
||||
autofocus: true,
|
||||
showCursor: true,
|
||||
cursorWidth: 2,
|
||||
style: TextStyle(fontSize: 14),
|
||||
cursorRadius: Radius.circular(10),
|
||||
cursorColor: ColorConfig.ThemeColor,
|
||||
textInputAction: TextInputAction.search,
|
||||
onSubmitted: (String val) {
|
||||
GetSearchData();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.only(left: 15),
|
||||
hintText: '输入搜索关键字',
|
||||
hintStyle: TextStyle(color: ColorConfig.NoActiveColor,fontSize: 14),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 顶部右侧的搜索按钮
|
||||
Widget SearchButton() {
|
||||
return IconButton(
|
||||
icon: Icon(Icons.search, color: ColorConfig.WhiteBackColor,),
|
||||
onPressed: () {
|
||||
GetSearchData();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 如果输入框获得了焦点,那么返回搜索建议,否则返回搜索列表
|
||||
Widget SearchProposal() {
|
||||
if (_userFocusNode.hasFocus) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("搜索建议",style: TextStyle(fontWeight: FontWeight.w500,fontSize: Screen.setFontSize(15)),),
|
||||
SizedBox(height: Screen.setHeight(10),),
|
||||
Wrap(
|
||||
children: proposalList.map((e) => InkWell(
|
||||
onTap: () {
|
||||
_controller.text = e;
|
||||
GetSearchData();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: Screen.setFontSize(5),right: Screen.setFontSize(5)),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.ThemeColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
||||
),
|
||||
padding: EdgeInsets.only(left: Screen.setFontSize(8),right: Screen.setFontSize(8),bottom: Screen.setFontSize(3),top: Screen.setFontSize(2)),
|
||||
child: Text(e, style: TextStyle(color: ColorConfig.WhiteBackColor,fontSize: Screen.setFontSize(12)),),
|
||||
),
|
||||
)).toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}else{
|
||||
return ItemWidget(
|
||||
data: result,
|
||||
title: '',
|
||||
longPress: () {}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果输入框不为空,那么输入框失去焦点并关闭键盘展示搜索列表页面
|
||||
GetSearchData() async {
|
||||
if (_controller.text.length != 0) {
|
||||
_userFocusNode.unfocus();
|
||||
List<ItemList> res = await HomeService.GetSearchData(params: { "keyword": _controller.text });
|
||||
setState(() => result = res);
|
||||
} else {
|
||||
FocusScope.of(context).requestFocus(_userFocusNode);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0.0,
|
||||
title: SearchItem(),
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
actions: [ SearchButton() ],
|
||||
),
|
||||
body: SearchProposal(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
_userFocusNode.dispose();
|
||||
}
|
||||
}
|
||||
1
untitled/lib/views/Me/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
44fb7f85-0472-4263-8b56-e19b0e817612
|
||||
82
untitled/lib/views/Me/About.dart
Normal file
@@ -0,0 +1,82 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class About extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("关于我们"),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 110),
|
||||
padding: EdgeInsets.all(15),
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
R.libStaticImgLogoPng,
|
||||
width: Screen.setWidth(70),
|
||||
height: Screen.setWidth(70),
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
Text(Config.appName, style: TextStyle(fontSize: 17,fontWeight: FontWeight.w400),),
|
||||
SizedBox(height: 6,),
|
||||
Text("十分专业的模特写真App,倾心为您提供国内外共计约198万张的写真图,满足您各种的口味和喜好是我们最初衷的动力!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),textAlign: TextAlign.center),
|
||||
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 30),
|
||||
// child: ButtonBar(
|
||||
// alignment: MainAxisAlignment.center,
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// MaterialButton(
|
||||
// color: ColorConfig.ThemeColor,
|
||||
// textColor: Colors.white,
|
||||
// onPressed: () async {
|
||||
// await launch("tel:15155145354");
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Icon(Icons.phone_callback,size: 14,),
|
||||
// SizedBox(width: 2,),
|
||||
// Text("电话联系",style: TextStyle(fontSize: 16))
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(width: 10,),
|
||||
// MaterialButton(
|
||||
// color: ColorConfig.ThemeColor,
|
||||
// textColor: Colors.white,
|
||||
// onPressed: () async {
|
||||
// await launch("sms:15155145354");
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Icon(Icons.sms_outlined,size: 14,),
|
||||
// SizedBox(width: 2,),
|
||||
// Text("短信联系",style: TextStyle(fontSize: 16))
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
22
untitled/lib/views/Me/Agent.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
class Agent extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State createState() => _Agent();
|
||||
}
|
||||
|
||||
class _Agent extends State<Agent> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
title: Text("代理操作教程"),
|
||||
),
|
||||
body: Text("代理操作教程"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
58
untitled/lib/views/Me/Agreement.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
class Agreement extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("用户协议"),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("用户须知",style: TextStyle(fontSize: 17,fontWeight: FontWeight.w700),),
|
||||
SizedBox(height: 15,),
|
||||
Text("1:图片和视频都来源于互联网,如果存在版权问题和纠纷,请通过邮箱(codehelp123456@protonmail.com)联系,我们也会停止相应资源的展示下载等一切行为!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
Text("2:使用过程有任何的问题可以及时给予我们反馈。",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
Text("3:本App内部分的内容少儿不宜,如果您未满18岁,请立即停止使用!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
Text("4:如果您想成为代理赚取更多的收益,请加客服微信获取代理码,即可成为代理",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
|
||||
SizedBox(height: 15,),
|
||||
Text("产品特点",style: TextStyle(fontSize: 17,fontWeight: FontWeight.w700),),
|
||||
SizedBox(height: 15,),
|
||||
Text("1:海量的超高清图集,图片画质超清晰、全部超大尺寸或原尺寸的图片。目前已经收录35804套图集,共计:197.4394万张高清图片,每周新增约100套+图集!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
Text("2:在线浏览超高品质的图集,超一流的用户体验!一个帐号,电脑、手机、平板任性浏览!还可以收藏自己喜欢的图集,方便下次仔细欣赏。当然您也可以一键下载图集!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
Text("3:全网最专业的图集收集整理网站!中国的、日韩的、欧美的、泰国的,应有尽有。全部都是我们精心整理的,按人物、机构、标签的精准确分类!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
Text("4:特意开发的巧遇功能,随机从我们精心筛选的数千套图集里推送给你直接浏览体验。最贴心、好用、好看的功能!!",
|
||||
style: TextStyle(fontSize: 15,color: ColorConfig.TextColor),),
|
||||
SizedBox(height: 10,),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
223
untitled/lib/views/Me/Like.dart
Normal file
@@ -0,0 +1,223 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
|
||||
class Like extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Like();
|
||||
}
|
||||
|
||||
class _Like extends State<Like> {
|
||||
|
||||
List<LikeEntity> LikeList = [];
|
||||
String initialValue = "default";
|
||||
final SlidableController slidableController = SlidableController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getLikeList();
|
||||
}
|
||||
|
||||
/// TODO 解决思路,再存数据的时候使用 HomeEntityData
|
||||
void getLikeList() async {
|
||||
var likeData = await LikeService.findAll();
|
||||
setState(() => LikeList = likeData);
|
||||
}
|
||||
|
||||
Future<void> deleteAlertDialog(int id) async {
|
||||
await Core.deleteDialog(context, () async {
|
||||
await LikeService.delete(id);
|
||||
getLikeList();
|
||||
});
|
||||
}
|
||||
|
||||
Widget UseLayout() {
|
||||
if (LikeList.isNotEmpty) {
|
||||
switch(initialValue) {
|
||||
case 'default':
|
||||
return OldItemWidget(
|
||||
data: LikeList,
|
||||
longPress: (int id) {
|
||||
deleteAlertDialog(id);
|
||||
},
|
||||
);
|
||||
break;
|
||||
case 'column':
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 10,right: 10, top: 5),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: LikeList.length,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (BuildContext contenx,int index) {
|
||||
return Slidable(
|
||||
key: Key(index.toString()),
|
||||
controller: slidableController,
|
||||
actionPane: SlidableDrawerActionPane(),
|
||||
actionExtentRatio: 0.25,
|
||||
child: InkWell(
|
||||
onLongPress: () => deleteAlertDialog(LikeList[index].id),
|
||||
onTap: () => Modular.to.pushNamed("/details/${LikeList[index].id}"),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.network(
|
||||
LikeList[index].preview,
|
||||
width: Screen.setWidth(120),
|
||||
height: Screen.setHeight(80),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 5,),
|
||||
Text(LikeList[index].title, style: TextStyle(color: ColorConfig.TitleColor,fontSize: 15),),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Wrap(
|
||||
children: [
|
||||
Container(margin: EdgeInsets.only(right: 5),child: Text("模特:${LikeList[index].user}",style: TextStyle(color: ColorConfig.TextColor,fontSize: 13)),),
|
||||
Container(margin: EdgeInsets.only(right: 5),child: Text("来源:${LikeList[index].source}",style: TextStyle(color: ColorConfig.TextColor,fontSize: 13)),),
|
||||
Container(margin: EdgeInsets.only(right: 5),child: Text("图片:${LikeList[index].totals}P",style: TextStyle(color: ColorConfig.TextColor,fontSize: 13)),),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
secondaryActions: [//右侧按钮列表
|
||||
IconSlideAction(
|
||||
caption: '删除',
|
||||
color: ColorConfig.ThemeColor,
|
||||
foregroundColor: ColorConfig.WhiteBackColor,
|
||||
icon: Icons.delete,
|
||||
closeOnTap: false,
|
||||
onTap: () {
|
||||
Slidable.of(context)?.close();
|
||||
deleteAlertDialog(LikeList[index].id);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
break;
|
||||
case 'big':
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: LikeList.length,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (BuildContext contenx,int index) {
|
||||
return InkWell(
|
||||
onLongPress: () => deleteAlertDialog(LikeList[index].id),
|
||||
onTap: () => Modular.to.pushNamed("/details/${LikeList[index].id}"),
|
||||
child: Column(
|
||||
children: [
|
||||
Image.network(
|
||||
LikeList[index].preview,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
return Container(
|
||||
height: Screen.setHeight(300),
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline_outlined,size: 50,color: ColorConfig.ThemeColor,),
|
||||
SizedBox(height: 10,),
|
||||
Text("暂无收藏", style: TextStyle(color: ColorConfig.TextColor))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
title: Text("我的收藏"),
|
||||
actions: [
|
||||
Row(
|
||||
children: [
|
||||
Text(initialValue == "default" ? '默认布局' : initialValue == "column" ? "多列布局" : "大图布局"),
|
||||
new PopupMenuButton(
|
||||
initialValue: initialValue,
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
PopupMenuItem(
|
||||
value: 'default',
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
new Icon(Icons.grid_view, color: ColorConfig.ThemeColor),
|
||||
new Text("默认布局"),
|
||||
],
|
||||
)
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'column',
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
new Icon(Icons.table_rows_outlined, color: ColorConfig.ThemeColor),
|
||||
new Text("多列布局"),
|
||||
],
|
||||
)
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'big',
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
new Icon(Icons.image_outlined, color: ColorConfig.ThemeColor),
|
||||
new Text("大图模式"),
|
||||
],
|
||||
)
|
||||
)
|
||||
],
|
||||
onSelected: (String action) {
|
||||
print("action ===== ${action}");
|
||||
setState(() {
|
||||
initialValue = action;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: UseLayout(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
324
untitled/lib/views/Me/Me.dart
Normal file
@@ -0,0 +1,324 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:share_extend/share_extend.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class Me extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Me();
|
||||
}
|
||||
|
||||
class _Me extends State<Me> {
|
||||
String cacheSize = "0.00B";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
ComputeCache();
|
||||
}
|
||||
|
||||
Future<void> ComputeCache() async {
|
||||
String size = await ClearCache.loadCache();
|
||||
setState(() {
|
||||
cacheSize = size;
|
||||
});
|
||||
}
|
||||
|
||||
/// 分享给好友
|
||||
shareText() async {
|
||||
ShareExtend.share(
|
||||
"[有人@你]\n您的朋友给你分享了一个成人写真App。\n点击查看:${Config.shareIpUrl}?objectId=${Tool.userInfo()['objectId']}",
|
||||
"text",
|
||||
sharePanelTitle: "111",
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 0,
|
||||
elevation: 0.0,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: [
|
||||
Positioned(
|
||||
width: Screen.width(context),
|
||||
left: 0,
|
||||
top: 0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: Screen.setHeight(40)),
|
||||
alignment: Alignment.topCenter,
|
||||
height: Screen.setHeight(150),
|
||||
color: ColorConfig.ThemeColor,
|
||||
child: Tool.userInfo()['userType'] == "0"
|
||||
? Text("我 的", style: TextStyle(fontSize: Screen.setFontSize(18),color: ColorConfig.WhiteBackColor),)
|
||||
: Text("欢 迎 代 理", style: TextStyle(fontSize: Screen.setFontSize(18),color: ColorConfig.WhiteBackColor),),
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
width: Screen.width(context) / 1.1,
|
||||
top: Screen.setHeight(80),
|
||||
child: Container(
|
||||
height: Tool.userInfo()['userType'] == "1" ? Screen.setHeight(100) : Screen.setHeight(80),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
offset: Offset(1.0, 10.0), //阴影xy轴偏移量
|
||||
blurRadius: 15.0, //阴影模糊程度
|
||||
spreadRadius: 1.0 //阴影扩散程度
|
||||
)
|
||||
]),
|
||||
padding: EdgeInsets.only(left: Screen.setFontSize(15), right: Screen.setFontSize(15),top: Screen.setFontSize(10)),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
ClipOval(
|
||||
child: Image.asset(
|
||||
R.libStaticImgLogoPng,
|
||||
width: Screen.setWidth(60),
|
||||
height: Screen.setWidth(60),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(width: Screen.setWidth(10),),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(Tool.userInfo()['username'],style: TextStyle(fontSize: Screen.setFontSize(18),color: ColorConfig.TitleColor),),
|
||||
Text("注册时间: ${Tool.userInfo()['createdAt']}",style: TextStyle(fontSize: Screen.setFontSize(12),color: ColorConfig.NoActiveColor),),
|
||||
],
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
Tool.userInfo()['userType'] == "1"
|
||||
? Column(
|
||||
children: [
|
||||
CellWidget(
|
||||
leftIcon: IconFont.DaLiIcon(),
|
||||
leftText: Text("代理操作教程", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text("必看!",style: TextStyle(fontSize: Screen.setFontSize(12),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/agent');
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: Tool.userInfo()['userType'] == "1" ? Screen.setHeight(180) : Screen.setHeight(160),
|
||||
bottom: 0,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 15,
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.VipIcon(),
|
||||
leftText: Text("办理会员", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/vip');
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.BuyIcon(),
|
||||
leftText: Text("会员状态", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/status');
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 10,
|
||||
color: ColorConfig.LineColor,
|
||||
),
|
||||
|
||||
// CellWidget(
|
||||
// leftIcon: IconFont.VideoIcon(),
|
||||
// leftText: Text("成人视频", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
// onTap: () {
|
||||
// Modular.to.pushNamed('/video');
|
||||
// },
|
||||
// ),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.VideoIcon(),
|
||||
leftText: Text("快手视频", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/video');
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.NewsIcon(),
|
||||
leftText: Text("最新写真", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/recently');
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 10,
|
||||
color: ColorConfig.LineColor,
|
||||
),
|
||||
|
||||
CellWidget(
|
||||
leftIcon: IconFont.PictureIcon(),
|
||||
leftText: Text("图片收藏", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/singlegraph');
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.ModelIcon(color: ColorConfig.TextColor,size: Screen.setFontSize(20)),
|
||||
leftText: Text("写真收藏", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/like');
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 10,
|
||||
color: ColorConfig.LineColor,
|
||||
),
|
||||
|
||||
CellWidget(
|
||||
leftIcon: IconFont.AboutIcon(),
|
||||
leftText: Text("关于我们", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/about');
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.XieYiIcon(),
|
||||
leftText: Text("用户协议", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
Modular.to.pushNamed('/agreement');
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.UpdateIcon(),
|
||||
leftText: Text("检测升级", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text("v"+Config.packageInfo.version,style: TextStyle(fontSize: Screen.setFontSize(12),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () async {
|
||||
bool status = await CheckUpdate().check(context);
|
||||
if (!status) {
|
||||
Toast.show("已是最新版", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
}
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.ClearIcon(),
|
||||
leftText: Text("清除缓存", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text(cacheSize,style: TextStyle(fontSize: Screen.setFontSize(12),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
title: Text("清除缓存"),
|
||||
content: Container(
|
||||
height: 110,
|
||||
child: Column(
|
||||
children: [
|
||||
Text("此操作将删除您的【分类菜单】【图片缓存】【收藏记录】等所有内容,请慎重考虑!!"),
|
||||
SizedBox(height: 10,),
|
||||
Text("清除成功后将强制关闭应用,请自行重启",style: TextStyle(color: ColorConfig.NoActiveColor,fontSize: 14))
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text('取消', style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("清除", style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
bool status = await ClearCache.clearCache();
|
||||
await ComputeCache();
|
||||
if (status) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 40,),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await SPreferences().setBool("isLogin", false);
|
||||
Modular.to.pushReplacementNamed('/login');
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: Screen.setFontSize(15),right: Screen.setFontSize(15)),
|
||||
height: Screen.setHeight(35),
|
||||
alignment: Alignment.center,
|
||||
width: Screen.width(context),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.ThemeColor,
|
||||
borderRadius: BorderRadius.circular(5)
|
||||
),
|
||||
child: Text(
|
||||
"退 出 登 录",
|
||||
style: TextStyle(
|
||||
color: ColorConfig.WhiteBackColor, fontSize: Screen.setFontSize(16)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: Screen.setHeight(40),),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
Tool.userInfo()['userType'] == "1" ? Positioned(
|
||||
right: 15,
|
||||
top: 10,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
shareText();
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text("分享赚钱", style: TextStyle(color: ColorConfig.WhiteBackColor,fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
) : Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
60
untitled/lib/views/Me/Recently.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class Recently extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Recently();
|
||||
}
|
||||
|
||||
class _Recently extends State<Recently> {
|
||||
|
||||
List<ItemList> result = [];
|
||||
int page = 1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
GetRecentlyData();
|
||||
}
|
||||
|
||||
|
||||
Future<AgentClassListData> GetRecentlyData() async {
|
||||
AgentClassListData res = await HomeService.GetRecently(params: { "page": page });
|
||||
print("========= ${res.total}");
|
||||
setState(() {
|
||||
result.addAll(res.list);
|
||||
page = int.parse(res.page);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("最近更新"),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: EasyRefresh(
|
||||
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
|
||||
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
|
||||
onRefresh: () async {
|
||||
print("刷新");
|
||||
},
|
||||
onLoad: () async {
|
||||
setState(() {
|
||||
page+=1;
|
||||
GetRecentlyData();
|
||||
});
|
||||
},
|
||||
child: ItemWidget(
|
||||
data: result,
|
||||
title: '',
|
||||
longPress: () {}
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
87
untitled/lib/views/Me/SingleGraph.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class SingleGraph extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _SingleGraph();
|
||||
}
|
||||
|
||||
class _SingleGraph extends State<SingleGraph> {
|
||||
|
||||
List<SingleGraphEntity> result = [];
|
||||
List<String> imgArr = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
singleImg();
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> singleImg () async {
|
||||
List<SingleGraphEntity> res = await LikeService.findAllImg();
|
||||
setState(() {
|
||||
result = res;
|
||||
res.forEach((v) {
|
||||
imgArr.add(v.src);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> deleteAlertDialog(String url) async {
|
||||
await Core.deleteDialog(context, () async {
|
||||
await LikeService.deleteImg(url);
|
||||
singleImg();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("单图收藏"),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
actions: [
|
||||
Container(
|
||||
alignment:Alignment.center,
|
||||
padding: EdgeInsets.only(right: 15),
|
||||
child: Text("共 ${result.length ?? 0} 张"),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: result.isNotEmpty ? ListView.builder(
|
||||
itemCount: result.length ?? 0,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onLongPress: () => deleteAlertDialog(result[index].src),
|
||||
onTap: () async {
|
||||
Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
|
||||
return PhotoViewGalleryScreen(
|
||||
images: imgArr,
|
||||
index: index,
|
||||
title: "",
|
||||
time: "",
|
||||
heroTag: index.toString(),
|
||||
);
|
||||
}));
|
||||
},
|
||||
child: CachedNetworkImg(result[index].src),
|
||||
);
|
||||
},
|
||||
) : Container(
|
||||
height: Screen.setHeight(300),
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline_outlined,size: 50,color: ColorConfig.ThemeColor,),
|
||||
SizedBox(height: 10,),
|
||||
Text("暂无收藏", style: TextStyle(color: ColorConfig.TextColor))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
untitled/lib/views/Me/Video/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
fc0c81c7-b1ce-4324-bfd3-3e74b84b3bc1
|
||||
100
untitled/lib/views/Me/Video/Video.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/views/Me/Video/player.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class Video extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Video();
|
||||
}
|
||||
|
||||
// 短视频模块
|
||||
class _Video extends State<Video> with AutomaticKeepAliveClientMixin<Video> {
|
||||
PageController pageController;
|
||||
|
||||
String pcursor = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
pageController = PageController(
|
||||
initialPage: Config.currentIndex, //默认在第几个
|
||||
viewportFraction: 1, // 占屏幕多少,1为占满整个屏幕
|
||||
keepPage: true
|
||||
);
|
||||
|
||||
GetAllVideoList();
|
||||
}
|
||||
|
||||
/// 获取视频列表数据
|
||||
Future<VideoListEntity> GetAllVideoList({ String type = "swiper" }) async {
|
||||
print("GetAllVideoList");
|
||||
|
||||
void getData () async {
|
||||
VideoListEntity result = await VideoService.GetVideoList(params: {
|
||||
"pcursor": pcursor
|
||||
});
|
||||
setState(() {
|
||||
Config.feeds.addAll(result.feeds);
|
||||
pcursor = result.pcursor;
|
||||
});
|
||||
|
||||
print("feeds.length ${Config.feeds.length}");
|
||||
}
|
||||
|
||||
if (type == "swiper") {
|
||||
print("swiper");
|
||||
if (Config.feeds.length == 0) {
|
||||
getData();
|
||||
}
|
||||
} else {
|
||||
print("more");
|
||||
getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: PageView(
|
||||
controller: pageController,
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
pageSnapping: true,
|
||||
onPageChanged: (int index) {
|
||||
setState(() {
|
||||
print("你切换了页面! ============== ${index}");
|
||||
setState(() {
|
||||
Config.currentIndex = index;
|
||||
if (Config.currentIndex >= Config.feeds.length -1) {
|
||||
print("重新请企业数据.....");
|
||||
GetAllVideoList(type: "more");
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
children: Config.feeds.map((e) {
|
||||
// print("e.photo.photoUrl ============ ${e.photo.photoUrl}");
|
||||
return Play(
|
||||
url: e.photo.photoUrl,
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
pageController.dispose();
|
||||
}
|
||||
}
|
||||
98
untitled/lib/views/Me/Video/player.dart
Normal file
@@ -0,0 +1,98 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
|
||||
class Play extends StatefulWidget {
|
||||
final String url;
|
||||
|
||||
const Play({
|
||||
this.url
|
||||
});
|
||||
|
||||
@override
|
||||
_Play createState() => _Play();
|
||||
}
|
||||
|
||||
class _Play extends State<Play> {
|
||||
|
||||
VideoPlayerController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// print("widget.url:${widget.url}");
|
||||
_controller = VideoPlayerController.network(
|
||||
widget.url,
|
||||
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
|
||||
);
|
||||
_controller.addListener(() {
|
||||
if(_controller.value.position == _controller.value.duration) {
|
||||
|
||||
}
|
||||
});
|
||||
_controller.initialize().then((_) => setState(() {}));
|
||||
_controller.setLooping(true);
|
||||
_controller.play();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: Colors.black,
|
||||
alignment: Alignment.center,
|
||||
height: double.infinity,
|
||||
child: _controller.value.isInitialized
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
print(_controller.value.aspectRatio);
|
||||
if (_controller.value.isPlaying) {
|
||||
_controller.pause();
|
||||
} else {
|
||||
_controller.play();
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Stack(
|
||||
overflow: Overflow.visible,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: _controller.value.aspectRatio,
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
VideoPlayer( _controller),
|
||||
VideoProgressIndicator(_controller, allowScrubbing: true, colors: VideoProgressColors(playedColor: ColorConfig.ThemeColor),),
|
||||
],
|
||||
),
|
||||
),
|
||||
!_controller.value.isPlaying ? Positioned(
|
||||
top: 0,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: InkWell(
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.play_arrow, size: 70, color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
) : Text(""),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: SpinKitWave(color: ColorConfig.ThemeColor, itemCount: 3, size: 40),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1
untitled/lib/views/Me/Vip/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
927290ec-0eef-493f-ba2a-445d720136b1
|
||||
124
untitled/lib/views/Me/Vip/BuyStatus.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class BuyStatus extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _BuyStatus();
|
||||
}
|
||||
|
||||
class _BuyStatus extends State<BuyStatus> {
|
||||
|
||||
List<Arr> orderList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getOrderList();
|
||||
}
|
||||
|
||||
Future<orderStatusEntity> getOrderList() async {
|
||||
orderStatusEntity res = await UserService.orderStatus(params: {
|
||||
"objectId": Tool.userInfo()['objectId']
|
||||
});
|
||||
print("============== ${res.code}");
|
||||
setState(() {
|
||||
orderList.addAll(res.arr);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("会员状态"),
|
||||
elevation: 0.0,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: orderList.length == 0 ? Container(
|
||||
child: Text("没有记录"),
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(top: 30),
|
||||
)
|
||||
: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.only(top: Screen.setHeight(50)),
|
||||
child: Column(
|
||||
children: [
|
||||
orderList[0].activateStatus == "0" ? Icon(Icons.query_builder, size: 60,color: ColorConfig.ThemeColor,) : Icon(Icons.check, size: 60,color: ColorConfig.ThemeColor,),
|
||||
orderList[0].activateStatus == "0" ? SizedBox(height: 8,) : Container(),
|
||||
Text(orderList[0].activateStatus == "0" ? "等待您转账来激活账户" : "激活成功,可正常使用", style: TextStyle(fontSize: Screen.setFontSize(16)),),
|
||||
SizedBox(height: 5,),
|
||||
orderList[0].activateStatus == "0"
|
||||
? Text("请加微信 ${orderList[0].superiorWeixin} 并转账,转账备注为订单号", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor),)
|
||||
: Text(""),
|
||||
SizedBox(height: 40,),
|
||||
|
||||
CellWidget(
|
||||
leftIcon: IconFont.OrderIcon(size: 22),
|
||||
leftText: Text("订单号", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightIcon: Text(""),
|
||||
rightText: Text("${orderList[0].orderNumber}(复制订单)",style: TextStyle(fontSize: Screen.setFontSize(13),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () {
|
||||
Core.copy(orderList[0].orderNumber);
|
||||
Toast.show("复制成功", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.WeiXinIcon(size: 22),
|
||||
leftText: Text("客服微信", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text("${orderList[0].superiorWeixin}(跳转微信)",style: TextStyle(fontSize: Screen.setFontSize(13),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
rightIcon: Text(""),
|
||||
onTap: () {
|
||||
Core.copy(orderList[0].superiorWeixin);
|
||||
Toast.show("复制成功", context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
launch("weixin://");
|
||||
},
|
||||
),
|
||||
|
||||
Container(
|
||||
height: 10,
|
||||
color: ColorConfig.LineColor,
|
||||
),
|
||||
|
||||
CellWidget(
|
||||
leftIcon: IconFont.VipIcon(),
|
||||
rightIcon: Text(""),
|
||||
leftText: Text("VIP类型", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text(Config.vipList[int.parse(orderList[0].vipLevel) - 1]['vipTitle'],style: TextStyle(fontSize: Screen.setFontSize(13),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () {},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.BuyIcon(size: 22),
|
||||
rightIcon: Text(""),
|
||||
leftText: Text("VIP价格", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text("¥${Config.vipList[int.parse(orderList[0].vipLevel) - 1]['vipMoney'].toString()}元",style: TextStyle(fontSize: Screen.setFontSize(13),color: ColorConfig.ThemeColor)),
|
||||
onTap: () {},
|
||||
),
|
||||
CellWidget(
|
||||
leftIcon: IconFont.StatusIcon(),
|
||||
rightIcon: Text(""),
|
||||
leftText: Text("VIP状态", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Container(
|
||||
padding: EdgeInsets.only(left: 6,right: 6,top: 3,bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.ThemeColor,
|
||||
borderRadius: BorderRadius.circular((10.0))
|
||||
),
|
||||
child: Text(orderList[0].activateStatus == "0" ? '未付款': '已付款',style: TextStyle(fontSize: Screen.setFontSize(12),color: ColorConfig.WhiteBackColor)),
|
||||
),
|
||||
onTap: () {
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
216
untitled/lib/views/Me/Vip/Vip.dart
Normal file
@@ -0,0 +1,216 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
|
||||
class Vip extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State createState() => _Vip();
|
||||
}
|
||||
|
||||
class _Vip extends State<Vip> {
|
||||
|
||||
int currentVipType = 1;
|
||||
List<String> currentExplain;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
setState(() {
|
||||
currentExplain = Config.vipList[currentVipType - 1]["vipExplain"];
|
||||
});
|
||||
}
|
||||
|
||||
choiceVip(Map<String, dynamic> type) {
|
||||
print(type);
|
||||
setState(() {
|
||||
currentVipType = type["id"];
|
||||
currentExplain = type["vipExplain"];
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> placeOrder() async {
|
||||
RegisterEntity res = await UserService.placeOrder(params: {
|
||||
"objectId": Tool.userInfo()['objectId'],
|
||||
"vipLevel": Config.vipList[currentVipType - 1]['id'].toString()
|
||||
});
|
||||
Modular.to.pushNamed('/status');
|
||||
// if (res.code == 200) {
|
||||
// Modular.to.pushNamed('/status');
|
||||
// } else {
|
||||
// Toast.show(res.error, context, duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
title: Text("办理会员"),
|
||||
elevation: 0.0
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
height: Screen.setHeight(70),
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
color: ColorConfig.ThemeColor,
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
R.libStaticImgViplogoPng,
|
||||
width: Screen.setWidth(50),
|
||||
height: Screen.setWidth(50),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(Tool.userInfo()['username'], style: TextStyle(color: ColorConfig.WhiteBackColor,fontSize: Screen.setFontSize(18)),),
|
||||
Text("账户安全等级:安全",style: TextStyle(fontSize: Screen.setFontSize(11),color: ColorConfig.NoActiveColor),),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
width: Screen.width(context),
|
||||
height: Screen.setHeight(95),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: Config.vipList.map((e) => InkWell(
|
||||
onTap: () {
|
||||
choiceVip(e);
|
||||
},
|
||||
child: Container(
|
||||
width: currentVipType == e["id"] ? Screen.width(context) / 2: Screen.width(context) / 3.5,
|
||||
margin: EdgeInsets.only(right: 5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: currentVipType == e["id"] ? ColorConfig.ThemeColor : ColorConfig.IconColor,
|
||||
width: currentVipType == e["id"] ? 1 : 0.5
|
||||
),
|
||||
borderRadius: BorderRadius.circular((7.0))
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(5.0),topRight: Radius.circular(5.0)),
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5),
|
||||
child: Text(e['vipTitle'],style: TextStyle(fontSize: 14,color: ColorConfig.WhiteBackColor),),
|
||||
),
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("¥",style: TextStyle(fontSize: Screen.setFontSize(12),fontWeight: FontWeight.w700,color: ColorConfig.ThemeColor)),
|
||||
Text(e["vipMoney"].toString(),style: TextStyle(fontSize: Screen.setFontSize(24),fontWeight: FontWeight.w700,color: ColorConfig.ThemeColor)),
|
||||
],
|
||||
),
|
||||
height: Screen.setHeight(40),
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(bottom: 5),
|
||||
child: Text("每天仅${e["vipDay"].toString()}元",style: TextStyle(fontSize: 10,color: ColorConfig.TextColor),),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)).toList()
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("1:会员权益介绍",style: TextStyle(fontSize: Screen.setFontSize(18),fontWeight: FontWeight.w600),),
|
||||
SizedBox(height: 10,),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: currentExplain != null ? currentExplain.map((e) =>
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15),
|
||||
child: Text(e,style: TextStyle(color: ColorConfig.TextColor),),
|
||||
)
|
||||
).toList() : [],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.only(bottom: 50),
|
||||
padding: EdgeInsets.only(left: 15, right: 15,top: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("2:购买提示",style: TextStyle(fontSize: Screen.setFontSize(18),fontWeight: FontWeight.w600),),
|
||||
SizedBox(height: 10,),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("1:当您点击办理按钮后,前往微信添加给出的客服微信号,然后向对方转账并填写转账备注为订单号!",style: TextStyle(color: ColorConfig.TextColor)),
|
||||
SizedBox(height: 5,),
|
||||
Text("2:转账成功后,请等待客服为您办理激活,一分钟左右即可办理成功。",style: TextStyle(color: ColorConfig.TextColor)),
|
||||
SizedBox(height: 5,),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
placeOrder();
|
||||
// Modular.to.pushNamed("/status");
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: Screen.setFontSize(15),right: Screen.setFontSize(15)),
|
||||
height: Screen.setHeight(35),
|
||||
alignment: Alignment.center,
|
||||
width: Screen.width(context),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.ThemeColor,
|
||||
borderRadius: BorderRadius.circular(20)
|
||||
),
|
||||
child: Text(
|
||||
"¥${Config.vipList[currentVipType - 1]['vipMoney']}/${Config.vipList[currentVipType - 1]['vipTitle']} 点击办理",
|
||||
style: TextStyle(
|
||||
color: ColorConfig.WhiteBackColor, fontSize: Screen.setFontSize(16)
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
untitled/lib/views/Mechanism/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
eb0076cb-897d-4491-b916-cc08023eedc4
|
||||
81
untitled/lib/views/Mechanism/Mechanism.dart
Normal file
@@ -0,0 +1,81 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class Mechanism extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Mechanism();
|
||||
}
|
||||
|
||||
class _Mechanism extends State<Mechanism> with AutomaticKeepAliveClientMixin<Mechanism> {
|
||||
|
||||
/// 获取机构列表的数据
|
||||
Future<List<MechanismResult>> GetMechanismData() async {
|
||||
return await MechanismService.GetMechanismData(params: {});
|
||||
}
|
||||
|
||||
/// 组件
|
||||
Widget MechanismList(List<MechanismResult> res) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(Screen.setFontSize(15)),
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
child: Wrap(
|
||||
runAlignment: WrapAlignment.spaceBetween,
|
||||
children: res.map((e) => Container(
|
||||
width: Screen.setWidth(86),
|
||||
margin: EdgeInsets.only(bottom: 20),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/mechanismList/${e.id}/${e.title}/mechanism");
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Text(e.title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TitleColor,
|
||||
fontSize: Screen.setFontSize(16))),
|
||||
SizedBox(height: 10),
|
||||
Text(
|
||||
e.quantity,
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
fontSize: Screen.setFontSize(12)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)).toList()
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text("机构"),
|
||||
),
|
||||
body: FutureBuilderWidget<List<MechanismResult>>(
|
||||
future: GetMechanismData,
|
||||
success: MechanismList,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
89
untitled/lib/views/Mechanism/MechanismList.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
class MechanismList extends StatefulWidget {
|
||||
String id;
|
||||
String title = "";
|
||||
String type;
|
||||
|
||||
int totalPage = 0;
|
||||
|
||||
MechanismList({ this.id, this.title, this.type });
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _MechanismList();
|
||||
}
|
||||
|
||||
class _MechanismList extends State<MechanismList> {
|
||||
int page = 1;
|
||||
List<ItemList> Result = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
switch(widget.type) {
|
||||
case 'mechanism':
|
||||
GetmechanismList();
|
||||
break;
|
||||
case 'tags':
|
||||
getClassListData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// 机构列表点击进入详情
|
||||
Future<void> GetmechanismList() async {
|
||||
AgentClassListData res = await MechanismService.GetmechanismList(params: { "id": widget.id, "page": page });
|
||||
setState(() {
|
||||
Result.addAll(res.list);
|
||||
widget.totalPage = int.parse(res.total);
|
||||
page = int.parse(res.page);
|
||||
});
|
||||
}
|
||||
|
||||
Future<AgentClassListData> getClassListData() async {
|
||||
AgentClassListData res = await HomeService.GetClassListData(params: { 'id': widget.id, 'page': page });
|
||||
setState(() {
|
||||
Result.addAll(res.list);
|
||||
widget.totalPage = int.parse(res.total);
|
||||
page = int.parse(res.page);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: EasyRefresh(
|
||||
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
|
||||
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
|
||||
onRefresh: () async {
|
||||
print("刷新");
|
||||
},
|
||||
onLoad: () async {
|
||||
setState(() {
|
||||
page+=1;
|
||||
if (page > widget.totalPage) {
|
||||
Toast.show("没有数据", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
} else {
|
||||
GetmechanismList();
|
||||
}
|
||||
});
|
||||
},
|
||||
child: ItemWidget(
|
||||
data: Result,
|
||||
title: '',
|
||||
longPress: () {}
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
untitled/lib/views/Model/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
8989027d-12a5-4ca8-a827-010051d68874
|
||||
60
untitled/lib/views/Model/Model.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
|
||||
class Model extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Model();
|
||||
|
||||
}
|
||||
|
||||
class _Model extends State<Model> with AutomaticKeepAliveClientMixin<Model>{
|
||||
|
||||
Future<ModelResult> GetModelData() async {
|
||||
return await ModelService.GetModelData(params: {});
|
||||
}
|
||||
|
||||
|
||||
Widget ModelList (ModelResult res) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: Screen.setFontSize(15)),
|
||||
child: ModelWidget(data: res.hotModels, height: 25,),
|
||||
),
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(top: Screen.setFontSize(15)),
|
||||
// child: ModelWidget(title: "最新模特", data: res.newest, height: 25,),
|
||||
// )
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text("模特"),
|
||||
),
|
||||
body: FutureBuilderWidget<ModelResult>(
|
||||
future: GetModelData,
|
||||
success: ModelList,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
}
|
||||