mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: RNode
This commit is contained in:
@@ -15,7 +15,7 @@ class MyApp extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
_setup(context);
|
_setup(context);
|
||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
listenable: RebuildNodes.app,
|
listenable: RNodes.app,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
if (!Stores.setting.useSystemPrimaryColor.fetch()) {
|
if (!Stores.setting.useSystemPrimaryColor.fetch()) {
|
||||||
UIs.colorSeed = Color(Stores.setting.primaryColor.fetch());
|
UIs.colorSeed = Color(Stores.setting.primaryColor.fetch());
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class Backup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pros.reload();
|
Pros.reload();
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
|
|
||||||
_logger.info('Restore success');
|
_logger.info('Restore success');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
typedef GhId = String;
|
|
||||||
|
|
||||||
extension GhIdX on GhId {
|
|
||||||
String get url => 'https://github.com/$this';
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
class RebuildNode implements Listenable {
|
|
||||||
final List<VoidCallback> _listeners = [];
|
|
||||||
|
|
||||||
RebuildNode();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void addListener(VoidCallback listener) {
|
|
||||||
_listeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void removeListener(VoidCallback listener) {
|
|
||||||
_listeners.remove(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rebuild() {
|
|
||||||
for (var listener in _listeners) {
|
|
||||||
listener();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'package:toolbox/data/model/app/github_id.dart';
|
|
||||||
|
|
||||||
abstract final class GithubIds {
|
abstract final class GithubIds {
|
||||||
// Thanks
|
// Thanks
|
||||||
// If you want to change your Github ID, please open an issue.
|
// If you want to change your Github ID, please open an issue.
|
||||||
@@ -75,3 +73,9 @@ abstract final class GithubIds {
|
|||||||
'Jasonzhu1207',
|
'Jasonzhu1207',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef GhId = String;
|
||||||
|
|
||||||
|
extension GhIdX on GhId {
|
||||||
|
String get url => 'https://github.com/$this';
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:toolbox/data/model/app/rebuild.dart';
|
import 'package:fl_lib/fl_lib.dart';
|
||||||
|
|
||||||
abstract final class RebuildNodes {
|
abstract final class RNodes {
|
||||||
static final app = RebuildNode();
|
static final app = RNode();
|
||||||
}
|
static final dark = false.vn;
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import 'package:toolbox/core/channel/home_widget.dart';
|
|||||||
import 'package:toolbox/core/extension/build.dart';
|
import 'package:toolbox/core/extension/build.dart';
|
||||||
import 'package:toolbox/core/extension/context/locale.dart';
|
import 'package:toolbox/core/extension/context/locale.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/data/model/app/github_id.dart';
|
|
||||||
import 'package:toolbox/data/model/app/tab.dart';
|
import 'package:toolbox/data/model/app/tab.dart';
|
||||||
import 'package:toolbox/data/res/build_data.dart';
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
import 'package:toolbox/data/res/github_id.dart';
|
import 'package:toolbox/data/res/github_id.dart';
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_setting.primaryColor.put(color.value);
|
_setting.primaryColor.put(color.value);
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget _buildLaunchPage() {
|
// Widget _buildLaunchPage() {
|
||||||
@@ -393,7 +393,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
);
|
);
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
_setting.themeMode.put(selected);
|
_setting.themeMode.put(selected);
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
trailing: ValBuilder(
|
trailing: ValBuilder(
|
||||||
@@ -442,7 +442,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
_setting.fontPath.delete();
|
_setting.fontPath.delete();
|
||||||
context.pop();
|
context.pop();
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
},
|
},
|
||||||
child: Text(l10n.clear),
|
child: Text(l10n.clear),
|
||||||
)
|
)
|
||||||
@@ -466,7 +466,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.pop();
|
context.pop();
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTermFontSize() {
|
Widget _buildTermFontSize() {
|
||||||
@@ -536,7 +536,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
_setting.locale.put(selected.code);
|
_setting.locale.put(selected.code);
|
||||||
context.pop();
|
context.pop();
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
trailing: ListenBuilder(
|
trailing: ListenBuilder(
|
||||||
@@ -609,7 +609,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
subtitle: Text(l10n.fullScreenTip, style: UIs.textGrey),
|
subtitle: Text(l10n.fullScreenTip, style: UIs.textGrey),
|
||||||
trailing: StoreSwitch(
|
trailing: StoreSwitch(
|
||||||
prop: _setting.fullScreen,
|
prop: _setting.fullScreen,
|
||||||
callback: (_) => RebuildNodes.app.rebuild(),
|
callback: (_) => RNodes.app.build(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -820,7 +820,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_setting.textFactor.put(val);
|
_setting.textFactor.put(val);
|
||||||
RebuildNodes.app.rebuild();
|
RNodes.app.build();
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user