支持上传脚本

This commit is contained in:
jyuesong
2022-06-16 14:37:47 +08:00
parent 2005083d2e
commit 1298dba590
58 changed files with 1702 additions and 774 deletions

View File

@@ -47,8 +47,8 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
});
}
Future<void> notifyICloud(BuildContext context, String? title, String? content) async {
}
Future<void> notifyICloud(
BuildContext context, String? title, String? content) async {}
@override
Widget build(BuildContext context) {
@@ -60,7 +60,8 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
},
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(),
stringMap: {
"export": const TextStyle(fontWeight: FontWeight.normal, color: Color(0xff6B2375)),
"export": const TextStyle(
fontWeight: FontWeight.normal, color: Color(0xff6B2375)),
},
);
return Scaffold(
@@ -122,10 +123,10 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
...operateList
.map(
(e) => PopupMenuItem<String>(
child: Text(e),
value: e,
),
)
child: Text(e),
value: e,
),
)
.toList(),
],
child: const Center(
@@ -137,7 +138,8 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
),
InkWell(
onTap: () async {
HttpResponse<NullResponse> response = await Api.saveFile(widget.title, result);
HttpResponse<NullResponse> response =
await Api.saveFile(widget.title, result);
await notifyICloud(context, widget.title, result);
if (response.success) {
"提交成功".toast();
@@ -226,7 +228,8 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
}
} catch (e) {}
TextEditingController controller = TextEditingController(text: defaultValue.replaceAll("\"", "").replaceAll("'", ""));
TextEditingController controller = TextEditingController(
text: defaultValue.replaceAll("\"", "").replaceAll("'", ""));
showCupertinoDialog(
useRootNavigator: false,
context: context,

View File

@@ -24,7 +24,8 @@ class ConfigPage extends StatefulWidget {
ConfigPageState createState() => ConfigPageState();
}
class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
class ConfigPageState extends State<ConfigPage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
int _initIndex = 0;
BuildContext? childContext;
@@ -89,8 +90,14 @@ class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMi
void editMe(WidgetRef ref) {
if (childContext == null) return;
navigatorState.currentState?.pushNamed(Routes.routeConfigEdit, arguments: {
"title": ref.read(configProvider).list[DefaultTabController.of(childContext!)?.index ?? 0].title,
"content": ref.read(configProvider).content[ref.read(configProvider).list[DefaultTabController.of(childContext!)?.index ?? 0].title]
"title": ref
.read(configProvider)
.list[DefaultTabController.of(childContext!)?.index ?? 0]
.title,
"content": ref.read(configProvider).content[ref
.read(configProvider)
.list[DefaultTabController.of(childContext!)?.index ?? 0]
.title]
}).then((value) async {
if (value != null && (value as String).isNotEmpty) {
await ref.read(configProvider).loadContent(value);
@@ -115,7 +122,8 @@ class CodeWidget extends ConsumerStatefulWidget {
ConsumerState<CodeWidget> createState() => _CodeWidgetState();
}
class _CodeWidgetState extends ConsumerState<CodeWidget> with AutomaticKeepAliveClientMixin {
class _CodeWidgetState extends ConsumerState<CodeWidget>
with AutomaticKeepAliveClientMixin {
CodeController? _codeController;
@override
@@ -143,7 +151,8 @@ class _CodeWidgetState extends ConsumerState<CodeWidget> with AutomaticKeepAlive
},
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(),
stringMap: {
"export": const TextStyle(fontWeight: FontWeight.normal, color: Color(0xff6B2375)),
"export": const TextStyle(
fontWeight: FontWeight.normal, color: Color(0xff6B2375)),
},
);
return SafeArea(