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) {
|
||||
"提交成功".toast();
|
||||
ref.read(configProvider).loadContent(widget.title);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop(widget.title);
|
||||
} else {
|
||||
(response.message ?? "").toast();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ class ConfigPage extends StatefulWidget {
|
||||
ConfigPageState createState() => ConfigPageState();
|
||||
}
|
||||
|
||||
class ConfigPageState extends State<ConfigPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
class ConfigPageState extends State<ConfigPage> with SingleTickerProviderStateMixin {
|
||||
TabController? _tabController;
|
||||
|
||||
@override
|
||||
@@ -29,8 +28,7 @@ class ConfigPageState extends State<ConfigPage>
|
||||
Widget build(BuildContext context) {
|
||||
return BaseStateWidget<ConfigViewModel>(
|
||||
builder: (ref, model, child) {
|
||||
_tabController ??=
|
||||
TabController(length: model.list.length, vsync: this);
|
||||
_tabController ??= TabController(length: model.list.length, vsync: this);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
@@ -62,10 +60,7 @@ class ConfigPageState extends State<ConfigPage>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
),
|
||||
theme: ref
|
||||
.watch(themeProvider)
|
||||
.themeColor
|
||||
.codeEditorTheme(),
|
||||
theme: ref.watch(themeProvider).themeColor.codeEditorTheme(),
|
||||
tabSize: 14,
|
||||
),
|
||||
),
|
||||
@@ -87,8 +82,12 @@ class ConfigPageState extends State<ConfigPage>
|
||||
if (_tabController == null || _tabController!.length == 0) return;
|
||||
navigatorState.currentState?.pushNamed(Routes.routeConfigEdit, arguments: {
|
||||
"title": ref.read(configProvider).list[_tabController?.index ?? 0].title,
|
||||
"content": ref.read(configProvider).content[
|
||||
ref.read(configProvider).list[_tabController?.index ?? 0].title]
|
||||
"content": ref.read(configProvider).content[ref.read(configProvider).list[_tabController?.index ?? 0].title]
|
||||
}).then((value) async {
|
||||
if (value != null && (value as String).isNotEmpty) {
|
||||
await ref.read(configProvider).loadContent(value);
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user