mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
1.1.0 release
This commit is contained in:
@ -1,22 +1,28 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qinglong_app/base/http/api.dart';
|
||||
import 'package:qinglong_app/base/http/http.dart';
|
||||
import 'package:qinglong_app/base/ui/lazy_load_state.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
class InTimeLogPage extends StatefulWidget {
|
||||
final String cronId;
|
||||
final bool needTimer;
|
||||
final String title;
|
||||
|
||||
const InTimeLogPage(this.cronId, this.needTimer, {Key? key}) : super(key: key);
|
||||
const InTimeLogPage(this.cronId, this.needTimer, this.title, {Key? key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_InTimeLogPageState createState() => _InTimeLogPageState();
|
||||
}
|
||||
|
||||
class _InTimeLogPageState extends State<InTimeLogPage> {
|
||||
class _InTimeLogPageState extends State<InTimeLogPage>
|
||||
with LazyLoadState<InTimeLogPage> {
|
||||
Timer? _timer;
|
||||
|
||||
String? content;
|
||||
@ -24,12 +30,6 @@ class _InTimeLogPageState extends State<InTimeLogPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_timer = Timer.periodic(
|
||||
const Duration(seconds: 2),
|
||||
(timer) {
|
||||
getLogData();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
bool isRequest = false;
|
||||
@ -39,8 +39,8 @@ class _InTimeLogPageState extends State<InTimeLogPage> {
|
||||
if (!canRequest) return;
|
||||
if (isRequest) return;
|
||||
isRequest = true;
|
||||
HttpResponse<String> response = await Api.inTimeLog(widget.cronId);
|
||||
|
||||
HttpResponse<String> response =
|
||||
await Api.inTimeLog(widget.cronId);
|
||||
if (response.success) {
|
||||
content = response.bean;
|
||||
setState(() {});
|
||||
@ -56,22 +56,119 @@ class _InTimeLogPageState extends State<InTimeLogPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Material(
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
vertical: 10,
|
||||
),
|
||||
child: content == null
|
||||
? const Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Icon(
|
||||
CupertinoIcons.chevron_down,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
widget.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Share.share(content ?? "");
|
||||
},
|
||||
child: const Icon(
|
||||
CupertinoIcons.share,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
if (content == null)
|
||||
const Expanded(
|
||||
child: Center(
|
||||
child: CupertinoActivityIndicator(),
|
||||
),
|
||||
)
|
||||
: CupertinoScrollbar(
|
||||
child: SelectableText(
|
||||
else
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
primary: true,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SelectableText(
|
||||
content!,
|
||||
scrollPhysics: const NeverScrollableScrollPhysics(),
|
||||
onSelectionChanged: (TextSelection selection,
|
||||
SelectionChangedCause? cause) {
|
||||
final int newStart = min(
|
||||
selection.baseOffset, selection.extentOffset);
|
||||
final int newEnd = max(
|
||||
selection.baseOffset, selection.extentOffset);
|
||||
if (newEnd == newStart) {
|
||||
canRequest = true;
|
||||
} else {
|
||||
canRequest = false;
|
||||
}
|
||||
},
|
||||
selectionHeightStyle: BoxHeightStyle.max,
|
||||
selectionWidthStyle: BoxWidthStyle.max,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 400,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onLazyLoad() {
|
||||
if (widget.needTimer) {
|
||||
_timer = Timer.periodic(
|
||||
const Duration(seconds: 2),
|
||||
(timer) {
|
||||
getLogData();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
getLogData();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:ui';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||
import 'package:qinglong_app/base/ql_app_bar.dart';
|
||||
import 'package:qinglong_app/base/routes.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
@ -402,30 +403,16 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
|
||||
}
|
||||
|
||||
void showLog() {
|
||||
showCupertinoDialog(
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(
|
||||
"${widget.taskBean.name}运行日志",
|
||||
maxLines: 1,
|
||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
||||
showCupertinoModalBottomSheet(
|
||||
expand: true,
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) => InTimeLogPage(
|
||||
widget.taskBean.sId!,
|
||||
true,
|
||||
widget.taskBean.name ?? "",
|
||||
),
|
||||
content: InTimeLogPage(widget.taskBean.sId!, widget.taskBean.status == 0),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"知道了",
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
ref.read(taskProvider).loadData(false);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
context: context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||
import 'package:qinglong_app/base/base_state_widget.dart';
|
||||
import 'package:qinglong_app/base/routes.dart';
|
||||
import 'package:qinglong_app/base/theme.dart';
|
||||
@ -454,31 +455,16 @@ class TaskItemCell extends StatelessWidget {
|
||||
}
|
||||
|
||||
logCron(BuildContext context, WidgetRef ref) {
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: false,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(
|
||||
"${bean.name}运行日志",
|
||||
maxLines: 1,
|
||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
||||
showCupertinoModalBottomSheet(
|
||||
expand: true,
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) => InTimeLogPage(
|
||||
bean.sId!,
|
||||
true,
|
||||
bean.name ?? "",
|
||||
),
|
||||
content: InTimeLogPage(bean.sId!, bean.status == 0),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
"知道了",
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
ref.read(taskProvider).loadData(false);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
context: context);
|
||||
}
|
||||
|
||||
void enableTask(BuildContext context) {
|
||||
|
||||
49
pubspec.lock
49
pubspec.lock
@ -525,6 +525,13 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
modal_bottom_sheet:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: modal_bottom_sheet
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
move_to_background:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -700,6 +707,48 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
share_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share_plus
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.0.7"
|
||||
share_plus_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_linux
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
share_plus_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_macos
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
share_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_platform_interface
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
share_plus_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_web
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
share_plus_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_windows
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
name: qinglong_app
|
||||
description: A new Flutter project.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
version: 1.0.9+11
|
||||
version: 1.1.0+110
|
||||
|
||||
environment:
|
||||
sdk: ">=2.15.1 <3.0.0"
|
||||
@ -35,7 +35,9 @@ dependencies:
|
||||
flutter_colorpicker: ^1.0.3
|
||||
widget_with_codeview: ^2.0.1+2
|
||||
code_text_field: ^1.0.2
|
||||
share_plus: ^4.0.7
|
||||
flutter_animator: ^3.2.1
|
||||
modal_bottom_sheet: ^2.0.1
|
||||
|
||||
# flutter pub run build_runner build --delete-conflicting-outputs
|
||||
# flutter pub run change_app_package_name:main work.master.qinglongapp
|
||||
|
||||
Reference in New Issue
Block a user