Commit 874883c2 authored by 关振斌's avatar 关振斌

update

parent f0d1c0ef
PODS:
- alipay_kit_ios (5.0.0):
- alipay_kit_ios/utdid (= 5.0.0)
- alipay_kit_ios/vendor (= 5.0.0)
- Flutter
- alipay_kit_ios/utdid (5.0.0):
- Flutter
- alipay_kit_ios/vendor (5.0.0):
- Flutter
- babstrap_settings_screen (0.0.1):
- Flutter
- connectivity_plus (0.0.1):
......@@ -138,6 +146,7 @@ PODS:
- Flutter
DEPENDENCIES:
- alipay_kit_ios (from `.symlinks/plugins/alipay_kit_ios/ios`)
- babstrap_settings_screen (from `.symlinks/plugins/babstrap_settings_screen/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
......@@ -183,6 +192,8 @@ SPEC REPOS:
- Toast
EXTERNAL SOURCES:
alipay_kit_ios:
:path: ".symlinks/plugins/alipay_kit_ios/ios"
babstrap_settings_screen:
:path: ".symlinks/plugins/babstrap_settings_screen/ios"
connectivity_plus:
......@@ -235,6 +246,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS:
alipay_kit_ios: bfa484b12d4690cc48a803f39ed5fb58fa774d2e
babstrap_settings_screen: 535097da0fa521a47fef6f6678ff2b464ee15937
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
......
......@@ -14,6 +14,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
C059CC5B29B6DFCC0068B7F5 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C059CC5A29B6DFCC0068B7F5 /* StoreKit.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -46,6 +47,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C059CC5929B6DFA10068B7F5 /* RunnerDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerDebug.entitlements; sourceTree = "<group>"; };
C059CC5A29B6DFCC0068B7F5 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
C08A8E50299A2161008F4DB8 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
C0C4655B29A3007E00C47A11 /* RunnerProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerProfile.entitlements; sourceTree = "<group>"; };
D2718D25F9034030E31B924F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
......@@ -57,6 +60,7 @@
buildActionMask = 2147483647;
files = (
8B8F5CAD6B019351870A46AE /* Pods_Runner.framework in Frameworks */,
C059CC5B29B6DFCC0068B7F5 /* StoreKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -66,6 +70,7 @@
36FEE18528C617843FAFC14B /* Frameworks */ = {
isa = PBXGroup;
children = (
C059CC5A29B6DFCC0068B7F5 /* StoreKit.framework */,
5A7A6DEAB487D7E066FC9441 /* Pods_Runner.framework */,
);
name = Frameworks;
......@@ -114,6 +119,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
C059CC5929B6DFA10068B7F5 /* RunnerDebug.entitlements */,
C0C4655B29A3007E00C47A11 /* RunnerProfile.entitlements */,
C08A8E50299A2161008F4DB8 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
......@@ -490,7 +496,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_ENTITLEMENTS = Runner/RunnerDebug.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = Z99J24WADU;
ENABLE_BITCODE = NO;
......
......@@ -10,7 +10,5 @@
<array>
<string>applinks:www.fusiontech.cn/</string>
</array>
<key>com.apple.developer.in-app-payments</key>
<array/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.fusiontech.cn/</string>
</array>
</dict>
</plist>
......@@ -10,7 +10,5 @@
<array>
<string>applinks:www.fusiontech.cn/</string>
</array>
<key>com.apple.developer.in-app-payments</key>
<array/>
</dict>
</plist>
import 'package:chart/common/entities/classFyDetail.dart';
import 'package:chart/common/entities/entities.dart';
import 'package:chart/common/entities/good.dart';
import 'package:chart/common/utils/utils.dart';
import 'package:chart/common/values/values.dart';
......@@ -24,6 +25,12 @@ class NewsAPI {
return response['data'];
}
static Future<String> doPay(Map<String, String> params) async {
var response = await HttpUtil().post('/pay/doPay', data: params);
return response['data'];
}
// /api/pay/doPay
static Future<String> sendMessageByDetailId(
dynamic params, String detailId) async {
var response =
......@@ -31,6 +38,20 @@ class NewsAPI {
return response['data'];
}
static Future<List<GoodEntity>> getGoodsList() async {
var response = await HttpUtil().get(
'/goods/goodsList',
);
// json['data'].forEach((v) {
// _data!.add(new Data.fromJson(v));
// });
return goodEntityFromList(response['data']);
// GoodEntity.fromJson(response['data']);
// searchRecordEntityFromList(response.data);
}
// /api/goods/goodsList
// /api/openAi/aiAnswer/{detailId}
// /// 翻页
......
List<GoodEntity> goodEntityFromList(List data) =>
List<GoodEntity>.from(data.map((x) => GoodEntity.fromJson(x)));
class GoodEntity {
int? _id;
String? _goodsName;
String? _goodsDesc;
double? _amount;
int? _integral;
String? _createTime;
String? _updateTime;
String? _appleProductId;
int? _isShelf;
int? _goodsType;
int? _count;
GoodEntity(
{int? id,
String? goodsName,
String? goodsDesc,
double? amount,
int? integral,
String? createTime,
String? updateTime,
String? appleProductId,
int? isShelf,
int? goodsType,
int? count}) {
if (id != null) {
this._id = id;
}
if (goodsName != null) {
this._goodsName = goodsName;
}
if (goodsDesc != null) {
this._goodsDesc = goodsDesc;
}
if (amount != null) {
this._amount = amount;
}
if (integral != null) {
this._integral = integral;
}
if (createTime != null) {
this._createTime = createTime;
}
if (updateTime != null) {
this._updateTime = updateTime;
}
if (appleProductId != null) {
this._appleProductId = appleProductId;
}
if (isShelf != null) {
this._isShelf = isShelf;
}
if (goodsType != null) {
this._goodsType = goodsType;
}
if (count != null) {
this._count = count;
}
}
int? get id => _id;
set id(int? id) => _id = id;
String? get goodsName => _goodsName;
set goodsName(String? goodsName) => _goodsName = goodsName;
String? get goodsDesc => _goodsDesc;
set goodsDesc(String? goodsDesc) => _goodsDesc = goodsDesc;
double? get amount => _amount;
set amount(double? amount) => _amount = amount;
int? get integral => _integral;
set integral(int? integral) => _integral = integral;
String? get createTime => _createTime;
set createTime(String? createTime) => _createTime = createTime;
String? get updateTime => _updateTime;
set updateTime(String? updateTime) => _updateTime = updateTime;
String? get appleProductId => _appleProductId;
set appleProductId(String? appleProductId) =>
_appleProductId = appleProductId;
int? get isShelf => _isShelf;
set isShelf(int? isShelf) => _isShelf = isShelf;
int? get goodsType => _goodsType;
set goodsType(int? goodsType) => _goodsType = goodsType;
int? get count => _count;
set count(int? count) => _count = count;
GoodEntity.fromJson(Map<String, dynamic> json) {
_id = json['id'];
_goodsName = json['goodsName'];
_goodsDesc = json['goodsDesc'];
_amount = json['amount'];
_integral = json['integral'];
_createTime = json['createTime'];
_updateTime = json['updateTime'];
_appleProductId = json['appleProductId'];
_isShelf = json['isShelf'];
_goodsType = json['goodsType'];
_count = json['count'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this._id;
data['goodsName'] = this._goodsName;
data['goodsDesc'] = this._goodsDesc;
data['amount'] = this._amount;
data['integral'] = this._integral;
data['createTime'] = this._createTime;
data['updateTime'] = this._updateTime;
data['appleProductId'] = this._appleProductId;
data['isShelf'] = this._isShelf;
data['goodsType'] = this._goodsType;
data['count'] = this._count;
return data;
}
}
// GoodEntity.fromJson(Map<String, dynamic> json) {
// _status = json['status'];
// _message = json['message'];
// if (json['data'] != null) {
// _data = <Data>[];
// json['data'].forEach((v) {
// _data!.add(new Data.fromJson(v));
// });
// }
// _timestamp = json['timestamp'];
// }
\ No newline at end of file
......@@ -10,6 +10,7 @@ class AppRoutes {
static const PRODUCT_PAGE = '/product';
static const TEMPLATE_PAGE = '/template';
static const PAY_LIST = '/pay';
static const AN_PAY_LIST = '/an_pay';
static const PRIVACT = '/privacy';
static const USER_PRIVACT = '/user_privacy';
static const WILL_COME = '/will_come';
......
import 'package:chart/pages/chat/view.dart';
import 'package:chart/pages/frame/android_pay_list/view.dart';
import 'package:chart/pages/frame/notfound/index.dart';
import 'package:chart/pages/frame/pay_list/view.dart';
import 'package:chart/pages/privacy/index.dart';
......@@ -17,6 +18,7 @@ import 'package:chart/pages/frame/notfound/index.dart';
// import 'package:chart/pages/home/home_page.dart';
import 'package:get/get.dart';
import '../../pages/frame/android_pay_list/index.dart';
import '../../pages/frame/pay_list/bindings.dart';
import 'routes.dart';
......@@ -96,6 +98,13 @@ class AppPages {
binding: PayListBinding(),
),
GetPage(
name: AppRoutes.AN_PAY_LIST,
page: () => AndroidPayListPage(),
binding: AndroidPayListBinding(),
),
// AN_PAY_LIST
GetPage(
name: AppRoutes.SIGN_IN,
page: () => SignInPage(),
......
......@@ -2,6 +2,8 @@
// const SERVER_API_URL = 'https://yapi.baidu.com/mock/41008';
// const SERVER_API_URL = 'https://yapi.ducafecat.tech/mock/11';
const SERVER_API_URL = 'http://101.34.153.228:8083/api';//线上
// const SERVER_API_URL = 'http://192.168.120.23:8083/api';
// http://192.168.110.25:8083/
// const SERVER_API_URL = 'http://192.168.2.178:8083/api';
// const SERVER_API_URL = 'http://192.168.110.57:8083/api';
//
......
......@@ -3,12 +3,25 @@ import 'package:flutter/services.dart';
import 'package:chart/common/services/services.dart';
import 'package:chart/common/store/store.dart';
import 'package:chart/common/utils/utils.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
/// 全局静态数据
class Global {
/// 初始化
static Future init() async {
EasyLoading.instance
..maskType = EasyLoadingMaskType.black
..displayDuration = const Duration(milliseconds: 2000)
..indicatorType = EasyLoadingIndicatorType.fadingCircle
..loadingStyle = EasyLoadingStyle.dark
..indicatorSize = 45.0
..radius = 10.0
..backgroundColor = Colors.green
..indicatorColor = Colors.yellow
..textColor = Colors.yellow
..maskColor = Colors.blue.withOpacity(0.5);
WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
Get.updateLocale(Locale("zh", "CN"));
......
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:chart/models/app_model.dart';
import 'package:provider/provider.dart';
import 'package:chart/router/routers.dart';
import 'package:chart/router/application.dart';
import 'package:flutter/services.dart' as services;
// import 'package:chart/constant/app_colors.dart';
import 'package:chart/constant/app_strings.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; //国际化
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
// import 'package:firebase_phone_auth_handler/firebase_phone_auth_handler.dart';
// import 'package:firebase_core/firebase_core.dart';
// import 'package:connectivity_plus/connectivity_plus.dart';
import 'dart:ui';
import 'models/user_model.dart';
// ignore: non_constant_identifier_names
// WidgetsFlutterBinding.ensureInitialized();
// await Firebase.initializeApp();
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// await Firebase.initializeApp();
var appModel = AppModel();
var userViewModel = UserModel();
userViewModel.refreshData();
// appModel.getClassFyList();
// var appModel = AppModel();
// var userViewModel = UserModel();
// var userSubscribeModel = UserSubscribeModel();
// var serverModel = ServerModel();
// var userSubscribeModel = UserSubscribeModel();
// var serverModel = ServerModel();
// var planModel = PlanModel();
runApp(MultiProvider(providers: [
ChangeNotifierProvider<AppModel>.value(value: appModel),
ChangeNotifierProvider<UserModel>.value(value: userViewModel),
// ChangeNotifierProvider<UserSubscribeModel>.value(value: userSubscribeModel),
// ChangeNotifierProvider<ServerModel>.value(value: serverModel),
// ChangeNotifierProvider<PlanModel>.value(value: planModel)
], child: ChartApp()));
configLoading();
}
class ChartApp extends StatelessWidget {
ChartApp({Key? key}) : super(key: key) {
final router = FluroRouter();
// Routers.configureRoutes(router);
Application.router = router;
}
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
services.SystemChrome.setPreferredOrientations([
services.DeviceOrientation.portraitUp,
services.DeviceOrientation.portraitDown
]);
return MaterialApp(
// <--- /!\ Add the builder
title: AppStrings.appName,
navigatorKey: Application.navigatorKey,
debugShowCheckedModeBanner: false,
onGenerateRoute: Application.router?.generator,
localizationsDelegates: const [
// 本地化的代理类
RefreshLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate //复制
],
builder: EasyLoading.init(),
supportedLocales: const [
Locale('en', 'US'), // 美国英语
Locale('zh', 'CN'), // 中文简体
//其它Locales
],
theme: ThemeData(
// Color(0xff9182F9)
primarySwatch: createMaterialColor(const Color(0xff9182F9)),
// AppColors.themeColorGreen,
visualDensity: VisualDensity.adaptivePlatformDensity),
);
}
}
//调用的时候需要把hex改一下,比如#223344 needs change to 0xFF223344
//即把#换成0xFF即可
MaterialColor createMaterialColor(Color color) {
List strengths = <double>[.05];
Map<int, Color> swatch = {};
final int r = color.red, g = color.green, b = color.blue;
for (int i = 1; i < 10; i++) {
strengths.add(0.1 * i);
}
strengths.forEach((strength) {
final double ds = 0.5 - strength;
swatch[(strength * 1000).round()] = Color.fromRGBO(
r + ((ds < 0 ? r : (255 - r)) * ds).round(),
g + ((ds < 0 ? g : (255 - g)) * ds).round(),
b + ((ds < 0 ? b : (255 - b)) * ds).round(),
1,
);
});
return MaterialColor(color.value, swatch);
}
void configLoading() {
EasyLoading
.instance
// ..displayDuration = const Duration(milliseconds: 2000)
// ..indicatorType = EasyLoadingIndicatorType.fadingCircle
// ..loadingStyle = EasyLoadingStyle.dark
// ..indicatorSize = 45.0
// ..radius = 10.0
// ..progressColor = Colors.yellow
// ..backgroundColor = Colors.green
// ..indicatorColor = Colors.yellow
// ..textColor = Colors.yellow
// ..maskColor = Colors.blue.withOpacity(0.5)
// ..userInteractions = false
.userInteractions = false;
// ..customAnimation = CustomAnimation();
}
......@@ -52,50 +52,9 @@ class ChatApp extends StatelessWidget {
enableLog: true,
logWriterCallback: Logger.write,
));
// GetMaterialApp(
// debugShowCheckedModeBanner: false,
// enableLog: true,
// logWriterCallback: Logger.write,
// initialRoute: AppPages.INITIAL,
// getPages: AppPages.routes,
// locale: TranslationService.locale,
// fallbackLocale: TranslationService.fallbackLocale,
// translations: TranslationService(),
// );
}
}
// () => RefreshConfiguration(
// headerBuilder: () => ClassicHeader(),
// footerBuilder: () => ClassicFooter(),
// hideFooterWhenNotFull: true,
// headerTriggerDistance: 80,
// maxOverScrollExtent: 100,
// footerTriggerDistance: 150,
// child: GetMaterialApp(
// title: 'News',
// theme: AppTheme.light,
// debugShowCheckedModeBanner: false,
// initialRoute: AppPages.INITIAL,
// getPages: AppPages.routes,
// builder: EasyLoading.init(),
// translations: TranslationService(),
// navigatorObservers: [AppPages.observer],
// localizationsDelegates: [
// GlobalMaterialLocalizations.delegate,
// GlobalWidgetsLocalizations.delegate,
// GlobalCupertinoLocalizations.delegate,
// ],
// supportedLocales: ConfigStore.to.languages,
// locale: ConfigStore.to.locale,
// fallbackLocale: Locale('en', 'US'),
// enableLog: true,
// logWriterCallback: Logger.write,
// ),
// ),
/// 所有的Binding层
class AllControllerBinding extends Bindings {
@override
void dependencies() {
......
import 'package:flutter/material.dart';
// import 'package:sail/adapters/leaf_ffi/config.dart';
// import 'package:sail/channels/vpn_manager.dart';
// import 'package:sail/constant/app_strings.dart';
import 'package:chart/models/base_model.dart';
import "package:chart/service/plan_service.dart";
import '../entity/plan_entity.dart';
// import 'package:sail/models/server_model.dart';
// import 'package:sail/models/user_model.dart';
// import 'package:sail/utils/common_util.dart';
class AppModel extends BaseModel {
List<ClassifyEntity> _classFyList = [];
List<ClassifyEntity> get classFyList => _classFyList;
// VpnManager vpnManager = VpnManager();
bool isOn = false;
PageController pageController = PageController(initialPage: 0);
String appTitle = 'Sail';
// Config config = Config();
getClassFyList() async {
print("appTitle,$appTitle");
try {
List<ClassifyEntity>? list = await PlanService().getClassifyList();
_classFyList = list!;
} catch (e) {
print(e);
}
}
// AppModel() {
// // General general = General(
// // loglevel: 'info',
// // logoutput: '{{leafLogFile}}',
// // dnsServer: ['223.5.5.5', '114.114.114.114'],
// // tunFd: '{{tunFd}}',
// // routingDomainResolve: true);
// // List<Rule> rules = [];
// // // rules.add(Rule(typeField: 'EXTERNAL', target: 'Direct', filter: 'site:cn'));
// // rules.add(Rule(typeField: 'FINAL', target: 'Direct'));
// // config.general = general;
// // config.rules = rules;
// }
// final Map _tabMap = {
// 0: AppStrings.appName,
// 1: '套餐',
// 2: '节点',
// 3: '我的',
// };
void jumpToPage(int page) {
// pageController.jumpToPage(page);
// appTitle = _tabMap[page];
// notifyListeners();
}
void getStatus() async {
// isOn = await vpnManager.getStatus();
// print("status: $isOn");
// notifyListeners();
}
void togglePowerButton() async {
// await vpnManager.toggle();
// isOn = !isOn;
// notifyListeners();
}
void getTunnelLog() async {
// var log = await vpnManager.getTunnelLog();
// print("log: $log");
}
void getTunnelConfiguration() async {
// var conf = await vpnManager.getTunnelConfiguration();
// print("config: $conf");
}
// void setConfigProxies(UserModel userModel, ServerModel serverModel) async {
// List<Proxy> proxies = [];
// List<ProxyGroup> proxyGroups = [];
// List<String> actors = [];
// serverModel.serverEntityList?.forEach((server) {
// Proxy proxy = Proxy(
// tag: server.name,
// protocol: server.type,
// address: server.host,
// port: server.port,
// encryptMethod: server.cipher,
// password: userModel.userEntity!.uuid);
// proxies.add(proxy);
// actors.add(server.name);
// });
// if (actors.isNotEmpty) {
// proxyGroups.add(ProxyGroup(
// tag: "UrlTest",
// protocol: 'url-test',
// actors: actors,
// checkInterval: 600));
// config.rules?.last.target = "UrlTest";
// }
// config.proxies = proxies;
// config.proxyGroups = proxyGroups;
// print("-----------------config-----------------");
// print(config);
// print("-----------------config-----------------");
// vpnManager.setTunnelConfiguration(config.toString());
// }
void setConfigRule(String tag) async {
// var proxy = config.proxies?.where((proxies) => proxies.tag == tag);
//
// if (proxy == null || proxy.isEmpty) {
// return;
// }
//
// config.rules?.last.target = tag;
//
// print("-----------------config-----------------");
// print(config);
// print("-----------------config-----------------");
//
// vpnManager.setTunnelConfiguration(config.toString());
}
}
import 'package:flutter/material.dart';
import 'package:chart/models/page_state.dart';
// import 'package:chart/utils/common_util.dart';
class BaseModel extends ChangeNotifier {
PageState pageState = PageState.loading;
bool _isDispose = false;
late String errorMessage;
bool get isDispose => _isDispose;
@override
void notifyListeners() {
print("view model notifyListeners");
if (!_isDispose) {
super.notifyListeners();
}
}
void errorNotify(String error) {
pageState = PageState.error;
errorMessage = error;
notifyListeners();
}
@override
void dispose() {
_isDispose = true;
print("view model dispose");
super.dispose();
}
}
enum PageState {
loading, //加载中
hasData, //有数据
empty, //无数据
error, //加载失败
}
import 'package:chart/constant/app_strings.dart';
import 'package:chart/entity/login_entity.dart';
import 'package:chart/entity/user_entity.dart';
import 'package:chart/models/base_model.dart';
import 'package:chart/utils/navigator_util.dart';
import 'package:chart/utils/shared_preferences_util.dart';
import "package:chart/service/user_service.dart";
import '../entity/plan_entity.dart';
import '../service/plan_service.dart';
// import '';
class UserModel extends BaseModel {
late String _token;
late String _authData;
late UserEntity? _userEntity;
late bool _isFirstOpen;
bool _isLogin = false;
late IntegralEntity? _integralEntity;
final UserService _userService = UserService();
late List<ClassifyEntity> _classFyList;
String get token => _token;
String get authData => _authData;
UserEntity? get userEntity => _userEntity;
bool get isFirstOpen => _isFirstOpen;
bool get isLogin => _isLogin;
IntegralEntity? get integralEntity => _integralEntity;
List<ClassifyEntity>? get classFyList => _classFyList;
Future<void> checkHasLogin(context, Function callback) async {
if (!isLogin) {
NavigatorUtil.goLogin(context);
} else {
return callback();
}
}
refreshData() async {
_integralEntity = IntegralEntity(id: 1, username: '', token: "");
_classFyList = [];
_isFirstOpen = await SharedPreferencesUtil.getInstance()
?.getBool(AppStrings.isFirstOpen) ??
true;
String token = await SharedPreferencesUtil.getInstance()
?.getString(AppStrings.token) ??
'';
// String authData = await SharedPreferencesUtil.getInstance()
// ?.getString(AppStrings.authData) ??
// '';
if (token != null && token.isNotEmpty) {
_isLogin = true;
_token = token;
// _authData = authData;
// Map<String, dynamic> userEntityMap =
// await SharedPreferencesUtil.getInstance()
// ?.getMap(AppStrings.userInfo) ??
// <String, dynamic>{};
// _userEntity = UserEntity.fromMap(userEntityMap);
// notifyListeners();
}
}
logout() {
SharedPreferencesUtil? sharedPreferencesUtil =
SharedPreferencesUtil.getInstance();
sharedPreferencesUtil?.clear();
setIsFirstOpen(false);
refreshData();
}
_saveIsFirstOpen() {
SharedPreferencesUtil.getInstance()
?.setBool(AppStrings.isFirstOpen, _isFirstOpen);
}
_saveUserToken(LoginEntity loginEntity) async {
SharedPreferencesUtil? sharedPreferencesUtil =
SharedPreferencesUtil.getInstance();
await sharedPreferencesUtil?.setString(AppStrings.token, loginEntity.token);
}
_setUserAuthData(LoginEntity loginEntity) async {
SharedPreferencesUtil? sharedPreferencesUtil =
SharedPreferencesUtil.getInstance();
await sharedPreferencesUtil?.setString(
AppStrings.authData, loginEntity.username);
}
_saveUserInfo() async {
SharedPreferencesUtil? sharedPreferencesUtil =
SharedPreferencesUtil.getInstance();
await sharedPreferencesUtil?.setMap(
AppStrings.userInfo, _userEntity?.toMap());
}
setIsFirstOpen(bool isFirstOpen) {
_isFirstOpen = isFirstOpen;
_saveIsFirstOpen();
}
setToken(LoginEntity loginEntity) async {
_token = loginEntity.token;
// _authData = loginEntity.authData;
_isLogin = true;
await setIntegralInfo();
_saveUserToken(loginEntity);
_setUserAuthData(loginEntity);
}
setUserInfo(UserEntity? userEntity) {
_userEntity = userEntity;
_saveUserInfo();
}
setIntegralInfo() async {
final integralEntity = await _userService.getUserIntegral();
if (integralEntity!.token.isNotEmpty) {
_saveUserToken(LoginEntity(
username: integralEntity!.username,
id: integralEntity.id,
token: integralEntity.token));
print("integralEntity$integralEntity");
_integralEntity = integralEntity;
} else {
//TODO
// print('integralEntityintegralEntity${integralEntity.token}');
}
}
getClassFyList() async {
try {
List<ClassifyEntity>? list = await PlanService().getClassifyList();
_classFyList = list!;
} catch (e) {
print(e);
}
}
}
import 'package:chart/utils/common_util.dart';
// import 'package:chart/utils/common_util.dart';
import 'package:flutter/material.dart';
import 'package:chart/common/entities/entities.dart';
import 'package:chart/common/utils/utils.dart';
......
......@@ -7,7 +7,6 @@ import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
import 'package:uuid/uuid.dart';
import '../../common/store/user.dart';
import 'index.dart';
import 'package:chart/service/message_service.dart';
class ChatPageController extends GetxController {
ChatPageController();
......
import 'package:get/get.dart';
import 'controller.dart';
class AndroidPayListBinding implements Bindings {
@override
void dependencies() {
Get.lazyPut<AndroidPayListController>(() => AndroidPayListController());
}
}
import 'dart:async';
import 'dart:convert';
import 'package:alipay_kit/alipay_kit.dart';
import 'package:chart/common/apis/apis.dart';
import 'package:chart/common/entities/good.dart';
import 'package:chart/common/store/user.dart';
import 'package:chart/pages/frame/android_pay_list/unsafe_alipay_kit.dart';
// import 'package:chart/common/routers/routes.dart';
// import 'package:chart/common/store/store.dart';
// import 'package:chart/entity/user_entity.dart';
// import 'package:chart/pages/application/index.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
// import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
// import 'package:flutter_inapp_purchase/modules.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get/get.dart';
import 'index.dart';
class AndroidPayListController extends GetxController {
AndroidPayListController();
final state = AndroidPayListState();
// Platform messages may fail, so we use a try/catch PlatformException.
// prepare
/// 成员变量
/// 事件
// tap
void handleTap(int index) {
Get.snackbar(
"标题",
"消息",
);
}
/// 生命周期
///在 widget 内存中分配后立即调用。
///你可以用它来为控制器初始化 initialize 一些东西。
@override
void onInit() async {
super.onInit();
await initializedPlugins();
await _getProduct();
// EasyLoading.dismiss();
// await initializedPlugins();
// new 对象
// 初始静态数据
}
Future initializedPlugins() async {
await AlipayKitPlatform.instance.isInstalled();
}
Future _getProduct() async {
EasyLoading.show(status: "正在获取套餐中...");
try {
List<GoodEntity> goodsList = await NewsAPI.getGoodsList();
// print(goodsList);
state.items.addAll(goodsList);
EasyLoading.dismiss();
} catch (e) {
print(e);
EasyLoading.dismiss();
}
// try {
// List<IAPItem> items =
// await FlutterInappPurchase.instance.getProducts(_productLists);
// state.items.addAll(items);
// // for (var item in items) {
// // // print('${item.toString()}');
// // // this._items.add(item);
// // }
// } catch (e) {
// print("_getProductError$e");
// }
}
void requestPurchase() async {
Vibrate.feedback(FeedbackType.selection);
// print("${item.productId}");
EasyLoading.show(status: '支付中...');
// List<String> newList = list.where((element) => element.compareTo('b') > 0).toList(); // ['c', 'd']
final actSelected = state.items
.firstWhere((element) => element.appleProductId == state.selected);
String orderInfo = await NewsAPI.doPay({
"goodsId": "${actSelected.id}",
"type": '1',
"userId": "${UserStore.to.profile.id}"
});
AlipayKitPlatform.instance.pay(orderInfo: orderInfo);
EasyLoading.dismiss();
// actSelected
// selected
// await NewsAPI.doPay({"goodsId": 0, "type": 0, "userId": 0});
// final Map<String, dynamic> bizContent = <String, dynamic>{
// 'timeout_express': '30m',
// 'product_code': 'QUICK_MSECURITY_PAY',
// 'total_amount': '0.01',
// 'subject': '1',
// 'body': '我是测试数据',
// 'out_trade_no': '123456789',
// };
// final Map<String, dynamic> orderInfo = <String, dynamic>{
// 'app_id': "2021003176601601",
// 'biz_content': json.encode(bizContent),
// 'charset': 'utf-8',
// 'method': 'alipay.trade.app.pay',
// 'timestamp': '2016-07-29 16:55:53',
// 'version': '1.0',
// };
// IAPItem item
// FlutterInappPurchase.instance.requestPurchase(state.selected);
}
///在 onInit() 之后调用 1 帧。这是进入的理想场所
///导航事件,例如 snackbar、对话框或新route,或
///async 异步请求。
@override
void onReady() {
super.onReady();
// async 拉取数据
}
///在 [onDelete] 方法之前调用。 [onClose] 可能用于
///处理控制器使用的资源。就像 closing events 一样,
///或在控制器销毁之前的流。
///或者处置可能造成一些内存泄漏的对象,
///像 TextEditingControllers、AnimationControllers。
///将一些数据保存在磁盘上也可能很有用。
@override
void onClose() {
super.onClose();
// 1 stop & close 关闭对象
// 2 save 持久化数据
}
///dispose 释放内存
@override
void dispose() {
// _purchaseUpdatedSubscription.cancel();
// _purchaseErrorSubscription.cancel();
// _conectionSubscription.cancel();
super.dispose();
// dispose 释放对象
}
}
library notfound;
export './state.dart';
export './controller.dart';
export './bindings.dart';
export './view.dart';
import 'dart:convert';
import 'dart:typed_data';
import 'package:pointycastle/pointycastle.dart';
import 'package:pointycastle/signers/rsa_signer.dart';
class RsaKeyParser {
const RsaKeyParser._();
static RSAPublicKey parsePublic(String key) {
final List<String> rows = key.split('\n');
final String header = rows.first;
if (header == '-----BEGIN RSA PUBLIC KEY-----') {
return _parsePublic(_parseSequence(rows));
}
if (header == '-----BEGIN PUBLIC KEY-----') {
return _parsePublic(_pkcs8PublicSequence(_parseSequence(rows)));
}
throw UnsupportedError('PEMKey($key) is unsupported');
}
static RSAPrivateKey parsePrivate(String key) {
final List<String> rows = key.split('\n');
final String header = rows.first;
if (header == '-----BEGIN RSA PRIVATE KEY-----') {
return _parsePrivate(_parseSequence(rows));
}
if (header == '-----BEGIN PRIVATE KEY-----') {
return _parsePrivate(_pkcs8PrivateSequence(_parseSequence(rows)));
}
throw UnsupportedError('PEMKey($key) is unsupported');
}
static RSAPublicKey _parsePublic(ASN1Sequence sequence) {
final BigInt modulus = (sequence.elements![0] as ASN1Integer).integer!;
final BigInt exponent = (sequence.elements![1] as ASN1Integer).integer!;
return RSAPublicKey(modulus, exponent);
}
static RSAPrivateKey _parsePrivate(ASN1Sequence sequence) {
final BigInt modulus = (sequence.elements![1] as ASN1Integer).integer!;
final BigInt exponent = (sequence.elements![3] as ASN1Integer).integer!;
final BigInt? p = (sequence.elements?[4] as ASN1Integer?)?.integer;
final BigInt? q = (sequence.elements?[5] as ASN1Integer?)?.integer;
return RSAPrivateKey(modulus, exponent, p, q);
}
static ASN1Sequence _parseSequence(List<String> rows) {
final String keyText = rows
.skipWhile((String row) => row.startsWith('-----BEGIN'))
.takeWhile((String row) => !row.startsWith('-----END'))
.map((String row) => row.trim())
.join('');
final Uint8List keyBytes = Uint8List.fromList(base64.decode(keyText));
final ASN1Parser asn1Parser = ASN1Parser(keyBytes);
return asn1Parser.nextObject() as ASN1Sequence;
}
static ASN1Sequence _pkcs8PublicSequence(ASN1Sequence sequence) {
final ASN1Object object = sequence.elements![1];
final List<int> bytes = object.valueBytes!.sublist(1);
final ASN1Parser parser = ASN1Parser(Uint8List.fromList(bytes));
return parser.nextObject() as ASN1Sequence;
}
static ASN1Sequence _pkcs8PrivateSequence(ASN1Sequence sequence) {
final ASN1Object object = sequence.elements![2];
final Uint8List bytes = object.valueBytes!;
final ASN1Parser parser = ASN1Parser(bytes);
return parser.nextObject() as ASN1Sequence;
}
}
class RsaSigner {
const RsaSigner(RSASigner rsaSigner, RSAPrivateKey privateKey)
: _rsaSigner = rsaSigner,
_privateKey = privateKey;
final RSASigner _rsaSigner;
final RSAPrivateKey _privateKey;
List<int> sign(List<int> message) {
_rsaSigner
..reset()
..init(true, PrivateKeyParameter<RSAPrivateKey>(_privateKey));
final RSASignature signature =
_rsaSigner.generateSignature(Uint8List.fromList(message));
return signature.bytes;
}
static RsaSigner sha1Rsa(String privateKey) {
return RsaSigner(Signer('SHA-1/RSA') as RSASigner,
RsaKeyParser.parsePrivate(privateKey));
}
static RsaSigner sha256Rsa(String privateKey) {
return RsaSigner(Signer('SHA-256/RSA') as RSASigner,
RsaKeyParser.parsePrivate(privateKey));
}
}
class RsaVerifier {
const RsaVerifier(RSASigner rsaSigner, RSAPublicKey publicKey)
: _rsaSigner = rsaSigner,
_publicKey = publicKey;
final RSASigner _rsaSigner;
final RSAPublicKey _publicKey;
bool verify(List<int> message, List<int> signature) {
_rsaSigner
..reset()
..init(false, PublicKeyParameter<RSAPublicKey>(_publicKey));
return _rsaSigner.verifySignature(Uint8List.fromList(message),
RSASignature(Uint8List.fromList(signature)));
}
static RsaVerifier sha1Rsa(String publicKey) {
return RsaVerifier(
Signer('SHA-1/RSA') as RSASigner, RsaKeyParser.parsePublic(publicKey));
}
static RsaVerifier sha256Rsa(String publicKey) {
return RsaVerifier(Signer('SHA-256/RSA') as RSASigner,
RsaKeyParser.parsePublic(publicKey));
}
}
import 'package:chart/common/entities/good.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
import 'package:get/get.dart';
class AndroidPayListState {
// title
final _title = "".obs;
set title(value) => this._title.value = value;
get title => this._title.value;
final _selected = "com.wudi.app.60stars".obs;
set selected(value) => _selected.value = value;
get selected => _selected.value;
RxList<GoodEntity> items = <GoodEntity>[].obs;
}
import 'dart:convert';
import 'package:alipay_kit/alipay_kit.dart';
import 'package:chart/pages/frame/android_pay_list/rsa.dart';
extension UnsafeAlipayKitPlatform on AlipayKitPlatform {
static const String SIGNTYPE_RSA = 'RSA';
static const String SIGNTYPE_RSA2 = 'RSA2';
static const String AUTHTYPE_AUTHACCOUNT = 'AUTHACCOUNT';
static const String AUTHTYPE_LOGIN = 'LOGIN';
/// 支付
Future<void> unsafePay({
required Map<String, dynamic> orderInfo,
String signType = SIGNTYPE_RSA2,
required String privateKey,
bool isShowLoading = true,
}) {
final String? charset = orderInfo['charset'] as String?;
final Encoding encoding = Encoding.getByName(charset) ?? utf8;
final Map<String, dynamic> clone = <String, dynamic>{
...orderInfo,
'sign_type': signType,
};
final String param = _param(clone, encoding);
final String sign = _sign(clone, signType, privateKey);
return AlipayKitPlatform.instance.pay(
orderInfo:
'$param&sign=${Uri.encodeQueryComponent(sign, encoding: encoding)}',
isShowLoading: isShowLoading,
);
}
/// 登录
Future<void> unsafeAuth({
required String appId, // 支付宝分配给开发者的应用ID
required String pid, // 签约的支付宝账号对应的支付宝唯一用户号,以2088开头的16位纯数字组成
required String targetId, // 商户标识该次用户授权请求的ID,该值在商户端应保持唯一
String authType =
AUTHTYPE_AUTHACCOUNT, // 标识授权类型,取值范围:AUTHACCOUNT 代表授权;LOGIN 代表登录
String signType =
SIGNTYPE_RSA2, // 商户生成签名字符串所使用的签名算法类型,目前支持 RSA2 和 RSA ,推荐使用 RSA2
required String privateKey,
bool isShowLoading = true,
}) {
assert(authType == AUTHTYPE_AUTHACCOUNT || authType == AUTHTYPE_LOGIN);
final Map<String, dynamic> authInfo = <String, dynamic>{
'apiname': 'com.alipay.account.auth',
'method': 'alipay.open.auth.sdk.code.get',
'app_id': appId,
'app_name': 'mc',
'biz_type': 'openservice',
'pid': pid,
'product_id': 'APP_FAST_LOGIN',
'scope': 'kuaijie',
'target_id': targetId,
'auth_type': authType,
};
authInfo['sign_type'] = signType;
const Encoding encoding = utf8; // utf-8
final String param = _param(authInfo, encoding);
final String sign = _sign(authInfo, signType, privateKey);
return AlipayKitPlatform.instance.auth(
authInfo:
'$param&sign=${Uri.encodeQueryComponent(sign, encoding: encoding)}',
isShowLoading: isShowLoading,
);
}
static String _param(Map<String, dynamic> map, Encoding encoding) {
return map.entries
.map((MapEntry<String, dynamic> e) =>
'${e.key}=${Uri.encodeQueryComponent('${e.value}', encoding: encoding)}')
.join('&');
}
static String _sign(
Map<String, dynamic> map, String signType, String privateKey) {
// 参数排序
final List<String> keys = map.keys.toList();
keys.sort();
final String content = keys.map((String e) => '$e=${map[e]}').join('&');
String sign;
switch (signType) {
case SIGNTYPE_RSA:
sign = base64
.encode(RsaSigner.sha1Rsa(privateKey).sign(utf8.encode(content)));
break;
case SIGNTYPE_RSA2:
sign = base64
.encode(RsaSigner.sha256Rsa(privateKey).sign(utf8.encode(content)));
break;
default:
throw UnsupportedError('Alipay sign_type($signType) is not supported!');
}
return sign;
}
}
\ No newline at end of file
import 'package:chart/common/routers/routes.dart';
import 'package:chart/common/values/colors.dart';
import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'index.dart';
import 'widgets/widgets.dart';
// android_pay_list
class AndroidPayListPage extends GetView<AndroidPayListController> {
// 内容页
Widget _buildView() {
// return PayItemWidget();
return PayItemWidget();
}
@override
Widget build(BuildContext context) {
final c = Get.put(AndroidPayListController());
return Scaffold(
// appBar: transparentAppBar(
// title: Text(
// "套餐选择",
// style: TextStyle(
// color: AppColors.primaryElementText,
// fontFamily: 'Montserrat',
// fontSize: 18,
// fontWeight: FontWeight.w600,
// ),
// ),
// leading: IconButton(
// tooltip: '返回上一页',
// icon: const Icon(
// Icons.arrow_back,
// color: AppColors.primaryElementText,
// ),
// onPressed: () async {
// // Get.back();
// // Get.offAll(ApplicationPage());
// // await Get.off(ApplicationPage());
// // Get.toNamed(AppRoutes.Application);
// Get.back();
// // await Get.toNamed();
// // Navigator.of(context).pop();
// //_nextPage(-1);
// },
// ),
// ),
// _buildView
body: Container(
width: double.infinity,
height: double.infinity,
// padding: EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
image: DecorationImage(
image: Image.asset("assets/images/bg1.png").image,
fit: BoxFit.cover),
),
child: _buildView()),
);
}
}
// import 'dart:async';
// import 'package:chart/common/store/store.dart';
// import 'package:chart/entity/user_entity.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_easyloading/flutter_easyloading.dart';
// import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
// import 'package:get/get.dart';
// import 'package:glassmorphism/glassmorphism.dart';
// import '../../../../common/apis/apis.dart';
// import '../index.dart';
// class PayItemWidget extends StatefulWidget {
// const PayItemWidget({Key? key}) : super(key: key);
// @override
// GoodsPageState createState() => GoodsPageState();
// }
// class GoodsPageState extends State<PayItemWidget> {
// late StreamSubscription _purchaseUpdatedSubscription;
// late StreamSubscription _purchaseErrorSubscription;
// late StreamSubscription _conectionSubscription;
// @override
// void initState() {
// initializedPlugins();
// // TODO: implement initState
// super.initState();
// }
// initializedPlugins() async {
// String platformVersion;
// // Platform messages may fail, so we use a try/catch PlatformException.
// // prepare
// var result = await FlutterInappPurchase.instance.initialize();
// print('result: $result');
// // If the widget was removed from the tree while the asynchronous platform
// // message was in flight, we want to discard the reply rather than calling
// // setState to update our non-existent appearance.
// if (!mounted) return;
// _conectionSubscription =
// FlutterInappPurchase.connectionUpdated.listen((connected) {
// print('connected: $connected');
// });
// _purchaseUpdatedSubscription =
// FlutterInappPurchase.purchaseUpdated.listen((productItem) async {
// // print(a);
// ApplePayEntity? res = await UserAPI.notifyApplePay({
// 'receipt': productItem?.transactionReceipt,
// 'userId': UserStore.to.profile.id,
// "chooseEnv": false
// });
// print(
// "productItemproductItemproductItemproductItemproductItemproductItemproductItemproductItem");
// if (res?.status == 200) {
// await FlutterInappPurchase.instance.clearTransactionIOS();
// EasyLoading.showSuccess('${res?.message}');
// EasyLoading.dismiss();
// } else {
// EasyLoading.showError("${res?.message}}");
// EasyLoading.dismiss();
// }
// });
// _purchaseErrorSubscription =
// FlutterInappPurchase.purchaseError.listen((purchaseError) {
// // print('purchase-error: $purchaseError');
// EasyLoading.showError('支付订单失败');
// EasyLoading.dismiss();
// });
// }
// @override
// dispose() {
// _purchaseUpdatedSubscription.cancel();
// _purchaseErrorSubscription.cancel();
// _conectionSubscription.cancel();
// super.dispose();
// }
// @override
// Widget build(BuildContext context) {
// var count = 0.obs;
// // ProductController c = Get.put(ProductController());
// // ProductController c = Get.put(ProductController());
// AndroidPayListController c = Get.find();
// // initDataList
// return Column(
// children: c.state.items
// .map((item) => GlassmorphicContainer(
// borderRadius: 16,
// margin: EdgeInsets.only(top: 16),
// blur: 14,
// alignment: Alignment.bottomCenter,
// border: 2,
// linearGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// const Color(0xFF0FFFF).withOpacity(0.2),
// const Color(0xFF0FFFF).withOpacity(0.2),
// ],
// ),
// borderGradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// const Color(0xFF0FFFF).withOpacity(1),
// const Color(0xFFFFFFF),
// const Color(0xFF0FFFF).withOpacity(1),
// ],
// ),
// height: 173,
// width: double.infinity,
// // margin: EdgeInsets.symmetric(vertical: 10.0),
// child: Container(
// child: Column(
// children: <Widget>[
// Container(
// padding: EdgeInsets.all(16.0),
// width: double.infinity,
// // height: 200,
// child: Column(children: [
// Row(
// children: [
// const Text(
// "项目名称:",
// style: TextStyle(color: Colors.white),
// ),
// SizedBox(
// width: 10,
// ),
// Text(
// item.title!,
// style: TextStyle(color: Colors.white),
// )
// ],
// ),
// Row(
// children: [
// const Text(
// "项目价格:",
// style: TextStyle(color: Colors.white),
// ),
// SizedBox(
// width: 10,
// ),
// Text(
// item.localizedPrice!,
// style: TextStyle(color: Colors.white),
// )
// ],
// ),
// Row(
// children: [
// const Text(
// "项目描述:",
// style: TextStyle(color: Colors.white),
// ),
// SizedBox(
// width: 10,
// ),
// Expanded(
// child: Text(
// maxLines: 3,
// item.description!,
// style: TextStyle(
// color: Colors.white,
// ),
// ))
// ],
// ),
// Row(children: [
// ElevatedButton(
// // color: Colors.orange,
// onPressed: () {
// EasyLoading.show(status: '提交订单中...');
// c.requestPurchase();
// // c()
// },
// child: Text('购买套餐'),
// ),
// ])
// ]),
// // child: ,
// ),
// ],
// ),
// ),
// ))
// .toList());
// }
// }
This diff is collapsed.
library widgets;
export 'helloword.dart';
......@@ -58,8 +58,9 @@ class PayListController extends GetxController {
void onInit() async {
super.onInit();
await initializedPlugins();
EasyLoading.show(status: "正在获取套餐中...");
await _getProduct();
EasyLoading.dismiss();
// await initializedPlugins();
// new 对象
// 初始静态数据
......
......@@ -183,7 +183,7 @@ class GoodsPageState extends State<PayItemWidget> {
// color: Colors.orange,
onPressed: () {
EasyLoading.show(status: '提交订单中...');
c.requestPurchase(item);
c.requestPurchase();
// c()
},
child: Text('购买套餐'),
......
......@@ -100,7 +100,7 @@ class PayItemWidget extends GetView<PayListController> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.send, color: color),
Text("升级 AI写作大师 Premium",
Text(" 选择自己需要的套餐",
style: TextStyle(color: color, fontSize: 20))
],
),
......@@ -111,38 +111,111 @@ class PayItemWidget extends GetView<PayListController> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
// crossAxisAlignment
Obx(() => controller.state.selected ==
'com.wudi.app.60stars'
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
// crossAxisAlignment
children: [
Icon(Icons.check, color: color),
Text("无限聊天",
style:
TextStyle(color: color, fontSize: 16))
],
),
Row(
children: [
Icon(Icons.check, color: color),
Text("无广告",
style:
TextStyle(color: color, fontSize: 16))
],
),
Row(
children: [
Icon(Icons.check, color: color),
Text("解锁所有高级功能",
style:
TextStyle(color: color, fontSize: 16))
],
)
],
),
children: [
Icon(Icons.check, color: color),
Text("30次提问机会",
style: TextStyle(
color: color, fontSize: 16))
],
),
// Row(
// children: [
// Icon(Icons.check, color: color),
// Text("无广告",
// style: TextStyle(
// color: color, fontSize: 16))
// ],
// ),
Row(
children: [
Icon(Icons.check, color: color),
Text("解锁所有高级功能",
style: TextStyle(
color: color, fontSize: 16))
],
)
],
)
: controller.state.selected ==
'com.wudi.app.monthly_pass'
? Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
// crossAxisAlignment
children: [
Icon(Icons.check, color: color),
Text("月卡会员",
style: TextStyle(
color: color, fontSize: 16))
],
),
Row(
children: [
Icon(Icons.check, color: color),
Text("无限聊天",
style: TextStyle(
color: color, fontSize: 16))
],
),
Row(
children: [
Icon(Icons.check, color: color),
Text("解锁所有高级功能",
style: TextStyle(
color: color, fontSize: 16))
],
)
],
)
: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
// crossAxisAlignment
children: [
Icon(Icons.check, color: color),
Text("周卡会员",
style: TextStyle(
color: color, fontSize: 16))
],
),
Row(
children: [
Icon(Icons.check, color: color),
Text("无限聊天",
style: TextStyle(
color: color, fontSize: 16))
],
),
Row(
children: [
Icon(Icons.check, color: color),
Text("解锁所有高级功能",
style: TextStyle(
color: color, fontSize: 16))
],
)
],
)),
Image(
image: AssetImage("assets/images/center-1.png"),
width: Get.mediaQuery.size.height * 0.17,
......
......@@ -175,22 +175,30 @@ class ProductController extends GetxController {
}
handleNextText() async {
final a =
state.messageQueenItemQueen.map((element) => element.text).join("");
String str = a + '\n\n' + "继续";
state.loading = true;
EasyLoading.show(status: "AI正在生成中...");
String result = await NewsAPI.sendMessage(
{"question": str, "id": "${UserStore.to.profile.id}"});
state.loading = false;
state.isWhite = true;
state.messageQueenItemQueen.forEach((element) {
element.isFinish = false;
});
EasyLoading.dismiss();
state.messageQueenItemQueen
.add(MessageQueenItem(text: result, isFinish: false, isWhiteIng: true));
try {
final a =
state.messageQueenItemQueen.map((element) => element.text).join("");
String str = a + '\n\n' + "继续";
state.loading = true;
EasyLoading.show(status: "AI正在生成中...");
String result = await NewsAPI.sendMessage(
{"question": str, "id": "${UserStore.to.profile.id}"});
state.loading = false;
state.isWhite = true;
state.messageQueenItemQueen.forEach((element) {
element.isFinish = false;
});
EasyLoading.dismiss();
state.messageQueenItemQueen.add(
MessageQueenItem(text: result, isFinish: false, isWhiteIng: true));
} catch (e) {
EasyLoading.showError("网络异常");
EasyLoading.dismiss();
state.loading = false;
state.isWhite = false;
}
;
}
handleFinished() {
......
......@@ -170,15 +170,14 @@ class ProductPage extends GetView<ProductController> {
)
],
)
: Markdown(data: "${idx.text}");
// Text(
// "${idx.text}",
// style: TextStyle(
// fontSize: 18,
// color: Colors.white,
// // fontWeight: FontWeight.bold
// ),
// );
: Text(
"${idx.text}",
style: TextStyle(
fontSize: 18,
color: Colors.white,
// fontWeight: FontWeight.bold
),
);
return text;
}).toList(),
......
import 'package:chart/models/user_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
// import '../size_confige.dart';
class DoctorAppBar extends StatelessWidget {
const DoctorAppBar(
this.userModel, {
Key? key,
}) : super(key: key);
final UserModel userModel;
// late final UserModel _userModel;
// @override
// didChangeDependencies() {
// super.didChangeDependencies();
// _userModel = Provider.of<UserModel>(context);
// }
@override
Widget build(BuildContext context) {
// UserModel userViewModel = Provider.of<UserModel>(context);
// final text = Provider.of<String>(context);
// _userModel = Provider.of<UserModel>(context);
// ${userViewModel.integralEntity?.username}
// print(userViewModel.integralEntity);
return Container(
width: double.infinity,
child: Padding(
padding: EdgeInsets.only(left: 20, top: 60, right: 20, bottom: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
// ignore: prefer_const_literals_to_create_immutables
children: [
// ignore: prefer_const_constructors
Text(
"Hi,32121",
// ignore: prefer_const_constructors
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w800,
fontSize: 20),
),
SizedBox(height: 30),
// ignore: prefer_const_constructors
Text(
"欢迎使用AI写作大师,你可以收获很多",
style: TextStyle(color: Colors.white, fontSize: 12),
),
],
),
GestureDetector(
onTap: () => {Navigator.of(context).pushNamed('/goods')},
child: Container(
height: 60,
width: 60,
decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(
// blurRadius: 3,
// offset: Offset(0, 4),
// color: Colors.black54,
// )
// ],
// color: Color(0xffA295FD),
borderRadius: BorderRadius.circular(5)),
child: ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Image.asset("assets/images/dingyue.png")),
),
)
],
),
),
);
}
}
This diff is collapsed.
......@@ -4,7 +4,7 @@ import 'package:chart/common/values/values.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get/get.dart';
import 'package:platform/platform.dart';
import '../../../common/store/user.dart';
import '../index.dart';
......@@ -91,7 +91,14 @@ class NewsCategoriesWidget extends GetView<MainController> {
// AppRoutes.SIGN_IN
Vibrate.feedback(FeedbackType.impact);
if (userC.isLogin) {
Get.toNamed(AppRoutes.PAY_LIST);
// _platform
if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST);
} else {
Get.toNamed(AppRoutes.PAY_LIST);
}
// AN_PAY_LIST
} else {
Get.toNamed(AppRoutes.SIGN_IN);
}
......
This diff is collapsed.
......@@ -56,8 +56,8 @@ class UserDetailPage extends GetView<UserDetailController> {
children: [
// ignore: prefer_const_constructors
Container(
width: 100,
height: 100,
width: 80,
height: 80,
margin: EdgeInsets.all(20),
// color: Colors.black,
padding: EdgeInsets.all(0),
......@@ -146,7 +146,7 @@ class UserDetailPage extends GetView<UserDetailController> {
height: 20,
),
Text(
"会员日期至:${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day}",
" 会员日期至:${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day}",
style: TextStyle(
color: Color.fromRGBO(
255, 255, 255, 1)),
......@@ -163,7 +163,7 @@ class UserDetailPage extends GetView<UserDetailController> {
height: 20,
),
Text(
"积分剩余:",
" 积分剩余:",
style: TextStyle(
color: Color.fromRGBO(
255, 255, 255, 1)),
......@@ -383,7 +383,11 @@ class UserDetailPage extends GetView<UserDetailController> {
onTap: () {
Vibrate.feedback(FeedbackType.impact);
if (c.isLogin) {
Get.toNamed(AppRoutes.PAY_LIST);
if (GetPlatform.isAndroid) {
Get.toNamed(AppRoutes.AN_PAY_LIST);
} else {
Get.toNamed(AppRoutes.PAY_LIST);
}
} else {
Get.toNamed(AppRoutes.SIGN_IN);
}
......
import 'package:chart/utils/common_util.dart';
import 'package:flutter/material.dart';
import 'package:chart/common/entities/entities.dart';
import 'package:chart/common/utils/utils.dart';
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:chart/constant/app_colors.dart';
import 'package:chart/constant/app_dimens.dart';
import 'package:chart/constant/app_images.dart';
import 'package:chart/constant/app_strings.dart';
import 'package:chart/models/user_model.dart';
import 'package:chart/utils/navigator_util.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:card_swiper/card_swiper.dart';
class GuidePage extends StatefulWidget {
const GuidePage({Key? key}) : super(key: key);
@override
GuidePageState createState() => GuidePageState();
}
class GuidePageState extends State<GuidePage> {
var guides = [AppImages.guide1, AppImages.guide2, AppImages.guide3];
var _showButton = false;
@override
Widget build(BuildContext context) {
UserModel().setIsFirstOpen(false);
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
children: [
_guideWidget(),
Positioned(
right: ScreenUtil().setWidth(30),
bottom: ScreenUtil().setHeight(30),
child: Offstage(
offstage: !_showButton,
child: Center(
child: TextButton(
style: TextButton.styleFrom(
primary: AppColors.themeColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(30))),
),
onPressed: () {
NavigatorUtil.goHomePage(context);
},
child: const Text(AppStrings.openDoor,
style: TextStyle(fontSize: AppDimens.bigTextSize)),
)),
)),
],
));
}
Widget _guideWidget() {
return Swiper(
itemCount: guides.length,
//item数量
scrollDirection: Axis.horizontal,
//滚动方向 设置为Axis.vertical如果需要垂直滚动
itemBuilder: (BuildContext context, int index) {
return Image.asset(
guides[index],
fit: BoxFit.fill,
width: double.infinity,
height: double.infinity,
);
},
autoplay: true,
//自动滚动
loop: false,
//循环滚动
pagination: const SwiperPagination(
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
activeColor: Color(0xFFFF5722), //选中的颜色
color: Color(0xFF999999), //非选中的颜色
)),
onIndexChanged: ((value) {
//图片数组下标变化监听
if (value == guides.length - 1) {
setState(() {
_showButton = true;
});
} else if (_showButton && value != guides.length - 1) {
//减少非必要的setState 只有当滑动到最后一张图片然后向做滑动的时候触发
setState(() {
_showButton = false;
});
}
}),
);
}
}
This diff is collapsed.
// import 'package:flutter/cupertino.dart';
// import 'package:chart/constant/app_dimens.dart';
// import 'package:chart/pages/guide/guide_page.dart';
// import 'package:chart/models/user_model.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:provider/provider.dart';
// import 'home_page.dart';
// class MainPage extends StatefulWidget {
// const MainPage({Key? key}) : super(key: key);
// @override
// MainPageState createState() => MainPageState();
// }
// class MainPageState extends State<MainPage> {
// @override
// Widget build(BuildContext context) {
// UserModel userViewModel = Provider.of<UserModel>(context);
// ScreenUtil.init(context,
// designSize: const Size(AppDimens.maxWidth, AppDimens.maxHeight));
// return userViewModel.isFirstOpen
// ? const GuidePage()
// : const HomePage(
// title: "hello world",
// );
// }
// }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:chart/constant/app_strings.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewWidget extends StatefulWidget {
final String? url;
final String? name;
const WebViewWidget({Key? key, this.url, this.name}) : super(key: key);
@override
WebViewWidgetState createState() => WebViewWidgetState();
}
class WebViewWidgetState extends State<WebViewWidget> {
late WebViewController controller;
final String _javaScript = '''
const styles = `
#page-header {
display: none;
}
#main-container {
padding-top: 0 !important;
}
`
const styleSheet = document.createElement("style")
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
''';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.name!),
centerTitle: true,
),
body: WebView(
initialUrl: "http://1.12.240.104:8081/",
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (controller) => this.controller = controller,
onPageFinished: (url) {
print('url=$url');
controller.runJavascript(_javaScript);
},
),
);
}
}
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
class Application {
static FluroRouter? router;
static GlobalKey<NavigatorState> navigatorKey = GlobalKey();
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import 'package:chart/constant/app_urls.dart';
import 'package:chart/entity/server_entity.dart';
import 'package:chart/utils/http_util.dart';
class ServerService {
Future<List<ServerEntity>>? server() {
// return HttpUtil.instance?.get(AppUrls.server).then((result) {
// return serverEntityFromList(result['data']);
// });
}
}
This diff is collapsed.
This diff is collapsed.
import 'dart:core' as core;
import 'package:flutter/foundation.dart';
void print(core.Object object) {
if (kDebugMode) {
core.print(object);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment