first commit

This commit is contained in:
kicap
2023-10-25 06:40:10 +08:00
commit 364bee3120
168 changed files with 8354 additions and 0 deletions

View File

@ -0,0 +1,3 @@
class GlobalVar {
String backPressed = 'backNormal';
}

View File

@ -0,0 +1,40 @@
import 'package:dio/dio.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
class MyHttpServices {
final _options = BaseOptions(
baseUrl: dotenv.env['api_url']!,
connectTimeout: const Duration(milliseconds: 60000),
receiveTimeout: const Duration(milliseconds: 60000),
);
late Dio _dio;
MyHttpServices() {
_dio = Dio(_options);
}
Future<Response> get(String path) async {
try {
return await _dio.get(path);
} on DioException {
rethrow;
}
}
Future<Response> postWithFormData(String path, FormData formData) async {
try {
return await _dio.post(path, data: formData);
} on DioException {
rethrow;
}
}
Future<Response> delete(String path) async {
try {
return await _dio.delete(path);
} on DioException {
rethrow;
}
}
}

View File

@ -0,0 +1,39 @@
import 'package:flutter_easyloading/flutter_easyloading.dart';
class MyEasyLoading {
showLoading() {
EasyLoading.show(
status: 'loading...',
maskType: EasyLoadingMaskType.black,
dismissOnTap: false,
);
}
dismissLoading() {
EasyLoading.dismiss();
}
customLoading(String message) {
EasyLoading.show(
status: message,
maskType: EasyLoadingMaskType.black,
dismissOnTap: false,
);
}
showSuccess(String message) {
EasyLoading.showSuccess(message);
}
showError(String message) {
EasyLoading.showError(message);
}
showInfo(String message) {
EasyLoading.showInfo(message);
}
showProgress(double progress, String status) {
EasyLoading.showProgress(progress, status: status);
}
}