Commit 342b9fab authored by tongzifang's avatar tongzifang

add req

parent ee8693c8
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:qmsd_flutter_user_feedback/qmsd_flutter_user_feedback.dart';
import 'package:qmsd_flutter_user_feedback/user_feedback_page.dart';
void main() {
......@@ -17,41 +13,11 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _qmsdFlutterUserFeedbackPlugin = QmsdFlutterUserFeedback();
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _qmsdFlutterUserFeedbackPlugin.getPlatformVersion() ??
'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// 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;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
return const MaterialApp(
home: UserFeedBackPage(),
);
}
......
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <base_data_channel/base_data_channel_plugin.h>
#include <qmsd_flutter_user_feedback/qmsd_flutter_user_feedback_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) base_data_channel_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "BaseDataChannelPlugin");
base_data_channel_plugin_register_with_registrar(base_data_channel_registrar);
g_autoptr(FlPluginRegistrar) qmsd_flutter_user_feedback_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "QmsdFlutterUserFeedbackPlugin");
qmsd_flutter_user_feedback_plugin_register_with_registrar(qmsd_flutter_user_feedback_registrar);
}
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
base_data_channel
qmsd_flutter_user_feedback
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import base_data_channel
import path_provider_foundation
import qmsd_flutter_user_feedback
import shared_preferences_foundation
import sqflite
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
BaseDataChannelPlugin.register(with: registry.registrar(forPlugin: "BaseDataChannelPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
QmsdFlutterUserFeedbackPlugin.register(with: registry.registrar(forPlugin: "QmsdFlutterUserFeedbackPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
}
platform :osx, '10.14'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_macos_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
......@@ -37,8 +37,8 @@ packages:
dependency: transitive
description:
path: "."
ref: "0.0.7"
resolved-ref: "047a6a5e859efaac99c40d15785f0a906e75b107"
ref: "0.0.8"
resolved-ref: "7e9add2c4853299c3c8a559d043e3b000b6fecbd"
url: "git@git.zmcms.cn:fht/base_data_channel.git"
source: git
version: "0.0.1"
......@@ -250,6 +250,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.2"
http_proxy:
dependency: transitive
description:
name: http_proxy
sha256: "7d5bc7ad1b0c6d0cfb5da97c5bfe302082f93d32cf5c67d484d1a4085b3ffa58"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
image_picker:
dependency: transitive
description:
......@@ -306,6 +314,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
logger:
dependency: transitive
description:
name: logger
sha256: db2ff852ed77090ba9f62d3611e4208a3d11dfa35991a81ae724c113fcb3e3f7
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
matcher:
dependency: transitive
description:
......@@ -497,6 +513,62 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.27.7"
shared_preferences:
dependency: transitive
description:
name: shared_preferences
sha256: "858aaa72d8f61637d64e776aca82e1c67e6d9ee07979123c5d17115031c1b13b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "8304d8a1f7d21a429f91dee552792249362b68a331ac5c3c1caf370f658873f6"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: cf2a42fb20148502022861f71698db12d937c7459345a1bdaa88fc91a91b3603
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
sky_engine:
dependency: transitive
description: flutter
......@@ -510,6 +582,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.1"
sp_util:
dependency: transitive
description:
name: sp_util
sha256: "9da43dce5de79c17a787d0626bf01538d63090ca32521200d22a232171c495dc"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
sqflite:
dependency: transitive
description:
......
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <base_data_channel/base_data_channel_plugin_c_api.h>
#include <qmsd_flutter_user_feedback/qmsd_flutter_user_feedback_plugin_c_api.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
BaseDataChannelPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("BaseDataChannelPluginCApi"));
QmsdFlutterUserFeedbackPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("QmsdFlutterUserFeedbackPluginCApi"));
}
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter/plugin_registry.h>
// Registers Flutter plugins.
void RegisterPlugins(flutter::PluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
base_data_channel
qmsd_flutter_user_feedback
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
import 'qmsd_flutter_user_feedback_platform_interface.dart';
class QmsdFlutterUserFeedback {
Future<String?> getPlatformVersion() {
return QmsdFlutterUserFeedbackPlatform.instance.getPlatformVersion();
}
}
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'qmsd_flutter_user_feedback_platform_interface.dart';
/// An implementation of [QmsdFlutterUserFeedbackPlatform] that uses method channels.
class MethodChannelQmsdFlutterUserFeedback extends QmsdFlutterUserFeedbackPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('qmsd_flutter_user_feedback');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
}
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'qmsd_flutter_user_feedback_method_channel.dart';
abstract class QmsdFlutterUserFeedbackPlatform extends PlatformInterface {
/// Constructs a QmsdFlutterUserFeedbackPlatform.
QmsdFlutterUserFeedbackPlatform() : super(token: _token);
static final Object _token = Object();
static QmsdFlutterUserFeedbackPlatform _instance = MethodChannelQmsdFlutterUserFeedback();
/// The default instance of [QmsdFlutterUserFeedbackPlatform] to use.
///
/// Defaults to [MethodChannelQmsdFlutterUserFeedback].
static QmsdFlutterUserFeedbackPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [QmsdFlutterUserFeedbackPlatform] when
/// they register themselves.
static set instance(QmsdFlutterUserFeedbackPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}
// In order to *not* need this ignore, consider extracting the "web" version
// of your plugin as a separate package, instead of inlining it in the same
// package as the core of your plugin.
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html show window;
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'qmsd_flutter_user_feedback_platform_interface.dart';
/// A web implementation of the QmsdFlutterUserFeedbackPlatform of the QmsdFlutterUserFeedback plugin.
class QmsdFlutterUserFeedbackWeb extends QmsdFlutterUserFeedbackPlatform {
/// Constructs a QmsdFlutterUserFeedbackWeb
QmsdFlutterUserFeedbackWeb();
static void registerWith(Registrar registrar) {
QmsdFlutterUserFeedbackPlatform.instance = QmsdFlutterUserFeedbackWeb();
}
/// Returns a [String] containing the version of the platform.
@override
Future<String?> getPlatformVersion() async {
final version = html.window.navigator.userAgent;
return version;
}
}
import 'dart:io';
import 'package:base_data_channel/http/basedio.dart';
import 'package:base_data_channel/data/base_entity.dart';
import 'package:dio/dio.dart';
import 'package:retrofit/retrofit.dart';
part 'rest_client.g.dart';
@RestApi()
abstract class RestClient {
factory RestClient({Dio? dio, String? baseUrl}) {
dio = BaseDio.getInstance()!.getDio();
return _RestClient(dio, baseUrl: baseUrl);
}
@POST('crm/feedback/store/create')
@FormUrlEncoded()
Future<BaseEntity> subFeedBack(
@Field('type') int type,
@Field('content') String content,
@Field('pictures') List<String> pictures,
{@Field('source') int source = 1});
}
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'rest_client.dart';
// **************************************************************************
// RetrofitGenerator
// **************************************************************************
// ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers
class _RestClient implements RestClient {
_RestClient(
this._dio, {
this.baseUrl,
});
final Dio _dio;
String? baseUrl;
@override
Future<BaseEntity> subFeedBack(
type,
content,
pictures, {
source = 1,
}) async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = {
'type': type,
'content': content,
'pictures': pictures,
'source': source,
};
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseEntity>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'application/x-www-form-urlencoded',
)
.compose(
_dio.options,
'crm/feedback/store/create',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl)));
final value = BaseEntity.fromJson(_result.data!);
return value;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||
requestOptions.responseType == ResponseType.stream)) {
if (T == String) {
requestOptions.responseType = ResponseType.plain;
} else {
requestOptions.responseType = ResponseType.json;
}
}
return requestOptions;
}
}
......@@ -13,16 +13,19 @@ dependencies:
flutter_web_plugins:
sdk: flutter
plugin_platform_interface: ^2.0.2
logger: any
base_data_channel:
# path: /Users/tongzi/AndroidStudioProjects/base_data_channel
# path: /Users/tongzi/AndroidStudioProjects/base_data_channel
git:
url: git@git.zmcms.cn:fht/base_data_channel.git
ref: 0.0.7
ref: 0.0.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
retrofit_generator: '>=6.0.0 <7.0.0'
build_runner: '>=2.3.0 <4.0.0'
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
......
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:qmsd_flutter_user_feedback/qmsd_flutter_user_feedback_method_channel.dart';
void main() {
MethodChannelQmsdFlutterUserFeedback platform = MethodChannelQmsdFlutterUserFeedback();
const MethodChannel channel = MethodChannel('qmsd_flutter_user_feedback');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
test('getPlatformVersion', () async {
expect(await platform.getPlatformVersion(), '42');
});
}
import 'package:flutter_test/flutter_test.dart';
import 'package:qmsd_flutter_user_feedback/qmsd_flutter_user_feedback.dart';
import 'package:qmsd_flutter_user_feedback/qmsd_flutter_user_feedback_platform_interface.dart';
import 'package:qmsd_flutter_user_feedback/qmsd_flutter_user_feedback_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockQmsdFlutterUserFeedbackPlatform
with MockPlatformInterfaceMixin
implements QmsdFlutterUserFeedbackPlatform {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final QmsdFlutterUserFeedbackPlatform initialPlatform = QmsdFlutterUserFeedbackPlatform.instance;
test('$MethodChannelQmsdFlutterUserFeedback is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelQmsdFlutterUserFeedback>());
});
test('getPlatformVersion', () async {
QmsdFlutterUserFeedback qmsdFlutterUserFeedbackPlugin = QmsdFlutterUserFeedback();
MockQmsdFlutterUserFeedbackPlatform fakePlatform = MockQmsdFlutterUserFeedbackPlatform();
QmsdFlutterUserFeedbackPlatform.instance = fakePlatform;
expect(await qmsdFlutterUserFeedbackPlugin.getPlatformVersion(), '42');
});
}
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