format code

This commit is contained in:
jyuesong
2022-01-18 09:29:45 +08:00
parent 917425c5de
commit 074580952f
40 changed files with 414 additions and 568 deletions

View File

@@ -1,6 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qinglong_app/base/common_dialog.dart'; import 'package:qinglong_app/utils/extension.dart';
import 'base_viewmodel.dart'; import 'base_viewmodel.dart';
class BaseStateWidget<T extends BaseViewModel> extends ConsumerStatefulWidget { class BaseStateWidget<T extends BaseViewModel> extends ConsumerStatefulWidget {
@@ -21,7 +21,8 @@ class BaseStateWidget<T extends BaseViewModel> extends ConsumerStatefulWidget {
_BaseStateWidgetState<T> createState() => _BaseStateWidgetState<T>(); _BaseStateWidgetState<T> createState() => _BaseStateWidgetState<T>();
} }
class _BaseStateWidgetState<T extends BaseViewModel> extends ConsumerState<BaseStateWidget<T>> { class _BaseStateWidgetState<T extends BaseViewModel>
extends ConsumerState<BaseStateWidget<T>> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -39,7 +40,7 @@ class _BaseStateWidgetState<T extends BaseViewModel> extends ConsumerState<BaseS
var viewModel = ref.watch<T>(widget.model); var viewModel = ref.watch<T>(widget.model);
if (viewModel.failedToast != null) { if (viewModel.failedToast != null) {
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) { WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
failDialog(context, viewModel.failedToast!); (viewModel.failedToast ?? "").toast();
viewModel.clearToast(); viewModel.clearToast();
}); });
} }

View File

@@ -1,222 +0,0 @@
import 'dart:async';
import 'package:back_button_interceptor/back_button_interceptor.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// @author newtab on 2021/7/16
///常用loading,fail,success对话框
class CommonDialog extends StatelessWidget {
final String? text;
final CommonDialogState? commonDialogState;
const CommonDialog({Key? key, this.text, this.commonDialogState}) : super(key: key);
@override
Widget build(BuildContext context) {
Widget loading;
if (commonDialogState == CommonDialogState.FAILED) {
loading = const Icon(
CupertinoIcons.clear_circled,
size: 50,
);
} else if (commonDialogState == CommonDialogState.SUCCESS) {
loading = const Icon(
CupertinoIcons.checkmark_alt,
size: 50,
);
} else {
loading = LoadingIcon();
}
Widget result = Material(
color: Colors.transparent,
child: Align(
alignment: Alignment.center,
child: Container(
decoration: BoxDecoration(color: Color.fromRGBO(17, 17, 17, 0.7), borderRadius: BorderRadius.circular(5)),
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width / 2,
minWidth: 122,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: const EdgeInsets.only(top: 15.0),
constraints: BoxConstraints(
minHeight: 40,
),
child: IconTheme(
data: const IconThemeData(
color: Colors.white,
size: 40.0,
),
child: loading),
),
const SizedBox(
height: 15,
),
if (text != null)
Padding(
padding: const EdgeInsets.only(
left: 15,
right: 15,
bottom: 15,
),
child: DefaultTextStyle(
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white, fontSize: 14),
child: Text(text!),
),
),
],
),
),
),
);
return result;
}
}
class LoadingIcon extends StatefulWidget {
final double size;
LoadingIcon({this.size = 50.0});
@override
State<StatefulWidget> createState() => LoadingIconState();
}
class LoadingIconState extends State<LoadingIcon> with SingleTickerProviderStateMixin {
AnimationController? _controller;
Animation<double>? _doubleAnimation;
@override
void initState() {
super.initState();
_controller = AnimationController(vsync: this, duration: const Duration(milliseconds: 1000))..repeat();
_doubleAnimation = Tween(begin: 0.0, end: 360.0).animate(_controller!)
..addListener(() {
setState(() {});
});
}
@override
void dispose() {
_controller?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Transform.rotate(
angle: _doubleAnimation!.value ~/ 30 * 30.0 * 0.0174533, child: Image.asset("assets/images/loading.png", width: widget.size, height: widget.size));
}
}
enum CommonDialogState {
LOADING,
SUCCESS,
FAILED,
}
typedef HideCallback = Future Function();
int backButtonIndex = 2;
OverlayEntry? overlay;
HideCallback showCommonDialog(
BuildContext context, {
String? text,
bool backButtonClose = false,
CommonDialogState commonDialogState = CommonDialogState.LOADING,
}) {
Completer<VoidCallback> result = Completer<VoidCallback>();
var backButtonName = 'QL_Toast$backButtonIndex';
BackButtonInterceptor.add((stopDefaultButtonEvent, _) {
if (backButtonClose) {
result.future.then((hide) {
hide();
});
}
return true;
}, zIndex: backButtonIndex, name: backButtonName);
backButtonIndex++;
if (overlay != null && overlay!.mounted) {
overlay?.remove();
overlay = null;
}
overlay = OverlayEntry(
maintainState: true,
builder: (_) => WillPopScope(
onWillPop: () async {
var hide = await result.future;
hide();
return false;
},
child: CommonDialog(
text: text,
commonDialogState: commonDialogState,
),
),
);
result.complete(() {
overlay?.remove();
overlay = null;
BackButtonInterceptor.removeByName(backButtonName);
});
if (overlay != null) {
Overlay.of(context)?.insert(overlay!);
}
return () async {
var hide = await result.future;
hide();
};
}
Future successDialog(BuildContext context, String text) {
HideCallback hideCallback = showCommonDialog(
context,
text: text,
commonDialogState: CommonDialogState.SUCCESS,
backButtonClose: true,
);
return Future.delayed(
Duration(
milliseconds: 1000,
), () {
hideCallback();
});
}
Future failDialog(BuildContext context, String text) {
HideCallback hideCallback = showCommonDialog(
context,
text: text,
commonDialogState: CommonDialogState.FAILED,
backButtonClose: true,
);
return Future.delayed(
Duration(
milliseconds: 1000,
), () {
hideCallback();
});
}
HideCallback loadingDialog(BuildContext context, {String? text}) {
return showCommonDialog(
context,
text: text,
commonDialogState: CommonDialogState.LOADING,
backButtonClose: true,
);
}

View File

@@ -10,9 +10,10 @@ import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
import 'url.dart'; import 'url.dart';
class Api { class Api {
static Future<HttpResponse<LoginBean>> login(String userName, String passWord) async { static Future<HttpResponse<LoginBean>> login(
String userName, String passWord) async {
return await Http.post<LoginBean>( return await Http.post<LoginBean>(
Url.LOGIN, Url.login,
{ {
"username": userName, "username": userName,
"password": passWord, "password": passWord,
@@ -21,90 +22,104 @@ class Api {
} }
static Future<HttpResponse<List<TaskBean>>> crons() async { static Future<HttpResponse<List<TaskBean>>> crons() async {
return await Http.get<List<TaskBean>>(Url.TASKS, {"searchValue": ""}); return await Http.get<List<TaskBean>>(Url.tasks, {"searchValue": ""});
} }
static Future<HttpResponse<NullResponse>> startTasks(List<String> crons) async { static Future<HttpResponse<NullResponse>> startTasks(
return await Http.put<NullResponse>(Url.RUN_TASKS, crons); List<String> crons) async {
return await Http.put<NullResponse>(Url.runTasks, crons);
} }
static Future<HttpResponse<NullResponse>> stopTasks(List<String> crons) async { static Future<HttpResponse<NullResponse>> stopTasks(
return await Http.put<NullResponse>(Url.RUN_TASKS, crons); List<String> crons) async {
return await Http.put<NullResponse>(Url.runTasks, crons);
} }
static Future<HttpResponse<String>> inTimeLog(String cron) async { static Future<HttpResponse<String>> inTimeLog(String cron) async {
return await Http.get<String>(Url.INTIME_LOG(cron), null); return await Http.get<String>(Url.intimeLog(cron), null);
} }
static Future<HttpResponse<TaskDetailBean>> taskDetail(String cron) async { static Future<HttpResponse<TaskDetailBean>> taskDetail(String cron) async {
return await Http.get<TaskDetailBean>(Url.TASK_DETAIL + cron, null); return await Http.get<TaskDetailBean>(Url.taskDetail + cron, null);
} }
static Future<HttpResponse<TaskDetailBean>> addTask(String name, String command, String cron, {String? id}) async { static Future<HttpResponse<TaskDetailBean>> addTask(
String name, String command, String cron,
{String? id}) async {
var data = {"name": name, "command": command, "schedule": cron}; var data = {"name": name, "command": command, "schedule": cron};
if (id != null) { if (id != null) {
data["_id"] = id; data["_id"] = id;
return await Http.put<TaskDetailBean>(Url.ADD_TASK, data); return await Http.put<TaskDetailBean>(Url.addTask, data);
} }
return await Http.post<TaskDetailBean>(Url.ADD_TASK, data); return await Http.post<TaskDetailBean>(Url.addTask, data);
} }
static Future<HttpResponse<NullResponse>> delTask(String cron) async { static Future<HttpResponse<NullResponse>> delTask(String cron) async {
return await Http.delete<NullResponse>(Url.ADD_TASK, [cron]); return await Http.delete<NullResponse>(Url.addTask, [cron]);
} }
static Future<HttpResponse<NullResponse>> pinTask(String cron) async { static Future<HttpResponse<NullResponse>> pinTask(String cron) async {
return await Http.put<NullResponse>(Url.PIN_TASK, [cron]); return await Http.put<NullResponse>(Url.pinTask, [cron]);
} }
static Future<HttpResponse<NullResponse>> unpinTask(String cron) async { static Future<HttpResponse<NullResponse>> unpinTask(String cron) async {
return await Http.put<NullResponse>(Url.UNPIN_TASK, [cron]); return await Http.put<NullResponse>(Url.unpinTask, [cron]);
} }
static Future<HttpResponse<NullResponse>> enableTask(String cron) async { static Future<HttpResponse<NullResponse>> enableTask(String cron) async {
return await Http.put<NullResponse>(Url.ENABLE_TASK, [cron]); return await Http.put<NullResponse>(Url.enableTask, [cron]);
} }
static Future<HttpResponse<NullResponse>> disableTask(String cron) async { static Future<HttpResponse<NullResponse>> disableTask(String cron) async {
return await Http.put<NullResponse>(Url.DISABLE_TASK, [cron]); return await Http.put<NullResponse>(Url.disableTask, [cron]);
} }
static Future<HttpResponse<List<ConfigBean>>> files() async { static Future<HttpResponse<List<ConfigBean>>> files() async {
return await Http.get<List<ConfigBean>>(Url.FILES, null); return await Http.get<List<ConfigBean>>(Url.files, null);
} }
static Future<HttpResponse<String>> content(String name) async { static Future<HttpResponse<String>> content(String name) async {
return await Http.get<String>(Url.CONFIG_CONTENT + name, null); return await Http.get<String>(Url.configContent + name, null);
} }
static Future<HttpResponse<NullResponse>> saveFile(String name, String content) async { static Future<HttpResponse<NullResponse>> saveFile(
return await Http.post<NullResponse>(Url.SAVE_FILE, {"content": content, "name": name}); String name, String content) async {
return await Http.post<NullResponse>(
Url.saveFile, {"content": content, "name": name});
} }
static Future<HttpResponse<List<EnvBean>>> envs(String search) async { static Future<HttpResponse<List<EnvBean>>> envs(String search) async {
return await Http.get<List<EnvBean>>(Url.ENVS, {"searchValue": search}); return await Http.get<List<EnvBean>>(Url.envs, {"searchValue": search});
} }
static Future<HttpResponse<NullResponse>> enableEnv(String id) async { static Future<HttpResponse<NullResponse>> enableEnv(String id) async {
return await Http.put<NullResponse>(Url.ENABLE_ENVS, [id]); return await Http.put<NullResponse>(Url.enableEnvs, [id]);
} }
static Future<HttpResponse<NullResponse>> disableEnv(String id) async { static Future<HttpResponse<NullResponse>> disableEnv(String id) async {
return await Http.put<NullResponse>(Url.DISABLE_ENVS, [id]); return await Http.put<NullResponse>(Url.disableEnvs, [id]);
} }
static Future<HttpResponse<NullResponse>> delEnv(String id) async { static Future<HttpResponse<NullResponse>> delEnv(String id) async {
return await Http.delete<NullResponse>(Url.DEL_ENV, [id]); return await Http.delete<NullResponse>(Url.delEnv, [id]);
} }
static Future<HttpResponse<NullResponse>> addEnv(String name, String value, String remarks, {String? id}) async { static Future<HttpResponse<NullResponse>> addEnv(
String name, String value, String remarks,
{String? id}) async {
var data = {"value": value, "remarks": remarks, "name": name}; var data = {"value": value, "remarks": remarks, "name": name};
if (id != null) { if (id != null) {
data["_id"] = id; data["_id"] = id;
return await Http.put<NullResponse>(Url.ADD_ENV, data); return await Http.put<NullResponse>(Url.addEnv, data);
} }
return await Http.post<NullResponse>(Url.ADD_ENV, [data]); return await Http.post<NullResponse>(Url.addEnv, [data]);
}
static Future<HttpResponse<NullResponse>> moveEnv(
String id, int fromIndex, int toIndex) async {
return await Http.put<NullResponse>(
Url.envMove(id), {"fromIndex": fromIndex, "toIndex": toIndex});
} }
} }

View File

@@ -38,7 +38,8 @@ class Http {
} }
} }
static Future<HttpResponse<T>> get<T>(String uri, Map<String, String>? json, {bool compute = true}) async { static Future<HttpResponse<T>> get<T>(String uri, Map<String, String>? json,
{bool compute = true}) async {
try { try {
_init(); _init();
var response = await _dio!.get(uri, queryParameters: json); var response = await _dio!.get(uri, queryParameters: json);
@@ -48,11 +49,15 @@ class Http {
if (e.response?.statusCode == 401) { if (e.response?.statusCode == 401) {
exitLogin(); exitLogin();
} }
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0); return HttpResponse(
success: false,
message: e.response?.statusMessage ?? e.message,
code: 0);
} }
} }
static Future<HttpResponse<T>> post<T>(String uri, dynamic json, {bool compute = true}) async { static Future<HttpResponse<T>> post<T>(String uri, dynamic json,
{bool compute = true}) async {
try { try {
_init(); _init();
var response = await _dio!.post(uri, data: json); var response = await _dio!.post(uri, data: json);
@@ -62,11 +67,15 @@ class Http {
if (e.response?.statusCode == 401) { if (e.response?.statusCode == 401) {
exitLogin(); exitLogin();
} }
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0); return HttpResponse(
success: false,
message: e.response?.statusMessage ?? e.message,
code: 0);
} }
} }
static Future<HttpResponse<T>> delete<T>(String uri, dynamic json, {bool compute = true}) async { static Future<HttpResponse<T>> delete<T>(String uri, dynamic json,
{bool compute = true}) async {
try { try {
_init(); _init();
var response = await _dio!.delete(uri, data: json); var response = await _dio!.delete(uri, data: json);
@@ -76,11 +85,15 @@ class Http {
if (e.response?.statusCode == 401) { if (e.response?.statusCode == 401) {
exitLogin(); exitLogin();
} }
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0); return HttpResponse(
success: false,
message: e.response?.statusMessage ?? e.message,
code: 0);
} }
} }
static Future<HttpResponse<T>> put<T>(String uri, dynamic json, {bool compute = true}) async { static Future<HttpResponse<T>> put<T>(String uri, dynamic json,
{bool compute = true}) async {
try { try {
_init(); _init();
var response = await _dio!.put(uri, data: json); var response = await _dio!.put(uri, data: json);
@@ -89,7 +102,10 @@ class Http {
if (e.response?.statusCode == 401) { if (e.response?.statusCode == 401) {
exitLogin(); exitLogin();
} }
return HttpResponse(success: false, message: e.response?.statusMessage ?? e.message, code: 0); return HttpResponse(
success: false,
message: e.response?.statusMessage ?? e.message,
code: 0);
} }
} }
@@ -98,7 +114,7 @@ class Http {
static void exitLogin() { static void exitLogin() {
if (!pushedLoginPage) { if (!pushedLoginPage) {
pushedLoginPage = true; pushedLoginPage = true;
navigatorState.currentState?.pushReplacementNamed(Routes.route_LOGIN); navigatorState.currentState?.pushReplacementNamed(Routes.routeLogin);
} }
} }
@@ -182,7 +198,8 @@ class HttpResponse<T> {
late int code; late int code;
T? bean; T? bean;
HttpResponse({required this.success, this.message, required this.code, this.bean}); HttpResponse(
{required this.success, this.message, required this.code, this.bean});
} }
class DeserializeAction<T> { class DeserializeAction<T> {

View File

@@ -6,13 +6,17 @@ import '../userinfo_viewmodel.dart';
class TokenInterceptor extends Interceptor { class TokenInterceptor extends Interceptor {
@override @override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) { void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
if (getIt<UserInfoViewModel>().token != null && getIt<UserInfoViewModel>().token!.isNotEmpty) { if (getIt<UserInfoViewModel>().token != null &&
options.headers["Authorization"] = "Bearer " + getIt<UserInfoViewModel>().token!; getIt<UserInfoViewModel>().token!.isNotEmpty) {
options.headers["Authorization"] =
"Bearer " + getIt<UserInfoViewModel>().token!;
} }
options.headers["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"; options.headers["User-Agent"] =
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
options.headers["Content-Type"] = "application/json;charset=UTF-8"; options.headers["Content-Type"] = "application/json;charset=UTF-8";
options.queryParameters["t"] = (DateTime.now().millisecondsSinceEpoch~/1000).toString(); options.queryParameters["t"] =
(DateTime.now().millisecondsSinceEpoch ~/ 1000).toString();
return handler.next(options); return handler.next(options);
} }
} }

View File

@@ -1,24 +1,28 @@
class Url { class Url {
static const LOGIN = "/api/user/login"; static const login = "/api/user/login";
static const TASKS = "/api/crons"; static const tasks = "/api/crons";
static const RUN_TASKS = "/api/crons/run"; static const runTasks = "/api/crons/run";
static const STOP_TASKS = "/api/crons/stop"; static const stopTasks = "/api/crons/stop";
static const TASK_DETAIL = "/api/crons/"; static const taskDetail = "/api/crons/";
static const ADD_TASK = "/api/crons"; static const addTask = "/api/crons";
static const PIN_TASK = "/api/crons/pin"; static const pinTask = "/api/crons/pin";
static const UNPIN_TASK = "/api/crons/unpin"; static const unpinTask = "/api/crons/unpin";
static const ENABLE_TASK = "/api/crons/enable"; static const enableTask = "/api/crons/enable";
static const DISABLE_TASK = "/api/crons/disable"; static const disableTask = "/api/crons/disable";
static const FILES = "/api/configs/files"; static const files = "/api/configs/files";
static const CONFIG_CONTENT = "/api/configs/"; static const configContent = "/api/configs/";
static const SAVE_FILE = "/api/configs/save"; static const saveFile = "/api/configs/save";
static const ENVS = "/api/envs"; static const envs = "/api/envs";
static const ADD_ENV = "/api/envs"; static const addEnv = "/api/envs";
static const DEL_ENV = "/api/envs"; static const delEnv = "/api/envs";
static const DISABLE_ENVS = "/api/envs/disable"; static const disableEnvs = "/api/envs/disable";
static const ENABLE_ENVS = "/api/envs/enable"; static const enableEnvs = "/api/envs/enable";
static INTIME_LOG(String cronId) { static intimeLog(String cronId) {
return "/api/crons/$cronId/log"; return "/api/crons/$cronId/log";
} }
static envMove(String envId) {
return "/api/envs/$envId/move";
}
} }

View File

@@ -9,19 +9,19 @@ import 'package:qinglong_app/module/task/add_task_page.dart';
import 'package:qinglong_app/module/task/task_bean.dart'; import 'package:qinglong_app/module/task/task_bean.dart';
class Routes { class Routes {
static const String route_HomePage = "/home/homepage"; static const String routeHomePage = "/home/homepage";
static const String route_LOGIN = "/login"; static const String routeLogin = "/login";
static const String route_AddTask = "/task/add"; static const String routeAddTask = "/task/add";
static const String route_AddEnv = "/env/add"; static const String routeAddEnv = "/env/add";
static const String route_ConfigEdit = "/config/edit"; static const String routeConfigEdit = "/config/edit";
static Route<dynamic>? generateRoute(RouteSettings settings) { static Route<dynamic>? generateRoute(RouteSettings settings) {
switch (settings.name) { switch (settings.name) {
case route_HomePage: case routeHomePage:
return MaterialPageRoute(builder: (context) => const HomePage()); return MaterialPageRoute(builder: (context) => const HomePage());
case route_LOGIN: case routeLogin:
return MaterialPageRoute(builder: (context) => const LoginPage()); return MaterialPageRoute(builder: (context) => const LoginPage());
case route_AddTask: case routeAddTask:
if (settings.arguments != null) { if (settings.arguments != null) {
return CupertinoPageRoute( return CupertinoPageRoute(
builder: (context) => AddTaskPage( builder: (context) => AddTaskPage(
@@ -30,7 +30,7 @@ class Routes {
} else { } else {
return CupertinoPageRoute(builder: (context) => const AddTaskPage()); return CupertinoPageRoute(builder: (context) => const AddTaskPage());
} }
case route_AddEnv: case routeAddEnv:
if (settings.arguments != null) { if (settings.arguments != null) {
return CupertinoPageRoute( return CupertinoPageRoute(
builder: (context) => AddEnvPage( builder: (context) => AddEnvPage(
@@ -39,7 +39,7 @@ class Routes {
} else { } else {
return CupertinoPageRoute(builder: (context) => const AddEnvPage()); return CupertinoPageRoute(builder: (context) => const AddEnvPage());
} }
case route_ConfigEdit: case routeConfigEdit:
return CupertinoPageRoute( return CupertinoPageRoute(
builder: (context) => ConfigEditPage( builder: (context) => ConfigEditPage(
(settings.arguments as Map)["title"], (settings.arguments as Map)["title"],

View File

@@ -1,3 +1,3 @@
String sp_UserINfo = "userinfo"; String sp_UserINfo = "userinfo";
String sp_Host = "host"; String sp_Host = "host";
String sp_Theme = "dart_mode"; String sp_Theme = "dart_mode";

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
///tabbar样式下方横条固定宽度 ///tabbar样式下方横条固定宽度
class AbsUnderlineTabIndicator extends Decoration { class AbsUnderlineTabIndicator extends Decoration {
const AbsUnderlineTabIndicator({ const AbsUnderlineTabIndicator({
@@ -44,7 +43,8 @@ class AbsUnderlineTabIndicator extends Decoration {
} }
class _UnderlinePainter extends BoxPainter { class _UnderlinePainter extends BoxPainter {
_UnderlinePainter(this.decoration, VoidCallback? onChanged) : super(onChanged); _UnderlinePainter(this.decoration, VoidCallback? onChanged)
: super(onChanged);
final AbsUnderlineTabIndicator decoration; final AbsUnderlineTabIndicator decoration;
@@ -56,7 +56,11 @@ class _UnderlinePainter extends BoxPainter {
final Rect indicator = insets!.resolve(textDirection).deflateRect(rect); final Rect indicator = insets!.resolve(textDirection).deflateRect(rect);
//取中间坐标 //取中间坐标
double cw = (indicator.left + indicator.right) / 2; double cw = (indicator.left + indicator.right) / 2;
return Rect.fromLTWH(cw - decoration.wantWidth! / 2, indicator.bottom - borderSide!.width, decoration.wantWidth!, borderSide!.width); return Rect.fromLTWH(
cw - decoration.wantWidth! / 2,
indicator.bottom - borderSide!.width,
decoration.wantWidth!,
borderSide!.width);
} }
@override @override
@@ -64,8 +68,9 @@ class _UnderlinePainter extends BoxPainter {
assert(configuration.size != null); assert(configuration.size != null);
final Rect rect = offset & configuration.size!; final Rect rect = offset & configuration.size!;
final TextDirection textDirection = configuration.textDirection!; final TextDirection textDirection = configuration.textDirection!;
final Rect indicator = _indicatorRectFor(rect, textDirection).deflate(borderSide!.width / 2.0); final Rect indicator =
_indicatorRectFor(rect, textDirection).deflate(borderSide!.width / 2.0);
final Paint paint = borderSide!.toPaint()..strokeCap = StrokeCap.round; final Paint paint = borderSide!.toPaint()..strokeCap = StrokeCap.round;
canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, paint); canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, paint);
} }
} }

View File

@@ -7,7 +7,7 @@ class EmptyWidget extends ConsumerWidget {
const EmptyWidget({Key? key}) : super(key: key); const EmptyWidget({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context,WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return Center( return Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -16,7 +16,7 @@ class EmptyWidget extends ConsumerWidget {
"暂无数据", "暂无数据",
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color:ref.watch(themeProvider).themeColor.descColor(), color: ref.watch(themeProvider).themeColor.descColor(),
), ),
), ),
], ],

View File

@@ -19,7 +19,7 @@ class QLCupertinoContextMenuAction extends StatefulWidget {
this.isDestructiveAction = false, this.isDestructiveAction = false,
this.onPressed, this.onPressed,
this.trailingIcon, this.trailingIcon,
}) : assert(child != null), }) : assert(child != null),
assert(isDefaultAction != null), assert(isDefaultAction != null),
assert(isDestructiveAction != null), assert(isDestructiveAction != null),
super(key: key); super(key: key);
@@ -45,10 +45,12 @@ class QLCupertinoContextMenuAction extends StatefulWidget {
final IconData? trailingIcon; final IconData? trailingIcon;
@override @override
State<QLCupertinoContextMenuAction> createState() => _QLCupertinoContextMenuActionState(); State<QLCupertinoContextMenuAction> createState() =>
_QLCupertinoContextMenuActionState();
} }
class _QLCupertinoContextMenuActionState extends State<QLCupertinoContextMenuAction> { class _QLCupertinoContextMenuActionState
extends State<QLCupertinoContextMenuAction> {
static const Color _kBackgroundColor = Color(0xFFEEEEEE); static const Color _kBackgroundColor = Color(0xFFEEEEEE);
static const Color _kBackgroundColorPressed = Color(0xFFDDDDDD); static const Color _kBackgroundColorPressed = Color(0xFFDDDDDD);
static const double _kButtonHeight = 30.0; static const double _kButtonHeight = 30.0;
@@ -96,7 +98,6 @@ class _QLCupertinoContextMenuActionState extends State<QLCupertinoContextMenuAct
return _kActionSheetActionStyle; return _kActionSheetActionStyle;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(

View File

@@ -8,7 +8,7 @@ class UserInfoViewModel {
UserInfoViewModel() { UserInfoViewModel() {
String userInfoJson = SpUtil.getString(sp_UserINfo); String userInfoJson = SpUtil.getString(sp_UserINfo);
_host = SpUtil.getString(sp_Host,defValue: "http://49.234.59.95:5700"); _host = SpUtil.getString(sp_Host, defValue: "http://49.234.59.95:5700");
if (userInfoJson.isNotEmpty) { if (userInfoJson.isNotEmpty) {
_token = userInfoJson; _token = userInfoJson;
} }

View File

@@ -1,4 +1,4 @@
import 'package:json_conversion_annotation/json_conversion_annotation.dart'; import 'package:json_conversion_annotation/json_conversion_annotation.dart';
@JsonConversionTarget() @JsonConversionTarget()
class Json{} class Json {}

View File

@@ -6,10 +6,8 @@ import 'package:qinglong_app/module/login/login_bean.dart';
import 'package:qinglong_app/module/task/task_bean.dart'; import 'package:qinglong_app/module/task/task_bean.dart';
import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart'; import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
class JsonConversion$Json { class JsonConversion$Json {
static M fromJson<M>(dynamic json) {
static M fromJson<M>(dynamic json) {
if (json is List) { if (json is List) {
return _getListChildType<M>(json); return _getListChildType<M>(json);
} else { } else {
@@ -18,53 +16,57 @@ class JsonConversion$Json {
} }
static M _fromJsonSingle<M>(dynamic json) { static M _fromJsonSingle<M>(dynamic json) {
String type = M.toString(); String type = M.toString();
if(type == (ConfigBean).toString()){ if (type == (ConfigBean).toString()) {
return ConfigBean.jsonConversion(json) as M; return ConfigBean.jsonConversion(json) as M;
} }
if(type == (EnvBean).toString()){ if (type == (EnvBean).toString()) {
return EnvBean.jsonConversion(json) as M; return EnvBean.jsonConversion(json) as M;
} }
if(type == (LoginBean).toString()){ if (type == (LoginBean).toString()) {
return LoginBean.jsonConversion(json) as M; return LoginBean.jsonConversion(json) as M;
} }
if(type == (TaskBean).toString()){ if (type == (TaskBean).toString()) {
return TaskBean.jsonConversion(json) as M; return TaskBean.jsonConversion(json) as M;
} }
if(type == (TaskDetailBean).toString()){ if (type == (TaskDetailBean).toString()) {
return TaskDetailBean.jsonConversion(json) as M; return TaskDetailBean.jsonConversion(json) as M;
} }
throw Exception("not found"); throw Exception("not found");
} }
static M _getListChildType<M>(List<dynamic> data) { static M _getListChildType<M>(List<dynamic> data) {
if(<ConfigBean>[] is M){ if (<ConfigBean>[] is M) {
return data.map<ConfigBean>((e) => ConfigBean.jsonConversion(e)).toList() as M; return data.map<ConfigBean>((e) => ConfigBean.jsonConversion(e)).toList()
as M;
} }
if(<EnvBean>[] is M){ if (<EnvBean>[] is M) {
return data.map<EnvBean>((e) => EnvBean.jsonConversion(e)).toList() as M; return data.map<EnvBean>((e) => EnvBean.jsonConversion(e)).toList() as M;
} }
if(<LoginBean>[] is M){ if (<LoginBean>[] is M) {
return data.map<LoginBean>((e) => LoginBean.jsonConversion(e)).toList() as M; return data.map<LoginBean>((e) => LoginBean.jsonConversion(e)).toList()
as M;
} }
if(<TaskBean>[] is M){ if (<TaskBean>[] is M) {
return data.map<TaskBean>((e) => TaskBean.jsonConversion(e)).toList() as M; return data.map<TaskBean>((e) => TaskBean.jsonConversion(e)).toList()
as M;
} }
if(<TaskDetailBean>[] is M){ if (<TaskDetailBean>[] is M) {
return data.map<TaskDetailBean>((e) => TaskDetailBean.jsonConversion(e)).toList() as M; return data
.map<TaskDetailBean>((e) => TaskDetailBean.jsonConversion(e))
.toList() as M;
} }
throw Exception("not found"); throw Exception("not found");
} }
} }

View File

@@ -35,7 +35,8 @@ void main() async {
), ),
); );
if (Platform.isAndroid) { if (Platform.isAndroid) {
SystemUiOverlayStyle style = const SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemUiOverlayStyle style =
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(style); SystemChrome.setSystemUIOverlayStyle(style);
} }
} }
@@ -60,7 +61,9 @@ class MyApp extends ConsumerWidget {
home: Builder( home: Builder(
builder: (context) { builder: (context) {
showDebugBtn(context, btnColor: Colors.blue); showDebugBtn(context, btnColor: Colors.blue);
return getIt<UserInfoViewModel>().isLogined() ? const HomePage() : LoginPage(); return getIt<UserInfoViewModel>().isLogined()
? const HomePage()
: LoginPage();
}, },
), ),
// home: LoginPage(), // home: LoginPage(),

View File

@@ -0,0 +1 @@

View File

@@ -2,7 +2,6 @@ import 'package:json_conversion_annotation/json_conversion_annotation.dart';
@JsonConversion() @JsonConversion()
class ConfigBean { class ConfigBean {
String? title; String? title;
String? value; String? value;
@@ -19,6 +18,7 @@ class ConfigBean {
data['value'] = this.value; data['value'] = this.value;
return data; return data;
} }
static ConfigBean jsonConversion(Map<String, dynamic> json) { static ConfigBean jsonConversion(Map<String, dynamic> json) {
return ConfigBean.fromJson(json); return ConfigBean.fromJson(json);
} }

View File

@@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qinglong_app/base/common_dialog.dart';
import 'package:qinglong_app/base/http/api.dart'; import 'package:qinglong_app/base/http/api.dart';
import 'package:qinglong_app/base/http/http.dart'; import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/base/ql_app_bar.dart'; import 'package:qinglong_app/base/ql_app_bar.dart';
import 'package:qinglong_app/base/theme.dart'; import 'package:qinglong_app/base/theme.dart';
import 'package:qinglong_app/module/config/config_viewmodel.dart'; import 'package:qinglong_app/module/config/config_viewmodel.dart';
import 'package:qinglong_app/utils/extension.dart';
class ConfigEditPage extends ConsumerStatefulWidget { class ConfigEditPage extends ConsumerStatefulWidget {
final String content; final String content;
@@ -41,15 +41,16 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
InkWell( InkWell(
onTap: () async { onTap: () async {
if (value == null) { if (value == null) {
failDialog(context, "请先点击保存"); "请先点击保存".toast();
return; return;
} }
HttpResponse<NullResponse> response = await Api.saveFile(widget.title, _controller.text); HttpResponse<NullResponse> response =
await Api.saveFile(widget.title, _controller.text);
if (response.success) { if (response.success) {
ref.read(configProvider).loadContent(widget.title); ref.read(configProvider).loadContent(widget.title);
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
failDialog(context, response.message ?? ""); (response.message ?? "").toast();
} }
}, },
child: const Padding( child: const Padding(

View File

@@ -16,7 +16,8 @@ class ConfigPage extends StatefulWidget {
ConfigPageState createState() => ConfigPageState(); ConfigPageState createState() => ConfigPageState();
} }
class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMixin { class ConfigPageState extends State<ConfigPage>
with SingleTickerProviderStateMixin {
TabController? _tabController; TabController? _tabController;
@override @override
@@ -28,7 +29,8 @@ class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMi
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseStateWidget<ConfigViewModel>( return BaseStateWidget<ConfigViewModel>(
builder: (ref, model, child) { builder: (ref, model, child) {
_tabController ??= TabController(length: model.list.length, vsync: this); _tabController ??=
TabController(length: model.list.length, vsync: this);
return Column( return Column(
children: [ children: [
@@ -60,7 +62,10 @@ class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMi
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 15, horizontal: 15,
), ),
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(), theme: ref
.watch(themeProvider)
.themeColor
.codeEditorTheme(),
tabSize: 14, tabSize: 14,
), ),
), ),
@@ -80,9 +85,10 @@ class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMi
void editMe(WidgetRef ref) { void editMe(WidgetRef ref) {
if (_tabController == null || _tabController!.length == 0) return; if (_tabController == null || _tabController!.length == 0) return;
navigatorState.currentState?.pushNamed(Routes.route_ConfigEdit, arguments: { navigatorState.currentState?.pushNamed(Routes.routeConfigEdit, arguments: {
"title": ref.read(configProvider).list[_tabController?.index ?? 0].title, "title": ref.read(configProvider).list[_tabController?.index ?? 0].title,
"content": ref.read(configProvider).content[ref.read(configProvider).list[_tabController?.index ?? 0].title] "content": ref.read(configProvider).content[
ref.read(configProvider).list[_tabController?.index ?? 0].title]
}); });
} }
} }

View File

@@ -1,14 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qinglong_app/base/common_dialog.dart';
import 'package:qinglong_app/base/http/api.dart'; import 'package:qinglong_app/base/http/api.dart';
import 'package:qinglong_app/base/http/http.dart'; import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/base/ql_app_bar.dart'; import 'package:qinglong_app/base/ql_app_bar.dart';
import 'package:qinglong_app/module/env/env_bean.dart'; import 'package:qinglong_app/module/env/env_bean.dart';
import 'package:qinglong_app/module/env/env_viewmodel.dart'; import 'package:qinglong_app/module/env/env_viewmodel.dart';
import 'package:qinglong_app/module/task/task_bean.dart'; import 'package:qinglong_app/utils/extension.dart';
import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
import 'package:qinglong_app/module/task/task_viewmodel.dart';
class AddEnvPage extends ConsumerStatefulWidget { class AddEnvPage extends ConsumerStatefulWidget {
final EnvBean? taskBean; final EnvBean? taskBean;
@@ -180,11 +177,11 @@ class _AddEnvPageState extends ConsumerState<AddEnvPage> {
void submit() async { void submit() async {
if (_nameController.text.isEmpty) { if (_nameController.text.isEmpty) {
failDialog(context, "名称不能为空"); "名称不能为空".toast();
return; return;
} }
if (_valueController.text.isEmpty) { if (_valueController.text.isEmpty) {
failDialog(context, "值不能为空"); "值不能为空".toast();
return; return;
} }
@@ -196,12 +193,11 @@ class _AddEnvPageState extends ConsumerState<AddEnvPage> {
id: envBean.sId); id: envBean.sId);
if (response.success) { if (response.success) {
successDialog(context, "操作成功").then((value) { "操作成功".toast();
ref.read(envProvider).updateEnv(envBean); ref.read(envProvider).updateEnv(envBean);
Navigator.of(context).pop(); Navigator.of(context).pop();
});
} else { } else {
failDialog(context, response.message ?? ""); (response.message ?? "").toast();
} }
} }
} }

View File

@@ -12,12 +12,12 @@ class EnvBean {
EnvBean( EnvBean(
{this.value, {this.value,
this.sId, this.sId,
this.created, this.created,
this.status, this.status,
this.timestamp, this.timestamp,
this.name, this.name,
this.remarks}); this.remarks});
EnvBean.fromJson(Map<String, dynamic> json) { EnvBean.fromJson(Map<String, dynamic> json) {
value = json['value']; value = json['value'];
@@ -40,7 +40,8 @@ class EnvBean {
data['remarks'] = this.remarks; data['remarks'] = this.remarks;
return data; return data;
} }
static EnvBean jsonConversion(Map<String, dynamic> json) { static EnvBean jsonConversion(Map<String, dynamic> json) {
return EnvBean.fromJson(json); return EnvBean.fromJson(json);
} }
} }

View File

@@ -1,17 +1,16 @@
import 'dart:io'; import 'dart:io';
import 'package:drag_and_drop_lists/drag_and_drop_lists.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:qinglong_app/base/base_state_widget.dart'; import 'package:qinglong_app/base/base_state_widget.dart';
import 'package:qinglong_app/base/common_dialog.dart';
import 'package:qinglong_app/base/routes.dart'; import 'package:qinglong_app/base/routes.dart';
import 'package:qinglong_app/base/theme.dart'; import 'package:qinglong_app/base/theme.dart';
import 'package:qinglong_app/base/ui/empty_widget.dart'; import 'package:qinglong_app/base/ui/empty_widget.dart';
import 'package:qinglong_app/module/env/env_bean.dart'; import 'package:qinglong_app/module/env/env_bean.dart';
import 'package:qinglong_app/module/env/env_viewmodel.dart'; import 'package:qinglong_app/module/env/env_viewmodel.dart';
import 'package:qinglong_app/utils/extension.dart';
class EnvPage extends StatefulWidget { class EnvPage extends StatefulWidget {
const EnvPage({Key? key}) : super(key: key); const EnvPage({Key? key}) : super(key: key);
@@ -50,14 +49,12 @@ class _EnvPageState extends State<EnvPage> {
return model.loadData(false); return model.loadData(false);
}, },
child: ReorderableListView( child: ReorderableListView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag, keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
header: searchCell(ref), header: searchCell(ref),
onReorder: (int oldIndex, int newIndex) { onReorder: (int oldIndex, int newIndex) {
if (list.length != model.list.length) { if (list.length != model.list.length) {
WidgetsBinding.instance "请先清空搜索关键词".toast();
?.addPostFrameCallback((timeStamp) {
failDialog(context, "请先清空搜索关键词");
});
return; return;
} }
@@ -68,7 +65,7 @@ class _EnvPageState extends State<EnvPage> {
} }
final EnvBean item = model.list.removeAt(oldIndex); final EnvBean item = model.list.removeAt(oldIndex);
model.list.insert(newIndex, item); model.list.insert(newIndex, item);
model.update(); model.update(item.sId ?? "", newIndex, oldIndex);
}); });
}, },
children: list, children: list,
@@ -146,7 +143,7 @@ class EnvItemCell extends StatelessWidget {
flex: 1, flex: 1,
onPressed: (_) { onPressed: (_) {
Navigator.of(context) Navigator.of(context)
.pushNamed(Routes.route_AddEnv, arguments: bean); .pushNamed(Routes.routeAddEnv, arguments: bean);
}, },
foregroundColor: Colors.white, foregroundColor: Colors.white,
icon: CupertinoIcons.pencil, icon: CupertinoIcons.pencil,

View File

@@ -19,7 +19,6 @@ class EnvViewModel extends BaseViewModel {
if (result.success && result.bean != null) { if (result.success && result.bean != null) {
list.clear(); list.clear();
list.addAll(result.bean!); list.addAll(result.bean!);
sortList();
success(); success();
} else { } else {
list.clear(); list.clear();
@@ -27,12 +26,6 @@ class EnvViewModel extends BaseViewModel {
} }
} }
void sortList() {
list.sort((a, b) {
return a.status!.compareTo(b.status!);
});
}
Future<void> delEnv(String id) async { Future<void> delEnv(String id) async {
HttpResponse<NullResponse> result = await Api.delEnv(id); HttpResponse<NullResponse> result = await Api.delEnv(id);
if (result.success) { if (result.success) {
@@ -61,7 +54,6 @@ class EnvViewModel extends BaseViewModel {
if (response.success) { if (response.success) {
list.firstWhere((element) => element.sId == sId).status = 0; list.firstWhere((element) => element.sId == sId).status = 0;
sortList();
success(); success();
} else { } else {
failToast(response.message, notify: true); failToast(response.message, notify: true);
@@ -71,14 +63,15 @@ class EnvViewModel extends BaseViewModel {
if (response.success) { if (response.success) {
list.firstWhere((element) => element.sId == sId).status = 1; list.firstWhere((element) => element.sId == sId).status = 1;
sortList();
success(); success();
} else { } else {
failToast(response.message, notify: true); failToast(response.message, notify: true);
} }
} }
} }
void update(){
// update void update(String id, int newIndex, int oldIndex) async {
await Api.moveEnv(id, oldIndex, newIndex);
loadData(false);
} }
} }

View File

@@ -38,7 +38,7 @@ class _HomePageState extends ConsumerState<HomePage> {
actions.add(InkWell( actions.add(InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
Routes.route_AddTask, Routes.routeAddTask,
); );
}, },
child: const Padding( child: const Padding(
@@ -58,7 +58,7 @@ class _HomePageState extends ConsumerState<HomePage> {
actions.add(InkWell( actions.add(InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
Routes.route_AddEnv, Routes.routeAddEnv,
); );
}, },
child: const Padding( child: const Padding(

View File

@@ -11,11 +11,11 @@ class LoginBean {
LoginBean( LoginBean(
{this.token, {this.token,
this.lastip, this.lastip,
this.lastaddr, this.lastaddr,
this.lastlogon, this.lastlogon,
this.retries, this.retries,
this.platform}); this.platform});
LoginBean.fromJson(Map<String, dynamic> json) { LoginBean.fromJson(Map<String, dynamic> json) {
token = json['token']; token = json['token'];
@@ -36,6 +36,7 @@ class LoginBean {
data['platform'] = this.platform; data['platform'] = this.platform;
return data; return data;
} }
static LoginBean jsonConversion(Map<String, dynamic> json) { static LoginBean jsonConversion(Map<String, dynamic> json) {
return LoginBean.fromJson(json); return LoginBean.fromJson(json);
} }

View File

@@ -1,13 +1,13 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qinglong_app/base/common_dialog.dart';
import 'package:qinglong_app/base/http/api.dart'; import 'package:qinglong_app/base/http/api.dart';
import 'package:qinglong_app/base/http/http.dart'; import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/base/routes.dart'; import 'package:qinglong_app/base/routes.dart';
import 'package:qinglong_app/base/theme.dart'; import 'package:qinglong_app/base/theme.dart';
import 'package:qinglong_app/base/userinfo_viewmodel.dart'; import 'package:qinglong_app/base/userinfo_viewmodel.dart';
import 'package:qinglong_app/main.dart'; import 'package:qinglong_app/main.dart';
import 'package:qinglong_app/utils/extension.dart';
import 'package:qinglong_app/utils/utils.dart'; import 'package:qinglong_app/utils/utils.dart';
import 'login_bean.dart'; import 'login_bean.dart';
@@ -180,24 +180,24 @@ class _LoginPageState extends ConsumerState<LoginPage> {
isLoading, isLoading,
child: CupertinoButton( child: CupertinoButton(
color: (_hostController.text.isNotEmpty && color: (_hostController.text.isNotEmpty &&
_userNameController.text.isNotEmpty && _userNameController.text.isNotEmpty &&
_passwordController.text.isNotEmpty && _passwordController.text.isNotEmpty &&
!isLoading) !isLoading)
? ref ? ref
.watch(themeProvider) .watch(themeProvider)
.themeColor .themeColor
.buttonBgColor() .buttonBgColor()
: Theme.of(context) : Theme.of(context)
.primaryColor .primaryColor
.withOpacity(0.4), .withOpacity(0.4),
child: isLoading child: isLoading
? const CupertinoActivityIndicator() ? const CupertinoActivityIndicator()
: const Text( : const Text(
"登 录", "登 录",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
), ),
), ),
onPressed: () { onPressed: () {
Http.pushedLoginPage = false; Http.pushedLoginPage = false;
Utils.hideKeyBoard(context); Utils.hideKeyBoard(context);
@@ -227,9 +227,9 @@ class _LoginPageState extends ConsumerState<LoginPage> {
HttpResponse<LoginBean> response = await Api.login(userName, password); HttpResponse<LoginBean> response = await Api.login(userName, password);
if (response.success) { if (response.success) {
getIt<UserInfoViewModel>().updateToken(response.bean?.token ?? ""); getIt<UserInfoViewModel>().updateToken(response.bean?.token ?? "");
Navigator.of(context).pushReplacementNamed(Routes.route_HomePage); Navigator.of(context).pushReplacementNamed(Routes.routeHomePage);
} else { } else {
failDialog(context, response.message ?? "请检查网络情况"); (response.message ?? "请检查网络情况").toast();
isLoading = false; isLoading = false;
setState(() {}); setState(() {});
} }

View File

@@ -213,7 +213,8 @@ class _OtherPageState extends ConsumerState<OtherPage> {
), ),
onPressed: () { onPressed: () {
getIt<UserInfoViewModel>().updateToken(""); getIt<UserInfoViewModel>().updateToken("");
Navigator.of(context).pushReplacementNamed(Routes.route_LOGIN); Navigator.of(context)
.pushReplacementNamed(Routes.routeLogin);
}), }),
), ),
), ),

View File

@@ -1,12 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qinglong_app/base/common_dialog.dart';
import 'package:qinglong_app/base/http/api.dart'; import 'package:qinglong_app/base/http/api.dart';
import 'package:qinglong_app/base/http/http.dart'; import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/base/ql_app_bar.dart'; import 'package:qinglong_app/base/ql_app_bar.dart';
import 'package:qinglong_app/module/task/task_bean.dart'; import 'package:qinglong_app/module/task/task_bean.dart';
import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart'; import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
import 'package:qinglong_app/module/task/task_viewmodel.dart'; import 'package:qinglong_app/module/task/task_viewmodel.dart';
import 'package:qinglong_app/utils/extension.dart';
class AddTaskPage extends ConsumerStatefulWidget { class AddTaskPage extends ConsumerStatefulWidget {
final TaskBean? taskBean; final TaskBean? taskBean;
@@ -180,15 +180,15 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
void submit() async { void submit() async {
if (_nameController.text.isEmpty) { if (_nameController.text.isEmpty) {
failDialog(context, "任务名称不能为空"); "任务名称不能为空".toast();
return; return;
} }
if (_commandController.text.isEmpty) { if (_commandController.text.isEmpty) {
failDialog(context, "命令不能为空"); "命令不能为空".toast();
return; return;
} }
if (_cronController.text.isEmpty) { if (_cronController.text.isEmpty) {
failDialog(context, "定时不能为空"); "定时不能为空".toast();
return; return;
} }
@@ -200,12 +200,11 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
id: taskBean.sId); id: taskBean.sId);
if (response.success) { if (response.success) {
successDialog(context, "操作成功").then((value) { "操作成功".toast();
ref.read(taskProvider).updateBean(taskBean); ref.read(taskProvider).updateBean(taskBean);
Navigator.of(context).pop(); Navigator.of(context).pop();
});
} else { } else {
failDialog(context, response.message ?? ""); response.message.toast();
} }
} }
} }

View File

@@ -9,7 +9,8 @@ class InTimeLogPage extends StatefulWidget {
final String cronId; final String cronId;
final bool needTimer; final bool needTimer;
const InTimeLogPage(this.cronId, this.needTimer, {Key? key}) : super(key: key); const InTimeLogPage(this.cronId, this.needTimer, {Key? key})
: super(key: key);
@override @override
_InTimeLogPageState createState() => _InTimeLogPageState(); _InTimeLogPageState createState() => _InTimeLogPageState();

View File

@@ -17,17 +17,17 @@ class TaskDetailBean {
TaskDetailBean( TaskDetailBean(
{this.name, {this.name,
this.command, this.command,
this.schedule, this.schedule,
this.saved, this.saved,
this.sId, this.sId,
this.created, this.created,
this.status, this.status,
this.timestamp, this.timestamp,
this.isSystem, this.isSystem,
this.isDisabled, this.isDisabled,
this.logPath, this.logPath,
this.isPinned}); this.isPinned});
TaskDetailBean.fromJson(Map<String, dynamic> json) { TaskDetailBean.fromJson(Map<String, dynamic> json) {
name = json['name']; name = json['name'];

View File

@@ -27,7 +27,7 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
builder: (WidgetRef context, TaskDetailViewModel value, Widget? child) { builder: (WidgetRef context, TaskDetailViewModel value, Widget? child) {
return Container(); return Container();
}, },
onReady: (model){ onReady: (model) {
model.loadDetail(widget.taskBean.sId!); model.loadDetail(widget.taskBean.sId!);
}, },
), ),

View File

@@ -4,7 +4,8 @@ import 'package:qinglong_app/base/http/api.dart';
import 'package:qinglong_app/base/http/http.dart'; import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart'; import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
var taskDetailProvider = AutoDisposeChangeNotifierProvider<TaskDetailViewModel>((ref) { var taskDetailProvider =
AutoDisposeChangeNotifierProvider<TaskDetailViewModel>((ref) {
return TaskDetailViewModel(); return TaskDetailViewModel();
}); });

View File

@@ -196,7 +196,7 @@ class TaskItemCell extends StatelessWidget {
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context) Navigator.of(context)
.pushNamed(Routes.route_AddTask, arguments: bean); .pushNamed(Routes.routeAddTask, arguments: bean);
}, },
trailingIcon: CupertinoIcons.pencil_outline, trailingIcon: CupertinoIcons.pencil_outline,
), ),
@@ -435,7 +435,7 @@ class TaskItemCell extends StatelessWidget {
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
Navigator.of(context) Navigator.of(context)
.pushNamed(Routes.route_AddTask, arguments: bean); .pushNamed(Routes.routeAddTask, arguments: bean);
}, },
), ),
CupertinoActionSheetAction( CupertinoActionSheetAction(

View File

@@ -7,7 +7,7 @@ class QlNavigatorObserver extends NavigatorObserver {
@override @override
void didPush(Route route, Route? previousRoute) { void didPush(Route route, Route? previousRoute) {
super.didPush(route, previousRoute); super.didPush(route, previousRoute);
if (Routes.route_LOGIN == route.settings.name) { if (Routes.routeLogin == route.settings.name) {
isInLoginPage = true; isInLoginPage = true;
} else { } else {
isInLoginPage = false; isInLoginPage = false;

View File

@@ -1,14 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
const qinglongLightTheme = { const qinglongLightTheme = {
'root': 'root':
TextStyle(color: Color(0xff333333), backgroundColor: Color(0xffffffff)), TextStyle(color: Color(0xff333333), backgroundColor: Color(0xffffffff)),
'comment': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic), 'comment': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'quote': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic), 'quote': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'keyword': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold), 'keyword': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'selector-tag': 'selector-tag':
TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold), TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'subst': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.normal), 'subst': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.normal),
'number': TextStyle(color: Color(0xff008080)), 'number': TextStyle(color: Color(0xff008080)),
'literal': TextStyle(color: Color(0xff008080)), 'literal': TextStyle(color: Color(0xff008080)),
@@ -19,12 +18,12 @@ const qinglongLightTheme = {
'title': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold), 'title': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'section': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold), 'section': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'selector-id': 'selector-id':
TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold), TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'type': TextStyle(color: Color(0xff445588), fontWeight: FontWeight.bold), 'type': TextStyle(color: Color(0xff445588), fontWeight: FontWeight.bold),
'tag': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal), 'tag': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'name': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal), 'name': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'attribute': 'attribute':
TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal), TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'regexp': TextStyle(color: Color(0xff009926)), 'regexp': TextStyle(color: Color(0xff009926)),
'link': TextStyle(color: Color(0xff009926)), 'link': TextStyle(color: Color(0xff009926)),
'symbol': TextStyle(color: Color(0xff990073)), 'symbol': TextStyle(color: Color(0xff990073)),
@@ -39,13 +38,12 @@ const qinglongLightTheme = {
}; };
const qinglongDarkTheme = { const qinglongDarkTheme = {
'root': 'root': TextStyle(color: Color(0xff333333), backgroundColor: Colors.black),
TextStyle(color: Color(0xff333333), backgroundColor: Colors.black),
'comment': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic), 'comment': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'quote': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic), 'quote': TextStyle(color: Color(0xff999988), fontStyle: FontStyle.italic),
'keyword': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold), 'keyword': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'selector-tag': 'selector-tag':
TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold), TextStyle(color: Color(0xff333333), fontWeight: FontWeight.bold),
'subst': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.normal), 'subst': TextStyle(color: Color(0xff333333), fontWeight: FontWeight.normal),
'number': TextStyle(color: Color(0xff008080)), 'number': TextStyle(color: Color(0xff008080)),
'literal': TextStyle(color: Color(0xff008080)), 'literal': TextStyle(color: Color(0xff008080)),
@@ -56,12 +54,12 @@ const qinglongDarkTheme = {
'title': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold), 'title': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'section': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold), 'section': TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'selector-id': 'selector-id':
TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold), TextStyle(color: Color(0xff990000), fontWeight: FontWeight.bold),
'type': TextStyle(color: Color(0xff445588), fontWeight: FontWeight.bold), 'type': TextStyle(color: Color(0xff445588), fontWeight: FontWeight.bold),
'tag': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal), 'tag': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'name': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal), 'name': TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'attribute': 'attribute':
TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal), TextStyle(color: Color(0xff000080), fontWeight: FontWeight.normal),
'regexp': TextStyle(color: Color(0xff009926)), 'regexp': TextStyle(color: Color(0xff009926)),
'link': TextStyle(color: Color(0xff009926)), 'link': TextStyle(color: Color(0xff009926)),
'symbol': TextStyle(color: Color(0xff990073)), 'symbol': TextStyle(color: Color(0xff990073)),

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fluttertoast/fluttertoast.dart';
extension ContextExt on BuildContext { extension ContextExt on BuildContext {
T read<T>(ProviderBase<T> provider) { T read<T>(ProviderBase<T> provider) {
@@ -10,3 +11,15 @@ extension ContextExt on BuildContext {
return (this as WidgetRef).watch<T>(provider); return (this as WidgetRef).watch<T>(provider);
} }
} }
extension StringExt on String? {
void toast() {
if (this == null || this!.isEmpty) return;
Fluttertoast.showToast(
msg: this!,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
);
}
}

View File

@@ -56,7 +56,8 @@ class SpUtil {
} }
/// get obj list. /// get obj list.
static List<T>? getObjList<T>(String key, T f(Map v), {List<T> defValue = const []}) { static List<T>? getObjList<T>(String key, T f(Map v),
{List<T> defValue = const []}) {
List<Map>? dataList = getObjectList(key); List<Map>? dataList = getObjectList(key);
List<T>? list = dataList?.map((value) { List<T>? list = dataList?.map((value) {
return f(value); return f(value);
@@ -123,7 +124,8 @@ class SpUtil {
} }
/// get string list. /// get string list.
static List<String> getStringList(String key, {List<String> defValue = const []}) { static List<String> getStringList(String key,
{List<String> defValue = const []}) {
if (_prefs == null) return defValue; if (_prefs == null) return defValue;
return _prefs!.getStringList(key) ?? defValue; return _prefs!.getStringList(key) ?? defValue;
} }
@@ -168,4 +170,4 @@ class SpUtil {
static bool isInitialized() { static bool isInitialized() {
return _prefs != null; return _prefs != null;
} }
} }

View File

@@ -5,238 +5,238 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "22.0.0" version: "22.0.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.7.2" version: "1.7.2"
archive: archive:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.1.8" version: "3.1.8"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.3.0" version: "2.3.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.8.2" version: "2.8.2"
back_button_interceptor: back_button_interceptor:
dependency: "direct main" dependency: "direct main"
description: description:
name: back_button_interceptor name: back_button_interceptor
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.2" version: "5.0.2"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
build: build:
dependency: transitive dependency: transitive
description: description:
name: build name: build
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
build_config: build_config:
dependency: transitive dependency: transitive
description: description:
name: build_config name: build_config
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
build_daemon: build_daemon:
dependency: transitive dependency: transitive
description: description:
name: build_daemon name: build_daemon
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.1" version: "3.0.1"
build_resolvers: build_resolvers:
dependency: transitive dependency: transitive
description: description:
name: build_resolvers name: build_resolvers
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.4" version: "2.0.4"
build_runner: build_runner:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: build_runner name: build_runner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.7" version: "2.1.7"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
name: build_runner_core name: build_runner_core
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "7.2.3" version: "7.2.3"
built_collection: built_collection:
dependency: transitive dependency: transitive
description: description:
name: built_collection name: built_collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.1.1" version: "5.1.1"
built_value: built_value:
dependency: transitive dependency: transitive
description: description:
name: built_value name: built_value
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "8.1.3" version: "8.1.4"
change_app_package_name: change_app_package_name:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: change_app_package_name name: change_app_package_name
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
name: checked_yaml name: checked_yaml
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
cli_util: cli_util:
dependency: transitive dependency: transitive
description: description:
name: cli_util name: cli_util
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.5" version: "0.3.5"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
code_builder: code_builder:
dependency: transitive dependency: transitive
description: description:
name: code_builder name: code_builder
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.1.0" version: "4.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.15.0" version: "1.15.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.1" version: "3.0.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.1" version: "3.0.1"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:
name: dart_style name: dart_style
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
dio: dio:
dependency: "direct main" dependency: "direct main"
description: description:
name: dio name: dio
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.4" version: "4.0.4"
dio_log: dio_log:
dependency: "direct main" dependency: "direct main"
description: description:
name: dio_log name: dio_log
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
drag_and_drop_lists: drag_and_drop_lists:
dependency: "direct main" dependency: "direct main"
description: description:
name: drag_and_drop_lists name: drag_and_drop_lists
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.2+2" version: "0.3.2+2"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.2" version: "1.1.2"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.1.2" version: "6.1.2"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
name: fixnum name: fixnum
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
flutter: flutter:
@@ -248,49 +248,49 @@ packages:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: flutter_app_name name: flutter_app_name
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.1" version: "0.1.1"
flutter_highlight: flutter_highlight:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_highlight name: flutter_highlight
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.7.0" version: "0.7.0"
flutter_launcher_icons: flutter_launcher_icons:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: flutter_launcher_icons name: flutter_launcher_icons
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.9.2" version: "0.9.2"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: flutter_lints name: flutter_lints
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
flutter_native_splash: flutter_native_splash:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: flutter_native_splash name: flutter_native_splash
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.3" version: "1.3.3"
flutter_riverpod: flutter_riverpod:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_riverpod name: flutter_riverpod
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
flutter_slidable: flutter_slidable:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_slidable name: flutter_slidable
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
flutter_test: flutter_test:
@@ -303,312 +303,319 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.flutter-io.cn"
source: hosted
version: "8.0.8"
frontend_server_client: frontend_server_client:
dependency: transitive dependency: transitive
description: description:
name: frontend_server_client name: frontend_server_client
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
get_it: get_it:
dependency: "direct main" dependency: "direct main"
description: description:
name: get_it name: get_it
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "7.2.0" version: "7.2.0"
glob: glob:
dependency: transitive dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
name: graphs name: graphs
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
highlight: highlight:
dependency: transitive dependency: transitive
description: description:
name: highlight name: highlight
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.7.0" version: "0.7.0"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
name: http_multi_server name: http_multi_server
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.1" version: "3.0.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
image: image:
dependency: transitive dependency: transitive
description: description:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.1.1" version: "3.1.1"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
name: intl name: intl
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.17.0" version: "0.17.0"
io: io:
dependency: transitive dependency: transitive
description: description:
name: io name: io
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
js: js:
dependency: transitive dependency: transitive
description: description:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
json_annotation: json_annotation:
dependency: transitive dependency: transitive
description: description:
name: json_annotation name: json_annotation
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.4.0" version: "4.4.0"
json_conversion: json_conversion:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: json_conversion name: json_conversion
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.0.4" version: "0.0.4"
json_conversion_annotation: json_conversion_annotation:
dependency: "direct main" dependency: "direct main"
description: description:
name: json_conversion_annotation name: json_conversion_annotation
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.0.4" version: "0.0.4"
lints: lints:
dependency: transitive dependency: transitive
description: description:
name: lints name: lints
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
logger: logger:
dependency: "direct main" dependency: "direct main"
description: description:
name: logger name: logger
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
logging: logging:
dependency: transitive dependency: transitive
description: description:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.11" version: "0.12.11"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.7.0" version: "1.7.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
name: mime name: mime
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
name: package_config name: package_config
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.5" version: "2.1.5"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.5" version: "2.0.5"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.11.1" version: "1.11.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.4.0" version: "4.4.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.1.0" version: "3.1.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
pool: pool:
dependency: transitive dependency: transitive
description: description:
name: pool name: pool
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.0" version: "1.5.0"
process: process:
dependency: transitive dependency: transitive
description: description:
name: process name: process
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.2.4" version: "4.2.4"
pub_semver: pub_semver:
dependency: transitive dependency: transitive
description: description:
name: pub_semver name: pub_semver
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
pubspec_parse: pubspec_parse:
dependency: transitive dependency: transitive
description: description:
name: pubspec_parse name: pubspec_parse
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
riverpod: riverpod:
dependency: transitive dependency: transitive
description: description:
name: riverpod name: riverpod
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.12" version: "2.0.12"
shared_preferences_android: shared_preferences_android:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_android name: shared_preferences_android
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.10" version: "2.0.10"
shared_preferences_ios: shared_preferences_ios:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_ios name: shared_preferences_ios
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.9" version: "2.0.9"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_linux name: shared_preferences_linux
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.4" version: "2.0.4"
shared_preferences_macos: shared_preferences_macos:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_macos name: shared_preferences_macos
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
shared_preferences_platform_interface: shared_preferences_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_platform_interface name: shared_preferences_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
shared_preferences_web: shared_preferences_web:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_windows name: shared_preferences_windows
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.4" version: "2.0.4"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
name: shelf_web_socket name: shelf_web_socket
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
sky_engine: sky_engine:
@@ -620,140 +627,140 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_gen name: source_gen
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.1" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.10.0" version: "1.10.0"
state_notifier: state_notifier:
dependency: transitive dependency: transitive
description: description:
name: state_notifier name: state_notifier
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.7.1" version: "0.7.2+1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
stream_transform: stream_transform:
dependency: transitive dependency: transitive
description: description:
name: stream_transform name: stream_transform
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
synchronized: synchronized:
dependency: "direct main" dependency: "direct main"
description: description:
name: synchronized name: synchronized
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.4.3" version: "0.4.3"
timing: timing:
dependency: transitive dependency: transitive
description: description:
name: timing name: timing
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
universal_io: universal_io:
dependency: transitive dependency: transitive
description: description:
name: universal_io name: universal_io
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.4" version: "2.0.4"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
name: watcher name: watcher
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:
name: web_socket_channel name: web_socket_channel
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
win32: win32:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.3.3" version: "2.3.6"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.0" version: "0.2.0"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.3.1" version: "5.3.1"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:
name: yaml name: yaml
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.1.0" version: "3.1.0"
sdks: sdks:

View File

@@ -25,6 +25,7 @@ dependencies:
get_it: ^7.2.0 get_it: ^7.2.0
flutter_highlight: ^0.7.0 flutter_highlight: ^0.7.0
drag_and_drop_lists: ^0.3.2+2 drag_and_drop_lists: ^0.3.2+2
fluttertoast: ^8.0.8
dev_dependencies: dev_dependencies:
flutter_native_splash: ^1.3.3 flutter_native_splash: ^1.3.3

View File

@@ -14,7 +14,4 @@ import 'package:qinglong_app/main.dart';
import 'package:qinglong_app/module/login/login_bean.dart'; import 'package:qinglong_app/module/login/login_bean.dart';
import 'package:qinglong_app/module/login/login_viewmodel.dart'; import 'package:qinglong_app/module/login/login_viewmodel.dart';
void main() { void main() {}
}