mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
修改配置文件修改后返回首页没有及时刷新的bug
This commit is contained in:
@@ -49,7 +49,7 @@ class _ConfigEditPageState extends ConsumerState<ConfigEditPage> {
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
"提交成功".toast();
|
"提交成功".toast();
|
||||||
ref.read(configProvider).loadContent(widget.title);
|
ref.read(configProvider).loadContent(widget.title);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop(widget.title);
|
||||||
} else {
|
} else {
|
||||||
(response.message ?? "").toast();
|
(response.message ?? "").toast();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ class ConfigPage extends StatefulWidget {
|
|||||||
ConfigPageState createState() => ConfigPageState();
|
ConfigPageState createState() => ConfigPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConfigPageState extends State<ConfigPage>
|
class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMixin {
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
TabController? _tabController;
|
TabController? _tabController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -29,8 +28,7 @@ class ConfigPageState extends State<ConfigPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BaseStateWidget<ConfigViewModel>(
|
return BaseStateWidget<ConfigViewModel>(
|
||||||
builder: (ref, model, child) {
|
builder: (ref, model, child) {
|
||||||
_tabController ??=
|
_tabController ??= TabController(length: model.list.length, vsync: this);
|
||||||
TabController(length: model.list.length, vsync: this);
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -62,10 +60,7 @@ class ConfigPageState extends State<ConfigPage>
|
|||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 15,
|
horizontal: 15,
|
||||||
),
|
),
|
||||||
theme: ref
|
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(),
|
||||||
.watch(themeProvider)
|
|
||||||
.themeColor
|
|
||||||
.codeEditorTheme(),
|
|
||||||
tabSize: 14,
|
tabSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -87,8 +82,12 @@ class ConfigPageState extends State<ConfigPage>
|
|||||||
if (_tabController == null || _tabController!.length == 0) return;
|
if (_tabController == null || _tabController!.length == 0) return;
|
||||||
navigatorState.currentState?.pushNamed(Routes.routeConfigEdit, arguments: {
|
navigatorState.currentState?.pushNamed(Routes.routeConfigEdit, arguments: {
|
||||||
"title": ref.read(configProvider).list[_tabController?.index ?? 0].title,
|
"title": ref.read(configProvider).list[_tabController?.index ?? 0].title,
|
||||||
"content": ref.read(configProvider).content[
|
"content": ref.read(configProvider).content[ref.read(configProvider).list[_tabController?.index ?? 0].title]
|
||||||
ref.read(configProvider).list[_tabController?.index ?? 0].title]
|
}).then((value) async {
|
||||||
|
if (value != null && (value as String).isNotEmpty) {
|
||||||
|
await ref.read(configProvider).loadContent(value);
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user