Compare commits
7 Commits
v1.0.9
...
4e3f8a0df9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e3f8a0df9 | ||
|
|
5698277301 | ||
|
|
02be737264 | ||
|
|
9558f3d235 | ||
|
|
14c3b1a965 | ||
|
|
b89de1414a | ||
|
|
9759caf9b8 |
1
.gitignore
vendored
@@ -44,3 +44,4 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
.fvm/
|
||||||
|
Before Width: | Height: | Size: 19 KiB |
BIN
assets/images/dark.png
Normal file
|
After Width: | Height: | Size: 608 B |
BIN
assets/images/faceid.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/figure.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
assets/images/icon_a.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/images/icon_about.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
assets/images/icon_app_set.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/images/icon_b.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
assets/images/icon_check.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/icon_cron.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/images/icon_cron_checked.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/images/icon_d.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
assets/images/icon_default_user.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/images/icon_disabled.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/images/icon_enable.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/images/icon_env.png
Normal file
|
After Width: | Height: | Size: 960 B |
BIN
assets/images/icon_env_checked.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/images/icon_fail.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/images/icon_file.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/images/icon_file_checked.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
assets/images/icon_history.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/images/icon_idle.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets/images/icon_install_fail.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
assets/images/icon_install_success.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/images/icon_login_icon.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/images/icon_other.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/images/icon_other_bg.png
Normal file
|
After Width: | Height: | Size: 400 KiB |
BIN
assets/images/icon_other_checked.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
assets/images/icon_right.png
Normal file
|
After Width: | Height: | Size: 491 B |
BIN
assets/images/icon_running.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets/images/icon_s.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
assets/images/icon_safety.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
assets/images/icon_search.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
assets/images/icon_setting.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
assets/images/icon_subsctibe.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/images/icon_success.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/images/icon_task_disable.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
assets/images/icon_task_log.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/images/icon_uncheck.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/images/icon_vip_bg.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
assets/images/icon_vip_bg_check.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 19 KiB |
BIN
assets/images/light.png
Normal file
|
After Width: | Height: | Size: 863 B |
BIN
assets/images/normal.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 16 KiB |
BIN
assets/images/svip.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/images/svip_logo.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
assets/images/vip.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
assets/images/vip_logo.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 20 KiB |
@@ -29,7 +29,7 @@ class _BaseStateWidgetState<T extends BaseViewModel> extends ConsumerState<BaseS
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
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) {
|
||||||
(viewModel.failedToast ?? "").toast();
|
(viewModel.failedToast ?? "").toast();
|
||||||
viewModel.clearToast();
|
viewModel.clearToast();
|
||||||
});
|
});
|
||||||
@@ -72,7 +72,7 @@ class _BaseStateWidgetState<T extends BaseViewModel> extends ConsumerState<BaseS
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
if (widget.onReady != null && !widget.lazyLoad) {
|
if (widget.onReady != null && !widget.lazyLoad) {
|
||||||
widget.onReady!(ref.read<T>(widget.model));
|
widget.onReady!(ref.read<T>(widget.model));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qinglong_app/module/change_account_page.dart';
|
||||||
import 'package:qinglong_app/module/config/config_edit_page.dart';
|
import 'package:qinglong_app/module/config/config_edit_page.dart';
|
||||||
import 'package:qinglong_app/module/env/add_env_page.dart';
|
import 'package:qinglong_app/module/env/add_env_page.dart';
|
||||||
import 'package:qinglong_app/module/env/env_bean.dart';
|
import 'package:qinglong_app/module/env/env_bean.dart';
|
||||||
@@ -41,6 +42,7 @@ class Routes {
|
|||||||
static const String routeUpdatePassword = "/updatePassword";
|
static const String routeUpdatePassword = "/updatePassword";
|
||||||
static const String routeAbout = "/about";
|
static const String routeAbout = "/about";
|
||||||
static const String routeTheme = "/theme";
|
static const String routeTheme = "/theme";
|
||||||
|
static const String routeChangeAccount = "/changeAccount";
|
||||||
|
|
||||||
static Route<dynamic>? generateRoute(RouteSettings settings) {
|
static Route<dynamic>? generateRoute(RouteSettings settings) {
|
||||||
switch (settings.name) {
|
switch (settings.name) {
|
||||||
@@ -55,91 +57,93 @@ class Routes {
|
|||||||
} else {
|
} else {
|
||||||
return MaterialPageRoute(builder: (context) => const LoginPage());
|
return MaterialPageRoute(builder: (context) => const LoginPage());
|
||||||
}
|
}
|
||||||
|
case routeChangeAccount:
|
||||||
|
return MaterialPageRoute(
|
||||||
|
builder: (context) => const ChangeAccountPage(),
|
||||||
|
);
|
||||||
case routeAddTask:
|
case routeAddTask:
|
||||||
if (settings.arguments != null) {
|
if (settings.arguments != null) {
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => AddTaskPage(
|
builder: (context) => AddTaskPage(
|
||||||
taskBean: settings.arguments as TaskBean,
|
taskBean: settings.arguments as TaskBean,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return CupertinoPageRoute(builder: (context) => const AddTaskPage());
|
return MaterialPageRoute(builder: (context) => const AddTaskPage());
|
||||||
}
|
}
|
||||||
case routeAddDependency:
|
case routeAddDependency:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(builder: (context) => const AddDependencyPage());
|
||||||
builder: (context) => const AddDependencyPage());
|
|
||||||
case routeAddEnv:
|
case routeAddEnv:
|
||||||
if (settings.arguments != null) {
|
if (settings.arguments != null) {
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => AddEnvPage(
|
builder: (context) => AddEnvPage(
|
||||||
envBean: settings.arguments as EnvBean,
|
envBean: settings.arguments as EnvBean,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return CupertinoPageRoute(builder: (context) => const AddEnvPage());
|
return MaterialPageRoute(builder: (context) => const AddEnvPage());
|
||||||
}
|
}
|
||||||
case routeConfigEdit:
|
case routeConfigEdit:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => ConfigEditPage(
|
builder: (context) => ConfigEditPage(
|
||||||
(settings.arguments as Map)["title"],
|
(settings.arguments as Map)["title"],
|
||||||
(settings.arguments as Map)["content"],
|
(settings.arguments as Map)["content"],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case routeLoginLog:
|
case routeLoginLog:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const LoginLogPage(),
|
builder: (context) => const LoginLogPage(),
|
||||||
);
|
);
|
||||||
case routeTaskLog:
|
case routeTaskLog:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const TaskLogPage(),
|
builder: (context) => const TaskLogPage(),
|
||||||
);
|
);
|
||||||
case routeScript:
|
case routeScript:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const ScriptPage(),
|
builder: (context) => const ScriptPage(),
|
||||||
);
|
);
|
||||||
case routeDependency:
|
case routeDependency:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const DependencyPage(),
|
builder: (context) => const DependencyPage(),
|
||||||
);
|
);
|
||||||
case routeTaskLogDetail:
|
case routeTaskLogDetail:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => TaskLogDetailPage(
|
builder: (context) => TaskLogDetailPage(
|
||||||
title: (settings.arguments as Map)['title'],
|
title: (settings.arguments as Map)['title'],
|
||||||
path: (settings.arguments as Map)['path'],
|
path: (settings.arguments as Map)['path'],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case routeScriptDetail:
|
case routeScriptDetail:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => ScriptDetailPage(
|
builder: (context) => ScriptDetailPage(
|
||||||
title: (settings.arguments as Map)["title"],
|
title: (settings.arguments as Map)["title"],
|
||||||
path: (settings.arguments as Map)["path"],
|
path: (settings.arguments as Map)["path"],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case routeTaskDetail:
|
case routeTaskDetail:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => TaskDetailPage(
|
builder: (context) => TaskDetailPage(
|
||||||
settings.arguments as TaskBean,
|
settings.arguments as TaskBean,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case routeEnvDetail:
|
case routeEnvDetail:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => EnvDetailPage(
|
builder: (context) => EnvDetailPage(
|
||||||
settings.arguments as EnvBean,
|
settings.arguments as EnvBean,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case routeUpdatePassword:
|
case routeUpdatePassword:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const UpdatePasswordPage(),
|
builder: (context) => const UpdatePasswordPage(),
|
||||||
);
|
);
|
||||||
case routeAbout:
|
case routeAbout:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const AboutPage(),
|
builder: (context) => const AboutPage(),
|
||||||
);
|
);
|
||||||
case routeTheme:
|
case routeTheme:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => const ThemePage(),
|
builder: (context) => const ThemePage(),
|
||||||
);
|
);
|
||||||
case routeScriptUpdate:
|
case routeScriptUpdate:
|
||||||
return CupertinoPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => ScriptEditPage(
|
builder: (context) => ScriptEditPage(
|
||||||
(settings.arguments as Map)["title"],
|
(settings.arguments as Map)["title"],
|
||||||
(settings.arguments as Map)["path"],
|
(settings.arguments as Map)["path"],
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ThemeViewModel extends ChangeNotifier {
|
|||||||
ThemeViewModel() {
|
ThemeViewModel() {
|
||||||
_primaryColor = Color(getIt<UserInfoViewModel>().primaryColor);
|
_primaryColor = Color(getIt<UserInfoViewModel>().primaryColor);
|
||||||
primaryColor = Color(getIt<UserInfoViewModel>().primaryColor);
|
primaryColor = Color(getIt<UserInfoViewModel>().primaryColor);
|
||||||
var brightness = SchedulerBinding.instance!.window.platformBrightness;
|
var brightness = SchedulerBinding.instance.window.platformBrightness;
|
||||||
_isInDarkMode = brightness == Brightness.dark;
|
_isInDarkMode = brightness == Brightness.dark;
|
||||||
changeThemeReal(_isInDarkMode, false);
|
changeThemeReal(_isInDarkMode, false);
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ class ThemeViewModel extends ChangeNotifier {
|
|||||||
secondary: _primaryColor,
|
secondary: _primaryColor,
|
||||||
primary: _primaryColor,
|
primary: _primaryColor,
|
||||||
),
|
),
|
||||||
scaffoldBackgroundColor: const Color(0xfff5f5f5),
|
scaffoldBackgroundColor: const Color(0xffffffff),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
labelStyle: TextStyle(
|
labelStyle: TextStyle(
|
||||||
color: _primaryColor,
|
color: _primaryColor,
|
||||||
@@ -223,6 +223,8 @@ abstract class ThemeColors {
|
|||||||
|
|
||||||
Color tabBarColor();
|
Color tabBarColor();
|
||||||
|
|
||||||
|
Color blackAndWhite();
|
||||||
|
|
||||||
Color pinColor();
|
Color pinColor();
|
||||||
|
|
||||||
Color buttonBgColor();
|
Color buttonBgColor();
|
||||||
@@ -241,6 +243,11 @@ class LightThemeColors extends ThemeColors {
|
|||||||
return const Color(0xffF7F7F7);
|
return const Color(0xffF7F7F7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color blackAndWhite() {
|
||||||
|
return Colors.white;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, TextStyle> codeEditorTheme() {
|
Map<String, TextStyle> codeEditorTheme() {
|
||||||
return qinglongLightTheme;
|
return qinglongLightTheme;
|
||||||
@@ -288,6 +295,11 @@ class DartThemeColors extends ThemeColors {
|
|||||||
return qinglongDarkTheme;
|
return qinglongDarkTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color blackAndWhite() {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Color descColor() {
|
Color descColor() {
|
||||||
return const Color(0xff999999);
|
return const Color(0xff999999);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ mixin LazyLoadState<T extends StatefulWidget> on State<T> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
var route = ModalRoute.of(context);
|
var route = ModalRoute.of(context);
|
||||||
void handler(status) {
|
void handler(status) {
|
||||||
if (status == AnimationStatus.completed) {
|
if (status == AnimationStatus.completed) {
|
||||||
|
|||||||
69
lib/base/ui/search_cell.dart
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../theme.dart';
|
||||||
|
|
||||||
|
class SearchCell extends ConsumerStatefulWidget {
|
||||||
|
final TextEditingController controller;
|
||||||
|
|
||||||
|
const SearchCell({
|
||||||
|
Key? key,
|
||||||
|
required this.controller,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState createState() => _SearchCellState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SearchCellState extends ConsumerState<SearchCell> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoSearchTextField(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ref.watch(themeProvider).themeColor.blackAndWhite(),
|
||||||
|
border: Border.all(width: 1, color: const Color(0xffC0C4CC)),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
7,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onSuffixTap: () {
|
||||||
|
widget.controller.text = "";
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
controller: widget.controller,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 5,
|
||||||
|
vertical: 5,
|
||||||
|
),
|
||||||
|
suffixInsets: const EdgeInsets.only(
|
||||||
|
right: 15,
|
||||||
|
),
|
||||||
|
prefixIcon: Image.asset(
|
||||||
|
"assets/images/icon_search.png",
|
||||||
|
width: 18,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
prefixInsets: const EdgeInsets.only(
|
||||||
|
left: 10,
|
||||||
|
top: 2,
|
||||||
|
),
|
||||||
|
placeholderStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
placeholder: "请输入内容",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@ class QlAppState extends ConsumerState<QlApp> {
|
|||||||
FocusScope.of(context).requestFocus(FocusNode());
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
},
|
},
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window).copyWith(
|
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window).copyWith(
|
||||||
textScaleFactor: 1,
|
textScaleFactor: 1,
|
||||||
),
|
),
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
|||||||
316
lib/module/change_account_page.dart
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
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:qinglong_app/base/http/api.dart';
|
||||||
|
import 'package:qinglong_app/base/http/http.dart';
|
||||||
|
import 'package:qinglong_app/base/ql_app_bar.dart';
|
||||||
|
import 'package:qinglong_app/base/routes.dart';
|
||||||
|
import 'package:qinglong_app/base/theme.dart';
|
||||||
|
import 'package:qinglong_app/base/userinfo_viewmodel.dart';
|
||||||
|
import 'package:qinglong_app/utils/extension.dart';
|
||||||
|
import 'package:qinglong_app/utils/login_helper.dart';
|
||||||
|
|
||||||
|
import '../../main.dart';
|
||||||
|
|
||||||
|
class ChangeAccountPage extends ConsumerStatefulWidget {
|
||||||
|
const ChangeAccountPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ChangeAccountPageState createState() => _ChangeAccountPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ChangeAccountPageState extends ConsumerState<ChangeAccountPage> {
|
||||||
|
String isLoginingHost = "";
|
||||||
|
String preHost = "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
preHost = getIt<UserInfoViewModel>().historyAccounts.first.host ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: QlAppBar(
|
||||||
|
canBack: true,
|
||||||
|
title: "切换账号",
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height / 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"轻触账号以切换登录",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
fontSize: 22,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (index == getIt<UserInfoViewModel>().historyAccounts.length) {
|
||||||
|
return addAccount();
|
||||||
|
}
|
||||||
|
return ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
child: Container(
|
||||||
|
color: ref.watch(themeProvider).themeColor.settingBordorColor(),
|
||||||
|
child: buildCell(index),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (_, __) {
|
||||||
|
return const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: getIt<UserInfoViewModel>().historyAccounts.length + 1),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildCell(int index) {
|
||||||
|
Widget child = ListTile(
|
||||||
|
title: Text(
|
||||||
|
getIt<UserInfoViewModel>().historyAccounts[index].host ?? "",
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
minVerticalPadding: 10,
|
||||||
|
subtitle: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text(
|
||||||
|
getIt<UserInfoViewModel>().historyAccounts[index].userName ?? "",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: index == 0
|
||||||
|
? Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 5,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
border: Border.all(color: ref.watch(themeProvider).primaryColor, width: 1),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"已登录",
|
||||||
|
style: TextStyle(color: ref.watch(themeProvider).primaryColor, fontSize: 12),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: (isLoginingHost.isNotEmpty
|
||||||
|
? SizedBox(
|
||||||
|
width: 15,
|
||||||
|
height: 15,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
color: ref.watch(themeProvider).primaryColor,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink()),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (getIt<UserInfoViewModel>().historyAccounts[index].host == getIt<UserInfoViewModel>().host) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Slidable(
|
||||||
|
key: ValueKey(index),
|
||||||
|
endActionPane: ActionPane(
|
||||||
|
motion: const ScrollMotion(),
|
||||||
|
extentRatio: 0.15,
|
||||||
|
children: [
|
||||||
|
SlidableAction(
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
flex: 1,
|
||||||
|
onPressed: (_) {
|
||||||
|
getIt<UserInfoViewModel>().removeHistoryAccount(getIt<UserInfoViewModel>().historyAccounts[index].host);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
icon: CupertinoIcons.delete,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
loginNewByBean(getIt<UserInfoViewModel>().historyAccounts[index]);
|
||||||
|
},
|
||||||
|
child: child),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoginHelper? helper;
|
||||||
|
|
||||||
|
void loginNewByBean(UserInfoBean historyAccount) async {
|
||||||
|
isLoginingHost = historyAccount.host ?? "";
|
||||||
|
setState(() {});
|
||||||
|
helper = LoginHelper(
|
||||||
|
historyAccount.useSecretLogined,
|
||||||
|
historyAccount.host ?? "",
|
||||||
|
historyAccount.userName ?? "",
|
||||||
|
historyAccount.password ?? "",
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
var response = await helper!.login();
|
||||||
|
dealLoginResponse(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dealLoginResponse(int response) {
|
||||||
|
if (response == LoginHelper.success) {
|
||||||
|
Navigator.of(context).pushNamedAndRemoveUntil(Routes.routeHomePage, (_) => false);
|
||||||
|
} else if (response == LoginHelper.failed) {
|
||||||
|
loginFailed();
|
||||||
|
} else {
|
||||||
|
twoFact();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loginFailed() {
|
||||||
|
isLoginingHost = "";
|
||||||
|
Http.clear();
|
||||||
|
getIt<UserInfoViewModel>().updateHost(preHost);
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void twoFact() {
|
||||||
|
String twoFact = "";
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => CupertinoAlertDialog(
|
||||||
|
title: const Text("两步验证"),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: TextField(
|
||||||
|
onChanged: (value) {
|
||||||
|
twoFact = value;
|
||||||
|
},
|
||||||
|
maxLines: 1,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
|
hintText: "请输入code",
|
||||||
|
),
|
||||||
|
autofocus: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: const Text(
|
||||||
|
"取消",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xff999999),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(
|
||||||
|
"确定",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop(true);
|
||||||
|
if (helper != null) {
|
||||||
|
var response = await helper!.loginTwice(twoFact);
|
||||||
|
dealLoginResponse(response);
|
||||||
|
} else {
|
||||||
|
"状态异常".toast();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)).then((value) {
|
||||||
|
if (value == null) {
|
||||||
|
isLoginingHost = "";
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget addAccount() {
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
|
Routes.routeLogin,
|
||||||
|
(_) => false,
|
||||||
|
arguments: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 15,
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ref.watch(themeProvider).themeColor.settingBordorColor(),
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
border: Border.all(
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
CupertinoIcons.add,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 15,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"添加账号",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,13 +27,14 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
|||||||
_codeController?.dispose();
|
_codeController?.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
result = widget.content;
|
result = widget.content;
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,15 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
|||||||
child: CodeField(
|
child: CodeField(
|
||||||
controller: _codeController!,
|
controller: _codeController!,
|
||||||
expands: true,
|
expands: true,
|
||||||
|
wrap: true,
|
||||||
|
lineNumberStyle: const LineNumberStyle(
|
||||||
|
width: 0,
|
||||||
|
margin: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: Colors.transparent,
|
||||||
|
fontSize: 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
background: ref.watch(themeProvider).themeColor.settingBgColor(),
|
background: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class _CodeWidgetState extends State<CodeWidget>
|
|||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
return SelectableText.rich(
|
return SelectableText.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
style: GoogleFonts.droidSansMono(fontSize: 14).apply(
|
style: GoogleFonts.droidSansMono(fontSize: 14).apply(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ConfigViewModel extends BaseViewModel {
|
|||||||
Map<String, String> content = {};
|
Map<String, String> content = {};
|
||||||
|
|
||||||
Future<void> loadData([isLoading = true]) async {
|
Future<void> loadData([isLoading = true]) async {
|
||||||
if (isLoading) {
|
if (isLoading && list.isEmpty) {
|
||||||
loading(notify: true);
|
loading(notify: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
lib/module/env/add_env_page.dart
vendored
@@ -35,7 +35,7 @@ class _AddEnvPageState extends ConsumerState<AddEnvPage> {
|
|||||||
} else {
|
} else {
|
||||||
envBean = EnvBean();
|
envBean = EnvBean();
|
||||||
}
|
}
|
||||||
WidgetsBinding.instance?.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
(timeStamp) {
|
(timeStamp) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
},
|
},
|
||||||
|
|||||||
184
lib/module/env/env_page.dart
vendored
@@ -8,6 +8,7 @@ import 'package:qinglong_app/base/base_state_widget.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/base/ui/search_cell.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';
|
import 'package:qinglong_app/utils/extension.dart';
|
||||||
@@ -22,6 +23,7 @@ class EnvPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _EnvPageState extends State<EnvPage> {
|
class _EnvPageState extends State<EnvPage> {
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
String currentState = EnvViewModel.allStr;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -35,41 +37,62 @@ class _EnvPageState extends State<EnvPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BaseStateWidget<EnvViewModel>(
|
return BaseStateWidget<EnvViewModel>(
|
||||||
builder: (ref, model, child) {
|
builder: (ref, model, child) {
|
||||||
|
List<EnvBean> prepareList = [];
|
||||||
List<EnvItemCell> list = [];
|
List<EnvItemCell> list = [];
|
||||||
|
if (currentState == EnvViewModel.allStr) {
|
||||||
|
prepareList = model.list;
|
||||||
|
} else if (currentState == EnvViewModel.enabledStr) {
|
||||||
|
prepareList = model.enabledList;
|
||||||
|
} else {
|
||||||
|
prepareList = model.disabledList;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < model.list.length; i++) {
|
for (int i = 0; i < prepareList.length; i++) {
|
||||||
EnvBean value = model.list[i];
|
EnvBean value = prepareList[i];
|
||||||
if (_searchController.text.isEmpty ||
|
if (_searchController.text.isEmpty ||
|
||||||
(value.name?.contains(_searchController.text) ?? false) ||
|
(value.name?.contains(_searchController.text) ?? false) ||
|
||||||
(value.value?.contains(_searchController.text) ?? false) ||
|
(value.value?.contains(_searchController.text) ?? false) ||
|
||||||
(value.remarks?.contains(_searchController.text) ?? false)) {
|
(value.remarks?.contains(_searchController.text) ?? false)) {
|
||||||
list.add(EnvItemCell(
|
list.add(
|
||||||
|
EnvItemCell(
|
||||||
value,
|
value,
|
||||||
i,
|
i,
|
||||||
ref,
|
ref,
|
||||||
key: ValueKey(value.sId),
|
key: ValueKey(value.sId),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return model.list.isEmpty
|
return model.list.isEmpty
|
||||||
? const EmptyWidget()
|
? const EmptyWidget()
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
|
notificationPredicate: (_) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
return model.loadData(false);
|
return model.loadData(false);
|
||||||
},
|
},
|
||||||
child: SlidableAutoCloseBehavior(
|
child: SlidableAutoCloseBehavior(
|
||||||
child: ReorderableListView(
|
child: currentState == EnvViewModel.disabledStr
|
||||||
|
? ListView(
|
||||||
|
children: [
|
||||||
|
searchCell(context, ref),
|
||||||
|
...list,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ReorderableListView(
|
||||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||||
header: searchCell(ref),
|
header: searchCell(context, ref),
|
||||||
onReorder: (int oldIndex, int newIndex) {
|
onReorder: (int oldIndex, int newIndex) {
|
||||||
if (list.length != model.list.length) {
|
if (list.length != model.list.length) {
|
||||||
"请先清空搜索关键词".toast();
|
"请先清空搜索关键词".toast();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(
|
||||||
|
() {
|
||||||
//交换数据
|
//交换数据
|
||||||
if (newIndex > oldIndex) {
|
if (newIndex > oldIndex) {
|
||||||
newIndex -= 1;
|
newIndex -= 1;
|
||||||
@@ -77,7 +100,8 @@ 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(item.sId ?? "", newIndex, oldIndex);
|
model.update(item.sId ?? "", newIndex, oldIndex);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
children: list,
|
children: list,
|
||||||
),
|
),
|
||||||
@@ -86,49 +110,85 @@ class _EnvPageState extends State<EnvPage> {
|
|||||||
},
|
},
|
||||||
model: envProvider,
|
model: envProvider,
|
||||||
onReady: (viewModel) {
|
onReady: (viewModel) {
|
||||||
viewModel.loadData();
|
viewModel.loadData(true);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget searchCell(WidgetRef context) {
|
Widget searchCell(BuildContext context, WidgetRef ref) {
|
||||||
return Container(
|
return Container(
|
||||||
|
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
child: SearchCell(
|
||||||
|
controller: _searchController,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: PopupMenuButton<String>(
|
||||||
|
onSelected: (String result) {
|
||||||
|
currentState = result;
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
itemBuilder: (BuildContext context) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Text(
|
||||||
|
EnvViewModel.allStr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: currentState == EnvViewModel.allStr ? ref.watch(themeProvider).primaryColor : ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
value: EnvViewModel.allStr,
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Text(
|
||||||
|
EnvViewModel.enabledStr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: currentState == EnvViewModel.enabledStr ? ref.watch(themeProvider).primaryColor : ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
value: EnvViewModel.enabledStr,
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Text(
|
||||||
|
EnvViewModel.disabledStr,
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
currentState == EnvViewModel.disabledStr ? ref.watch(themeProvider).primaryColor : ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
value: EnvViewModel.disabledStr,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 15,
|
horizontal: 15,
|
||||||
vertical: 10,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
child: CupertinoSearchTextField(
|
child: Text(
|
||||||
onSubmitted: (value) {
|
"筛选",
|
||||||
setState(() {});
|
style: TextStyle(
|
||||||
},
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
onSuffixTap: () {
|
fontSize: 14,
|
||||||
_searchController.text = "";
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
controller: _searchController,
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
30,
|
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 5,
|
|
||||||
vertical: 5,
|
|
||||||
),
|
),
|
||||||
suffixInsets: const EdgeInsets.only(
|
|
||||||
right: 15,
|
|
||||||
),
|
),
|
||||||
prefixInsets: EdgeInsets.only(
|
|
||||||
top: Platform.isAndroid ? 10 : 6,
|
|
||||||
bottom: 6,
|
|
||||||
left: 15,
|
|
||||||
),
|
),
|
||||||
placeholderStyle: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: context.watch(themeProvider).themeColor.descColor(),
|
|
||||||
),
|
),
|
||||||
style: const TextStyle(
|
],
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
placeholder: "搜索",
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -143,9 +203,7 @@ class EnvItemCell extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ColoredBox(
|
return Slidable(
|
||||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
|
||||||
child: Slidable(
|
|
||||||
key: ValueKey(bean.sId),
|
key: ValueKey(bean.sId),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
motion: const StretchMotion(),
|
motion: const StretchMotion(),
|
||||||
@@ -206,28 +264,35 @@ class EnvItemCell extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
bean.status == 1
|
bean.status == 1
|
||||||
? const Icon(
|
? const SizedBox(
|
||||||
Icons.dnd_forwardslash,
|
width: 18,
|
||||||
size: 18,
|
|
||||||
color: Color(0xffEA4D3E),
|
|
||||||
)
|
)
|
||||||
: Container(
|
: Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 5,
|
horizontal: 5,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(3),
|
||||||
border: Border.all(color: ref.watch(themeProvider).primaryColor, width: 1),
|
border: Border.all(color: ref.watch(themeProvider).themeColor.descColor(), width: 1),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
"${getIndexByIndex(context, index)}",
|
"${getIndexByIndex(context, index)}",
|
||||||
style: TextStyle(color: ref.watch(themeProvider).primaryColor, fontSize: 12),
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 5,
|
width: 5,
|
||||||
),
|
),
|
||||||
Material(
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints.loose(
|
||||||
|
Size.fromWidth(
|
||||||
|
MediaQuery.of(context).size.width / 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Text(
|
child: Text(
|
||||||
bean.name ?? "",
|
bean.name ?? "",
|
||||||
@@ -239,10 +304,16 @@ class EnvItemCell extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 5,
|
width: 5,
|
||||||
),
|
),
|
||||||
Expanded(
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints.loose(
|
||||||
|
Size.fromWidth(
|
||||||
|
MediaQuery.of(context).size.width / 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Visibility(
|
child: Visibility(
|
||||||
visible: bean.remarks != null && bean.remarks!.isNotEmpty,
|
visible: bean.remarks != null && bean.remarks!.isNotEmpty,
|
||||||
child: Material(
|
child: Material(
|
||||||
@@ -260,6 +331,20 @@ class EnvItemCell extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 7,
|
||||||
|
),
|
||||||
|
bean.status == 1
|
||||||
|
? Image.asset(
|
||||||
|
"assets/images/icon_disabled.png",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 35,
|
||||||
|
)
|
||||||
|
: Image.asset(
|
||||||
|
"assets/images/icon_enable.png",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 35,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -307,7 +392,6 @@ class EnvItemCell extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
32
lib/module/env/env_viewmodel.dart
vendored
@@ -8,21 +8,34 @@ import 'package:qinglong_app/utils/extension.dart';
|
|||||||
var envProvider = ChangeNotifierProvider((ref) => EnvViewModel());
|
var envProvider = ChangeNotifierProvider((ref) => EnvViewModel());
|
||||||
|
|
||||||
class EnvViewModel extends BaseViewModel {
|
class EnvViewModel extends BaseViewModel {
|
||||||
|
static const String allStr = "全部";
|
||||||
|
static const String disabledStr = "已禁用";
|
||||||
|
static const String enabledStr = "已启用";
|
||||||
List<EnvBean> list = [];
|
List<EnvBean> list = [];
|
||||||
|
List<EnvBean> disabledList = [];
|
||||||
|
List<EnvBean> enabledList = [];
|
||||||
|
|
||||||
|
|
||||||
Future<void> loadData([isLoading = true]) async {
|
Future<void> loadData([isLoading = true]) async {
|
||||||
if (isLoading) {
|
if (isLoading && list.isEmpty) {
|
||||||
loading(notify: true);
|
loading(notify: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse<List<EnvBean>> result = await Api.envs("");
|
HttpResponse<List<EnvBean>> result = await Api.envs("");
|
||||||
|
|
||||||
|
|
||||||
if (result.success && result.bean != null) {
|
if (result.success && result.bean != null) {
|
||||||
list.clear();
|
list.clear();
|
||||||
list.addAll(result.bean!);
|
list.addAll(result.bean!);
|
||||||
|
disabledList.clear();
|
||||||
|
disabledList.addAll(list.where((element) => element.status == 1).toList());
|
||||||
|
enabledList.clear();
|
||||||
|
enabledList.addAll(list.where((element) => element.status == 0).toList());
|
||||||
success();
|
success();
|
||||||
} else {
|
} else {
|
||||||
list.clear();
|
list.clear();
|
||||||
|
disabledList.clear();
|
||||||
|
enabledList.clear();
|
||||||
failed(result.message, notify: true);
|
failed(result.message, notify: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,23 +44,14 @@ class EnvViewModel extends BaseViewModel {
|
|||||||
HttpResponse<NullResponse> result = await Api.delEnv(id);
|
HttpResponse<NullResponse> result = await Api.delEnv(id);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
"删除成功".toast();
|
"删除成功".toast();
|
||||||
list.removeWhere((element) => element.sId == id);
|
loadData(false);
|
||||||
notifyListeners();
|
|
||||||
} else {
|
} else {
|
||||||
failed(result.message, notify: true);
|
failed(result.message, notify: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateEnv(EnvBean result) {
|
void updateEnv(EnvBean result) {
|
||||||
if (result.sId == null) {
|
|
||||||
loadData(false);
|
loadData(false);
|
||||||
return;
|
|
||||||
}
|
|
||||||
EnvBean bean = list.firstWhere((element) => element.sId == result.sId);
|
|
||||||
bean.name = result.name;
|
|
||||||
bean.remarks = result.remarks;
|
|
||||||
bean.value = result.value;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> enableEnv(String sId, int status) async {
|
Future<void> enableEnv(String sId, int status) async {
|
||||||
@@ -56,8 +60,7 @@ class EnvViewModel extends BaseViewModel {
|
|||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
"启用成功".toast();
|
"启用成功".toast();
|
||||||
list.firstWhere((element) => element.sId == sId).status = 0;
|
loadData(false);
|
||||||
success();
|
|
||||||
} else {
|
} else {
|
||||||
failToast(response.message, notify: true);
|
failToast(response.message, notify: true);
|
||||||
}
|
}
|
||||||
@@ -66,8 +69,7 @@ class EnvViewModel extends BaseViewModel {
|
|||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
"禁用成功".toast();
|
"禁用成功".toast();
|
||||||
list.firstWhere((element) => element.sId == sId).status = 1;
|
loadData(false);
|
||||||
success();
|
|
||||||
} else {
|
} else {
|
||||||
failToast(response.message, notify: true);
|
failToast(response.message, notify: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class _HomePageState extends ConsumerState<HomePage>
|
|||||||
initTitles();
|
initTitles();
|
||||||
_title = titles[0].title;
|
_title = titles[0].title;
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
getSystemBean();
|
getSystemBean();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:dio_log/dio_log.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_animator/flutter_animator.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.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';
|
||||||
@@ -62,13 +63,15 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getIt<UserInfoViewModel>().updateToken("");
|
getIt<UserInfoViewModel>().updateToken("");
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
if (useSecretLogin) {
|
if (useSecretLogin) {
|
||||||
cardKey.currentState?.toggleCard();
|
cardKey.currentState?.toggleCard();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlobalKey<AnimatorWidgetState> loginKey = GlobalKey<AnimatorWidgetState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -76,20 +79,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
value: ref.watch(themeProvider).darkMode == true ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
|
value: ref.watch(themeProvider).darkMode == true ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
|
||||||
child: ColoredBox(
|
child: ColoredBox(
|
||||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
child: SizedBox(
|
child: SingleChildScrollView(
|
||||||
height: MediaQuery.of(context).size.height,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
child: Image.asset(
|
|
||||||
"assets/images/login_bg.png",
|
|
||||||
width: MediaQuery.of(context).size.width,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -103,16 +93,20 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height / 10,
|
height: MediaQuery.of(context).size.height / 8,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Image.asset(
|
child: Text(
|
||||||
"assets/images/login_tip.png",
|
useSecretLogin ? "client_id登录" : "账号登录",
|
||||||
height: 45,
|
style: TextStyle(
|
||||||
|
fontSize: 26,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -123,7 +117,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
} else {
|
} else {
|
||||||
showDebugBtn(context, btnColor: ref.watch(themeProvider).primaryColor);
|
showDebugBtn(context, btnColor: ref.watch(themeProvider).primaryColor);
|
||||||
}
|
}
|
||||||
WidgetsBinding.instance?.endOfFrame;
|
WidgetsBinding.instance.endOfFrame;
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"assets/images/ql.png",
|
"assets/images/ql.png",
|
||||||
@@ -135,24 +129,49 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height / 15,
|
height: MediaQuery.of(context).size.height / 15,
|
||||||
),
|
),
|
||||||
const Text(
|
Row(
|
||||||
"域名:",
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
width: 40,
|
||||||
|
child: Text(
|
||||||
|
"域名",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
onChanged: (_) {
|
onChanged: (_) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controller: _hostController,
|
controller: _hostController,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
border: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: const EdgeInsets.all(4),
|
||||||
hintText: "http://1.1.1.1:5700",
|
hintText: "http://1.1.1.1:5700",
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
color: Color(0xff999999),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
FlipCard(
|
FlipCard(
|
||||||
key: cardKey,
|
key: cardKey,
|
||||||
flipOnTouch: false,
|
flipOnTouch: false,
|
||||||
@@ -162,118 +181,197 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
},
|
},
|
||||||
direction: FlipDirection.HORIZONTAL,
|
direction: FlipDirection.HORIZONTAL,
|
||||||
front: SizedBox(
|
front: SizedBox(
|
||||||
height: 200,
|
height: 110,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
child: Text(
|
||||||
),
|
"账户",
|
||||||
const Text(
|
|
||||||
"用户名:",
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
width: 40,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
onChanged: (_) {
|
onChanged: (_) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controller: _userNameController,
|
controller: _userNameController,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
border: InputBorder.none,
|
||||||
hintText: "请输入用户名",
|
enabledBorder: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: const EdgeInsets.all(4),
|
||||||
|
hintText: "请输入账户",
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
),
|
||||||
const Text(
|
],
|
||||||
"密码:",
|
),
|
||||||
|
const Divider(
|
||||||
|
color: Color(0xff999999),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
width: 40,
|
||||||
|
child: Text(
|
||||||
|
"密码",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
onChanged: (_) {
|
onChanged: (_) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
border: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: const EdgeInsets.all(4),
|
||||||
hintText: "请输入密码",
|
hintText: "请输入密码",
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 10,
|
],
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
color: Color(0xff999999),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
back: SizedBox(
|
back: SizedBox(
|
||||||
height: 200,
|
height: 110,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
width: 40,
|
||||||
),
|
child: Text(
|
||||||
const Text(
|
"id",
|
||||||
"client_id:",
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
onChanged: (_) {
|
onChanged: (_) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controller: _cIdController,
|
controller: _cIdController,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
border: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: const EdgeInsets.all(4),
|
||||||
hintText: "请输入client_id",
|
hintText: "请输入client_id",
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
),
|
||||||
const Text(
|
],
|
||||||
"client_secret:",
|
),
|
||||||
|
const Divider(
|
||||||
|
color: Color(0xff999999),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
width: 50,
|
||||||
|
child: Text(
|
||||||
|
"secret",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
onChanged: (_) {
|
onChanged: (_) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controller: _cSecretController,
|
controller: _cSecretController,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
border: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: const EdgeInsets.all(4),
|
||||||
hintText: "请输入client_secret",
|
hintText: "请输入client_secret",
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 10,
|
],
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
color: Color(0xff999999),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -291,8 +389,9 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const Text(
|
const Text(
|
||||||
"记住密码/client",
|
"记住密码",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
color: Color(0xff555555),
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -300,13 +399,14 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
cardKey.currentState?.toggleCard();
|
cardKey.currentState?.toggleCard();
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
loginByUserName() ? "client_id登录" : "账号登录",
|
loginByUserName() ? "client_id登录" : "账号登录",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
color: Color(0xff555555),
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -320,29 +420,52 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
Container(
|
Shake(
|
||||||
|
preferences: const AnimationPreferences(autoPlay: AnimationPlayStates.None),
|
||||||
|
key: loginKey,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 40,
|
horizontal: 40,
|
||||||
),
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: canClickLoginBtn()
|
||||||
|
? [
|
||||||
|
const Color(0xff5DD16F),
|
||||||
|
const Color(0xff089556),
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
const Color(0xff5DD16F).withOpacity(0.6),
|
||||||
|
const Color(0xff089556).withOpacity(0.6),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width - 80,
|
width: MediaQuery.of(context).size.width - 80,
|
||||||
child: IgnorePointer(
|
child: IgnorePointer(
|
||||||
ignoring: !canClickLoginBtn(),
|
ignoring: !canClickLoginBtn(),
|
||||||
child: CupertinoButton(
|
child: Builder(
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoButton(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
),
|
),
|
||||||
color: canClickLoginBtn() ? ref.watch(themeProvider).primaryColor : ref.watch(themeProvider).primaryColor.withOpacity(0.4),
|
|
||||||
child: isLoading
|
child: isLoading
|
||||||
? const CupertinoActivityIndicator()
|
? const CupertinoActivityIndicator()
|
||||||
: const Text(
|
: const Text(
|
||||||
"登 录",
|
"登 录",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 18,
|
||||||
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Http.pushedLoginPage = false;
|
Http.pushedLoginPage = false;
|
||||||
Utils.hideKeyBoard(context);
|
Utils.hideKeyBoard(context);
|
||||||
if (loginByUserName()) {
|
if (loginByUserName()) {
|
||||||
@@ -351,6 +474,10 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
login(_cIdController.text, _cSecretController.text);
|
login(_cIdController.text, _cSecretController.text);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -358,15 +485,11 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
],
|
(getIt<UserInfoViewModel>().historyAccounts.isEmpty)
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: 10,
|
|
||||||
child: (getIt<UserInfoViewModel>().historyAccounts.isEmpty)
|
|
||||||
? const SizedBox.shrink()
|
? const SizedBox.shrink()
|
||||||
: SizedBox(
|
: SafeArea(
|
||||||
|
top: false,
|
||||||
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Material(
|
child: Material(
|
||||||
@@ -378,19 +501,34 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<UserInfoBean>>[
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<UserInfoBean>>[
|
||||||
...getIt<UserInfoViewModel>()
|
...getIt<UserInfoViewModel>()
|
||||||
.historyAccounts
|
.historyAccounts
|
||||||
.map((e) => PopupMenuItem<UserInfoBean>(
|
.map(
|
||||||
|
(e) => PopupMenuItem<UserInfoBean>(
|
||||||
value: e,
|
value: e,
|
||||||
child: buildCell(e),
|
child: buildCell(context, e),
|
||||||
))
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
],
|
],
|
||||||
child: Text(
|
child: Row(
|
||||||
"切换账号",
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
"assets/images/icon_history.png",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
"历史账号",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: ref.watch(themeProvider).primaryColor,
|
color: Color(0xff555555),
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -434,6 +572,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
|
|
||||||
void loginFailed() {
|
void loginFailed() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
loginKey.currentState?.forward();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +651,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildCell(UserInfoBean bean) {
|
Widget buildCell(BuildContext context, UserInfoBean bean) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
bean.host ?? "",
|
bean.host ?? "",
|
||||||
@@ -525,6 +664,19 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
bean.userName ?? "",
|
bean.userName ?? "",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
trailing: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
getIt<UserInfoViewModel>().removeHistoryAccount(bean.host);
|
||||||
|
Navigator.pop(context);
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: const Icon(
|
||||||
|
CupertinoIcons.clear_thick,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +686,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
_cIdController.text = result.userName ?? "";
|
_cIdController.text = result.userName ?? "";
|
||||||
_cSecretController.text = result.password ?? "";
|
_cSecretController.text = result.password ?? "";
|
||||||
if (cardKey.currentState?.isFront ?? false) {
|
if (cardKey.currentState?.isFront ?? false) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
cardKey.currentState?.toggleCard();
|
cardKey.currentState?.toggleCard();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -542,7 +694,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
|||||||
_userNameController.text = result.userName ?? "";
|
_userNameController.text = result.userName ?? "";
|
||||||
_passwordController.text = result.password ?? "";
|
_passwordController.text = result.password ?? "";
|
||||||
if (!(cardKey.currentState?.isFront ?? false)) {
|
if (!(cardKey.currentState?.isFront ?? false)) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
cardKey.currentState?.toggleCard();
|
cardKey.currentState?.toggleCard();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ class DependencyCell extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showLog(WidgetRef ref, String? sId) {
|
void showLog(WidgetRef ref, String? sId) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class DependencyViewModel extends BaseViewModel {
|
|||||||
List<DependencyBean> linuxList = [];
|
List<DependencyBean> linuxList = [];
|
||||||
|
|
||||||
Future<void> loadData(String type, [bool showLoading = true]) async {
|
Future<void> loadData(String type, [bool showLoading = true]) async {
|
||||||
if (showLoading) {
|
if (showLoading && ((type == "nodejs" && nodeJsList.isEmpty) || (type == "python3" && python3List.isEmpty) || (type == "linux" && linuxList.isEmpty))) {
|
||||||
loading(notify: true);
|
loading(notify: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,40 +39,53 @@ class _LoginLogPageState extends ConsumerState<LoginLogPage>
|
|||||||
? const Center(
|
? const Center(
|
||||||
child: CupertinoActivityIndicator(),
|
child: CupertinoActivityIndicator(),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: ListView.separated(
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
LoginLogBean item = list[index];
|
LoginLogBean item = list[index];
|
||||||
|
|
||||||
return ColoredBox(
|
return Row(
|
||||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
children: [
|
||||||
child: ListTile(
|
const SizedBox(
|
||||||
isThreeLine: true,
|
width: 15,
|
||||||
title: Text(
|
|
||||||
Utils.formatMessageTime(item.timestamp ?? 0),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: ref.watch(themeProvider).themeColor.titleColor(),
|
|
||||||
),
|
),
|
||||||
),
|
Column(
|
||||||
subtitle: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 10,
|
||||||
),
|
),
|
||||||
SelectableText(
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
"${item.address}",
|
"${item.address}",
|
||||||
selectionWidthStyle: BoxWidthStyle.max,
|
|
||||||
selectionHeightStyle: BoxHeightStyle.max,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: ref
|
||||||
ref.watch(themeProvider).themeColor.descColor(),
|
.watch(themeProvider)
|
||||||
|
.themeColor
|
||||||
|
.titleColor(),
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
width: 5,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 2,
|
||||||
|
),
|
||||||
|
child: Image.asset(
|
||||||
|
item.status == 0
|
||||||
|
? "assets/images/icon_success.png"
|
||||||
|
: "assets/images/icon_fail.png",
|
||||||
|
width: 30,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"${item.ip}",
|
"${item.ip}",
|
||||||
@@ -84,29 +97,39 @@ class _LoginLogPageState extends ConsumerState<LoginLogPage>
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: item.status == 0
|
const Spacer(),
|
||||||
? Icon(
|
Text(
|
||||||
CupertinoIcons.checkmark_circle,
|
Utils.formatMessageTime(item.timestamp ?? 0),
|
||||||
color: ref.watch(themeProvider).primaryColor,
|
style: TextStyle(
|
||||||
size: 16,
|
fontSize: 12,
|
||||||
)
|
color: ref.watch(themeProvider).themeColor.descColor(),
|
||||||
: const Icon(
|
|
||||||
CupertinoIcons.clear_circled,
|
|
||||||
color: Colors.red,
|
|
||||||
size: 16,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 15,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemCount: list.length,
|
itemCount: list.length,
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
indent: 15,
|
||||||
|
height: 1,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadData() async {
|
Future<void> loadData() async {
|
||||||
HttpResponse<List<LoginLogBean>> response = await Api.loginLog();
|
HttpResponse<List<LoginLogBean>> response =
|
||||||
|
await Api.loginLog();
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
if (response.bean == null || response.bean!.isEmpty) {
|
if (response.bean == null || response.bean!.isEmpty) {
|
||||||
|
|||||||
@@ -26,15 +26,8 @@ class _OtherPageState extends ConsumerState<OtherPage> {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(
|
margin: const EdgeInsets.symmetric(
|
||||||
horizontal: 15,
|
|
||||||
vertical: 15,
|
vertical: 15,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: ref.watch(themeProvider).themeColor.settingBordorColor(),
|
|
||||||
borderRadius: const BorderRadius.all(
|
|
||||||
Radius.circular(15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -225,15 +218,8 @@ class _OtherPageState extends ConsumerState<OtherPage> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(
|
margin: const EdgeInsets.symmetric(
|
||||||
horizontal: 15,
|
|
||||||
vertical: 15,
|
vertical: 15,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: ref.watch(themeProvider).themeColor.settingBordorColor(),
|
|
||||||
borderRadius: const BorderRadius.all(
|
|
||||||
Radius.circular(15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -304,6 +290,41 @@ class _OtherPageState extends ConsumerState<OtherPage> {
|
|||||||
const Divider(
|
const Divider(
|
||||||
indent: 15,
|
indent: 15,
|
||||||
),
|
),
|
||||||
|
GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.routeChangeAccount);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15,
|
||||||
|
right: 15,
|
||||||
|
top: 5,
|
||||||
|
bottom: 5,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"切换账号",
|
||||||
|
style: TextStyle(
|
||||||
|
color: ref.watch(themeProvider).themeColor.titleColor(),
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
const Icon(
|
||||||
|
CupertinoIcons.right_chevron,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
indent: 15,
|
||||||
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
|||||||
? const Center(
|
? const Center(
|
||||||
child: CupertinoActivityIndicator(),
|
child: CupertinoActivityIndicator(),
|
||||||
)
|
)
|
||||||
: CodeWidget(
|
: ScriptCodeWidget(
|
||||||
content: content ?? "",
|
content: content ?? "",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -265,3 +265,40 @@ class _ScriptDetailPageState extends ConsumerState<ScriptDetailPage>
|
|||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ScriptCodeWidget extends StatefulWidget {
|
||||||
|
final String content;
|
||||||
|
|
||||||
|
const ScriptCodeWidget({
|
||||||
|
Key? key,
|
||||||
|
required this.content,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ScriptCodeWidget> createState() => _ScriptCodeWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ScriptCodeWidgetState extends State<ScriptCodeWidget>{
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SelectableText.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: GoogleFonts.droidSansMono(fontSize: 14).apply(
|
||||||
|
fontSizeFactor: 1,
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
DartSyntaxHighlighter(SyntaxHighlighterStyle.lightThemeStyle())
|
||||||
|
.format(widget.content)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
style: DefaultTextStyle.of(context).style.apply(
|
||||||
|
fontSizeFactor: 1,
|
||||||
|
),
|
||||||
|
selectionWidthStyle: BoxWidthStyle.max,
|
||||||
|
selectionHeightStyle: BoxHeightStyle.max,
|
||||||
|
autofocus: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class _ScriptEditPageState extends ConsumerState<ScriptEditPage> {
|
|||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -117,26 +117,21 @@ class _ScriptEditPageState extends ConsumerState<ScriptEditPage> {
|
|||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
top: false,
|
top: false,
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10,
|
|
||||||
vertical: 10,
|
|
||||||
),
|
|
||||||
child: CodeField(
|
child: CodeField(
|
||||||
controller: _codeController!,
|
controller: _codeController!,
|
||||||
expands: true,
|
expands: true,
|
||||||
wrap: true,
|
wrap: true,
|
||||||
lineNumberStyle: LineNumberStyle(
|
lineNumberStyle: const LineNumberStyle(
|
||||||
width: 0,
|
width: 0,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: ref.watch(themeProvider).themeColor.descColor(),
|
color: Colors.transparent,
|
||||||
|
fontSize: 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
background: ref.watch(themeProvider).themeColor.tabBarColor(),
|
background: ref.watch(themeProvider).themeColor.tabBarColor(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:qinglong_app/base/ql_app_bar.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/lazy_load_state.dart';
|
import 'package:qinglong_app/base/ui/lazy_load_state.dart';
|
||||||
|
import 'package:qinglong_app/base/ui/search_cell.dart';
|
||||||
import 'package:qinglong_app/module/others/scripts/script_bean.dart';
|
import 'package:qinglong_app/module/others/scripts/script_bean.dart';
|
||||||
import 'package:qinglong_app/utils/extension.dart';
|
import 'package:qinglong_app/utils/extension.dart';
|
||||||
|
|
||||||
@@ -66,7 +67,15 @@ class _ScriptPageState extends ConsumerState<ScriptPage> with LazyLoadState<Scri
|
|||||||
? const Center(
|
? const Center(
|
||||||
child: CupertinoActivityIndicator(),
|
child: CupertinoActivityIndicator(),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: RefreshIndicator(
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onRefresh: () async {
|
||||||
|
await loadData();
|
||||||
|
return Future.value();
|
||||||
|
},
|
||||||
|
child: ListView.builder(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return searchCell(ref);
|
return searchCell(ref);
|
||||||
@@ -161,6 +170,7 @@ class _ScriptPageState extends ConsumerState<ScriptPage> with LazyLoadState<Scri
|
|||||||
},
|
},
|
||||||
itemCount: list.length + 1,
|
itemCount: list.length + 1,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,38 +180,8 @@ class _ScriptPageState extends ConsumerState<ScriptPage> with LazyLoadState<Scri
|
|||||||
horizontal: 15,
|
horizontal: 15,
|
||||||
vertical: 10,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
child: CupertinoSearchTextField(
|
child: SearchCell(
|
||||||
onSubmitted: (value) {
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
onSuffixTap: () {
|
|
||||||
_searchController.text = "";
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 5,
|
|
||||||
vertical: 5,
|
|
||||||
),
|
|
||||||
suffixInsets: const EdgeInsets.only(
|
|
||||||
right: 15,
|
|
||||||
),
|
|
||||||
prefixInsets: const EdgeInsets.only(
|
|
||||||
top: 6,
|
|
||||||
bottom: 6,
|
|
||||||
left: 15,
|
|
||||||
),
|
|
||||||
placeholderStyle: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: context.watch(themeProvider).themeColor.descColor(),
|
|
||||||
),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
placeholder: "搜索",
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -251,6 +231,8 @@ class _ScriptPageState extends ConsumerState<ScriptPage> with LazyLoadState<Scri
|
|||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 10,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
@@ -264,19 +246,25 @@ class _ScriptPageState extends ConsumerState<ScriptPage> with LazyLoadState<Scri
|
|||||||
autofocus: false,
|
autofocus: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
const Text(
|
const Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Text(
|
||||||
"脚本所属文件夹:",
|
"脚本所属文件夹:",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
DropdownButtonFormField<String>(
|
Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: DropdownButtonFormField<String>(
|
||||||
items: list
|
items: list
|
||||||
.where((element) => element.children?.isNotEmpty ?? false)
|
.where((element) => element.children?.isNotEmpty ?? false)
|
||||||
.map((e) => DropdownMenuItem(
|
.map((e) => DropdownMenuItem(
|
||||||
@@ -307,6 +295,7 @@ class _ScriptPageState extends ConsumerState<ScriptPage> with LazyLoadState<Scri
|
|||||||
scriptPath = value ?? "";
|
scriptPath = value ?? "";
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:qinglong_app/base/ql_app_bar.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/lazy_load_state.dart';
|
import 'package:qinglong_app/base/ui/lazy_load_state.dart';
|
||||||
|
import 'package:qinglong_app/base/ui/search_cell.dart';
|
||||||
import 'package:qinglong_app/module/others/task_log/task_log_bean.dart';
|
import 'package:qinglong_app/module/others/task_log/task_log_bean.dart';
|
||||||
import 'package:qinglong_app/utils/extension.dart';
|
import 'package:qinglong_app/utils/extension.dart';
|
||||||
|
|
||||||
@@ -20,6 +21,27 @@ class TaskLogPage extends ConsumerStatefulWidget {
|
|||||||
|
|
||||||
class _TaskLogPageState extends ConsumerState<TaskLogPage> with LazyLoadState<TaskLogPage> {
|
class _TaskLogPageState extends ConsumerState<TaskLogPage> with LazyLoadState<TaskLogPage> {
|
||||||
List<TaskLogBean> list = [];
|
List<TaskLogBean> list = [];
|
||||||
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
|
||||||
|
Widget searchCell(WidgetRef context) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 15,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
child: SearchCell(
|
||||||
|
controller: _searchController,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_searchController.addListener(() {
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -37,8 +59,13 @@ class _TaskLogPageState extends ConsumerState<TaskLogPage> with LazyLoadState<Ta
|
|||||||
)
|
)
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
TaskLogBean item = list[index];
|
if (index == 0) {
|
||||||
|
return searchCell(ref);
|
||||||
|
}
|
||||||
|
TaskLogBean item = list[index - 1];
|
||||||
|
if (_searchController.text.isNotEmpty && !(item.name?.contains(_searchController.text) ?? false)) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
return ColoredBox(
|
return ColoredBox(
|
||||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
child: (item.isDir ?? false)
|
child: (item.isDir ?? false)
|
||||||
@@ -92,8 +119,10 @@ class _TaskLogPageState extends ConsumerState<TaskLogPage> with LazyLoadState<Ta
|
|||||||
"该文件夹为空".toast();
|
"该文件夹为空".toast();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: {
|
||||||
Navigator.of(context).pushNamed(Routes.routeTaskLogDetail, arguments: item.name);
|
"path": "",
|
||||||
|
"title": item.name,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
title: Text(
|
title: Text(
|
||||||
item.name ?? "",
|
item.name ?? "",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class _UpdatePasswordPageState extends ConsumerState<UpdatePasswordPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance?.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
(timeStamp) {
|
(timeStamp) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
|||||||
} else {
|
} else {
|
||||||
taskBean = TaskBean();
|
taskBean = TaskBean();
|
||||||
}
|
}
|
||||||
WidgetsBinding.instance?.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
(timeStamp) {
|
(timeStamp) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:math';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/ui/lazy_load_state.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class InTimeLogPage extends StatefulWidget {
|
class InTimeLogPage extends StatefulWidget {
|
||||||
final String cronId;
|
final String cronId;
|
||||||
final bool needTimer;
|
final bool needTimer;
|
||||||
|
final String title;
|
||||||
|
|
||||||
const InTimeLogPage(this.cronId, this.needTimer, {Key? key})
|
const InTimeLogPage(this.cronId, this.needTimer, this.title, {Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_InTimeLogPageState createState() => _InTimeLogPageState();
|
_InTimeLogPageState createState() => _InTimeLogPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _InTimeLogPageState extends State<InTimeLogPage> {
|
class _InTimeLogPageState extends State<InTimeLogPage>
|
||||||
|
with LazyLoadState<InTimeLogPage> {
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
|
|
||||||
String? content;
|
String? content;
|
||||||
@@ -25,28 +30,22 @@ class _InTimeLogPageState extends State<InTimeLogPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
if (widget.needTimer) {
|
bool isRequest = false;
|
||||||
_timer = Timer.periodic(
|
bool canRequest = true;
|
||||||
const Duration(seconds: 2),
|
|
||||||
(timer) {
|
|
||||||
getLogData();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
|
||||||
getLogData();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getLogData() async {
|
getLogData() async {
|
||||||
HttpResponse<String> response = await Api.inTimeLog(widget.cronId);
|
if (!canRequest) return;
|
||||||
|
if (isRequest) return;
|
||||||
|
isRequest = true;
|
||||||
|
HttpResponse<String> response =
|
||||||
|
await Api.inTimeLog(widget.cronId);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
content = response.bean;
|
content = response.bean;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
isRequest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -57,22 +56,119 @@ class _InTimeLogPageState extends State<InTimeLogPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Material(
|
||||||
|
child: SafeArea(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 15,
|
|
||||||
vertical: 10,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
child: content == null
|
child: Column(
|
||||||
? const Center(
|
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(),
|
child: CupertinoActivityIndicator(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: CupertinoScrollbar(
|
else
|
||||||
child: SelectableText(
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
primary: true,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SelectableText(
|
||||||
content!,
|
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,
|
selectionHeightStyle: BoxHeightStyle.max,
|
||||||
selectionWidthStyle: BoxWidthStyle.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/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:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||||
import 'package:qinglong_app/base/ql_app_bar.dart';
|
import 'package:qinglong_app/base/ql_app_bar.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';
|
||||||
@@ -345,7 +346,7 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
|
|||||||
startCron(BuildContext context, WidgetRef ref) async {
|
startCron(BuildContext context, WidgetRef ref) async {
|
||||||
await ref.read(taskProvider).runCrons(widget.taskBean.sId!);
|
await ref.read(taskProvider).runCrons(widget.taskBean.sId!);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
showLog();
|
showLog();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -402,30 +403,16 @@ class _TaskDetailPageState extends ConsumerState<TaskDetailPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showLog() {
|
void showLog() {
|
||||||
showCupertinoDialog(
|
showCupertinoModalBottomSheet(
|
||||||
builder: (BuildContext context) {
|
expand: true,
|
||||||
return CupertinoAlertDialog(
|
context: context,
|
||||||
title: Text(
|
backgroundColor: Colors.transparent,
|
||||||
"${widget.taskBean.name}运行日志",
|
builder: (context) => InTimeLogPage(
|
||||||
maxLines: 1,
|
widget.taskBean.sId!,
|
||||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
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,9 +4,11 @@ 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:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||||
import 'package:qinglong_app/base/base_state_widget.dart';
|
import 'package:qinglong_app/base/base_state_widget.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/search_cell.dart';
|
||||||
import 'package:qinglong_app/module/task/intime_log/intime_log_page.dart';
|
import 'package:qinglong_app/module/task/intime_log/intime_log_page.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_viewmodel.dart';
|
import 'package:qinglong_app/module/task/task_viewmodel.dart';
|
||||||
@@ -50,7 +52,7 @@ class _TaskPageState extends ConsumerState<TaskPage> {
|
|||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
return model.loadData( false);
|
return model.loadData(false);
|
||||||
},
|
},
|
||||||
child: IconTheme(
|
child: IconTheme(
|
||||||
data: const IconThemeData(
|
data: const IconThemeData(
|
||||||
@@ -100,45 +102,20 @@ class _TaskPageState extends ConsumerState<TaskPage> {
|
|||||||
|
|
||||||
Widget searchCell(WidgetRef context) {
|
Widget searchCell(WidgetRef context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
horizontal: 15,
|
padding: const EdgeInsets.only(
|
||||||
vertical: 10,
|
left: 15,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: CupertinoSearchTextField(
|
child: Padding(
|
||||||
onSubmitted: (value) {
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
onSuffixTap: () {
|
|
||||||
_searchController.text = "";
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
controller: _searchController,
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 5,
|
vertical: 10,
|
||||||
vertical: 5,
|
|
||||||
),
|
),
|
||||||
suffixInsets: const EdgeInsets.only(
|
child: SearchCell(
|
||||||
right: 15,
|
controller: _searchController,
|
||||||
),
|
),
|
||||||
prefixInsets: EdgeInsets.only(
|
|
||||||
top: Platform.isAndroid ? 10 : 6,
|
|
||||||
bottom: 6,
|
|
||||||
left: 15,
|
|
||||||
),
|
|
||||||
placeholderStyle: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: context.watch(themeProvider).themeColor.descColor(),
|
|
||||||
),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
placeholder: "搜索",
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
@@ -209,8 +186,9 @@ class _TaskPageState extends ConsumerState<TaskPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.symmetric(
|
||||||
left: 10,
|
horizontal: 15,
|
||||||
|
vertical: 10,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
"筛选",
|
"筛选",
|
||||||
@@ -258,7 +236,7 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ColoredBox(
|
return ColoredBox(
|
||||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
color: bean.isPinned == 1 ? ref.watch(themeProvider).themeColor.pinColor() : ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
child: Slidable(
|
child: Slidable(
|
||||||
key: ValueKey(bean.sId),
|
key: ValueKey(bean.sId),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
@@ -268,7 +246,7 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
SlidableAction(
|
SlidableAction(
|
||||||
backgroundColor: const Color(0xff5D5E70),
|
backgroundColor: const Color(0xff5D5E70),
|
||||||
onPressed: (_) {
|
onPressed: (_) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.endOfFrame.then((timeStamp) {
|
||||||
Navigator.of(context).pushNamed(Routes.routeAddTask, arguments: bean);
|
Navigator.of(context).pushNamed(Routes.routeAddTask, arguments: bean);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -278,19 +256,15 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
SlidableAction(
|
SlidableAction(
|
||||||
backgroundColor: const Color(0xffF19A39),
|
backgroundColor: const Color(0xffF19A39),
|
||||||
onPressed: (_) {
|
onPressed: (_) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
|
||||||
pinTask(context);
|
pinTask(context);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
icon: bean.isPinned! == 0 ? CupertinoIcons.pin : CupertinoIcons.pin_slash,
|
icon: (bean.isPinned ?? 0) == 0 ? CupertinoIcons.pin : CupertinoIcons.pin_slash,
|
||||||
),
|
),
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
backgroundColor: const Color(0xffA356D6),
|
backgroundColor: const Color(0xffA356D6),
|
||||||
onPressed: (_) {
|
onPressed: (_) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
|
||||||
enableTask(context);
|
enableTask(context);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
icon: bean.isDisabled! == 0 ? Icons.dnd_forwardslash : Icons.check_circle_outline_sharp,
|
icon: bean.isDisabled! == 0 ? Icons.dnd_forwardslash : Icons.check_circle_outline_sharp,
|
||||||
@@ -298,9 +272,7 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
SlidableAction(
|
SlidableAction(
|
||||||
backgroundColor: const Color(0xffEA4D3E),
|
backgroundColor: const Color(0xffEA4D3E),
|
||||||
onPressed: (_) {
|
onPressed: (_) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
|
||||||
delTask(context, ref);
|
delTask(context, ref);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
icon: CupertinoIcons.delete,
|
icon: CupertinoIcons.delete,
|
||||||
@@ -314,13 +286,17 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
SlidableAction(
|
SlidableAction(
|
||||||
backgroundColor: const Color(0xffD25535),
|
backgroundColor: const Color(0xffD25535),
|
||||||
onPressed: (_) {
|
onPressed: (_) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
|
||||||
if (bean.status! == 1) {
|
if (bean.status! == 1) {
|
||||||
startCron(context, ref);
|
startCron(
|
||||||
|
context,
|
||||||
|
ref,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
stopCron(context, ref);
|
stopCron(
|
||||||
|
context,
|
||||||
|
ref,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
icon: bean.status! == 1 ? CupertinoIcons.memories : CupertinoIcons.stop_circle,
|
icon: bean.status! == 1 ? CupertinoIcons.memories : CupertinoIcons.stop_circle,
|
||||||
@@ -328,7 +304,10 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
SlidableAction(
|
SlidableAction(
|
||||||
backgroundColor: const Color(0xff606467),
|
backgroundColor: const Color(0xff606467),
|
||||||
onPressed: (_) {
|
onPressed: (_) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
Future.delayed(
|
||||||
|
const Duration(
|
||||||
|
milliseconds: 250,
|
||||||
|
), () {
|
||||||
logCron(context, ref);
|
logCron(context, ref);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -338,14 +317,14 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
color: bean.isPinned == 1 ? ref.watch(themeProvider).themeColor.pinColor() : ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(Routes.routeTaskDetail, arguments: bean);
|
Navigator.of(context).pushNamed(Routes.routeTaskDetail, arguments: bean);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
color: bean.isPinned == 1 ? ref.watch(themeProvider).themeColor.pinColor() : Colors.transparent,
|
color: Colors.transparent,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 15,
|
horizontal: 15,
|
||||||
vertical: 8,
|
vertical: 8,
|
||||||
@@ -363,30 +342,12 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
bean.isDisabled == 1
|
ConstrainedBox(
|
||||||
? const Icon(
|
constraints: BoxConstraints.loose(
|
||||||
Icons.dnd_forwardslash,
|
Size.fromWidth(
|
||||||
size: 18,
|
MediaQuery.of(context).size.width / 2,
|
||||||
color: Color(0xffEA4D3E),
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
|
||||||
SizedBox(
|
|
||||||
width: bean.isDisabled == 1 ? 5 : 0,
|
|
||||||
),
|
|
||||||
bean.status == 1
|
|
||||||
? const SizedBox.shrink()
|
|
||||||
: SizedBox(
|
|
||||||
width: 13,
|
|
||||||
height: 13,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2,
|
|
||||||
color: ref.watch(themeProvider).primaryColor,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
|
||||||
width: bean.status == 1 ? 0 : 5,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -401,6 +362,30 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 7,
|
||||||
|
),
|
||||||
|
bean.status == 0
|
||||||
|
? Image.asset(
|
||||||
|
"assets/images/icon_running.png",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 45,
|
||||||
|
)
|
||||||
|
: Image.asset(
|
||||||
|
"assets/images/icon_idle.png",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 45,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 7,
|
||||||
|
),
|
||||||
|
bean.isDisabled == 1
|
||||||
|
? Image.asset(
|
||||||
|
"assets/images/icon_task_disable.png",
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 45,
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -459,52 +444,35 @@ class TaskItemCell extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startCron(BuildContext context, WidgetRef ref) async {
|
startCron(BuildContext context, WidgetRef ref) async {
|
||||||
await ref.read(taskProvider).runCrons( bean.sId!);
|
await ref.read(taskProvider).runCrons(bean.sId!);
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
Future.delayed(const Duration(milliseconds: 250), () {
|
||||||
logCron(context, ref);
|
logCron(context, ref);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
stopCron(BuildContext context, WidgetRef ref) {
|
stopCron(BuildContext context, WidgetRef ref) {
|
||||||
ref.read(taskProvider).stopCrons( bean.sId!);
|
ref.read(taskProvider).stopCrons(bean.sId!);
|
||||||
}
|
}
|
||||||
|
|
||||||
logCron(BuildContext context, WidgetRef ref) {
|
logCron(BuildContext context, WidgetRef ref) {
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
showCupertinoModalBottomSheet(
|
||||||
showCupertinoDialog(
|
expand: true,
|
||||||
useRootNavigator: false,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
backgroundColor: Colors.transparent,
|
||||||
return CupertinoAlertDialog(
|
builder: (context) => InTimeLogPage(
|
||||||
title: Text(
|
bean.sId!,
|
||||||
"${bean.name}运行日志",
|
true,
|
||||||
maxLines: 1,
|
bean.name ?? "",
|
||||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
|
||||||
),
|
),
|
||||||
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) {
|
void enableTask(BuildContext context) {
|
||||||
ref.read(taskProvider).enableTask( bean.sId!, bean.isDisabled!);
|
ref.read(taskProvider).enableTask(bean.sId!, bean.isDisabled!);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pinTask(BuildContext context) {
|
void pinTask(BuildContext context) {
|
||||||
ref.read(taskProvider).pinTask( bean.sId!, bean.isPinned!);
|
ref.read(taskProvider).pinTask(bean.sId!, bean.isPinned!);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delTask(BuildContext context, WidgetRef ref) {
|
void delTask(BuildContext context, WidgetRef ref) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class TaskViewModel extends BaseViewModel {
|
|||||||
List<TaskBean> disabled = [];
|
List<TaskBean> disabled = [];
|
||||||
|
|
||||||
Future<void> loadData([isLoading = true]) async {
|
Future<void> loadData([isLoading = true]) async {
|
||||||
if (isLoading) {
|
if (isLoading && list.isEmpty) {
|
||||||
loading(notify: true);
|
loading(notify: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
84
pubspec.lock
@@ -42,7 +42,7 @@ packages:
|
|||||||
name: back_button_interceptor
|
name: back_button_interceptor
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.2"
|
version: "6.0.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -168,7 +168,7 @@ packages:
|
|||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.16.0"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -189,7 +189,7 @@ packages:
|
|||||||
name: cupertino_icons
|
name: cupertino_icons
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
dart_style:
|
dart_style:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -224,7 +224,7 @@ packages:
|
|||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.0"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -258,6 +258,13 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_animator:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_animator
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.2"
|
||||||
flutter_app_name:
|
flutter_app_name:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -311,7 +318,7 @@ packages:
|
|||||||
name: flutter_riverpod
|
name: flutter_riverpod
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "1.0.4"
|
||||||
flutter_slidable:
|
flutter_slidable:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -433,7 +440,7 @@ packages:
|
|||||||
name: js
|
name: js
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.3"
|
version: "0.6.4"
|
||||||
json_annotation:
|
json_annotation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -503,7 +510,7 @@ packages:
|
|||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.3"
|
version: "0.1.4"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -518,6 +525,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
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:
|
move_to_background:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -580,7 +594,7 @@ packages:
|
|||||||
name: path
|
name: path
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.8.1"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -693,6 +707,48 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
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:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -781,7 +837,7 @@ packages:
|
|||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.1"
|
version: "1.8.2"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -837,7 +893,7 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.8"
|
version: "0.4.9"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -865,7 +921,7 @@ packages:
|
|||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.2"
|
version: "6.1.3"
|
||||||
url_launcher_android:
|
url_launcher_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -921,7 +977,7 @@ packages:
|
|||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -972,5 +1028,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.16.0 <3.0.0"
|
dart: ">=2.17.0-0 <3.0.0"
|
||||||
flutter: ">=2.10.1"
|
flutter: ">=3.0.0"
|
||||||
|
|||||||
25
pubspec.yaml
@@ -1,7 +1,7 @@
|
|||||||
name: qinglong_app
|
name: qinglong_app
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
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:
|
environment:
|
||||||
sdk: ">=2.15.1 <3.0.0"
|
sdk: ">=2.15.1 <3.0.0"
|
||||||
@@ -13,13 +13,13 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
cupertino_icons: ^1.0.4
|
cupertino_icons: ^1.0.5
|
||||||
flutter_riverpod: ^1.0.3
|
flutter_riverpod: ^1.0.4
|
||||||
shared_preferences: ^2.0.13
|
shared_preferences: ^2.0.15
|
||||||
synchronized: ^3.0.0
|
synchronized: ^3.0.0+2
|
||||||
back_button_interceptor: ^5.0.2
|
back_button_interceptor: ^6.0.0
|
||||||
flutter_slidable: ^1.2.0
|
flutter_slidable: ^1.3.0
|
||||||
dio: ^4.0.4
|
dio: ^4.0.6
|
||||||
dio_log: ^2.0.2
|
dio_log: ^2.0.2
|
||||||
json_conversion_annotation: ^0.0.4
|
json_conversion_annotation: ^0.0.4
|
||||||
logger: ^1.1.0
|
logger: ^1.1.0
|
||||||
@@ -27,14 +27,17 @@ dependencies:
|
|||||||
get_it: ^7.2.0
|
get_it: ^7.2.0
|
||||||
highlight: ^0.7.0
|
highlight: ^0.7.0
|
||||||
drag_and_drop_lists: ^0.3.2+2
|
drag_and_drop_lists: ^0.3.2+2
|
||||||
fluttertoast: ^8.0.8
|
fluttertoast: ^8.0.9
|
||||||
move_to_background: ^1.0.2
|
move_to_background: ^1.0.2
|
||||||
flip_card: ^0.6.0
|
flip_card: ^0.6.0
|
||||||
package_info_plus: ^1.4.0
|
package_info_plus: ^1.4.2
|
||||||
url_launcher: ^6.0.20
|
url_launcher: ^6.1.3
|
||||||
flutter_colorpicker: ^1.0.3
|
flutter_colorpicker: ^1.0.3
|
||||||
widget_with_codeview: ^2.0.1+2
|
widget_with_codeview: ^2.0.1+2
|
||||||
code_text_field: ^1.0.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 build_runner build --delete-conflicting-outputs
|
||||||
# flutter pub run change_app_package_name:main work.master.qinglongapp
|
# flutter pub run change_app_package_name:main work.master.qinglongapp
|
||||||
|
|||||||