fix & opt

fix: cant ping when launch page is ping
fix: button text color not primaryColor
opt: getting primaryColor
This commit is contained in:
lollipopkit
2023-02-01 17:18:46 +08:00
parent 2faea10d61
commit 21ac323ed1
28 changed files with 445 additions and 423 deletions

View File

@@ -0,0 +1,15 @@
import 'package:flutter/widgets.dart';
import '../../../core/utils/ui.dart';
class DynamicColor {
/// 白天模式显示的颜色
Color light;
/// 暗黑模式显示的颜色
Color dark;
DynamicColor(this.light, this.dark);
Color resolve(BuildContext context) => isDarkMode(context) ? dark : light;
}

View File

@@ -275,4 +275,4 @@ class _TryLimiter {
void resetTryTimes(String id) {
_triedTimes[id] = 0;
}
}
}

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 203;
static const int build = 205;
static const String engine =
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (8 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n";
static const String buildAt = "2023-02-01 12:58:12.944187";
static const int modifications = 13;
static const String buildAt = "2023-02-01 14:57:28.662965";
static const int modifications = 5;
}

View File

@@ -1,18 +1,11 @@
import 'package:flutter/material.dart';
import 'package:toolbox/data/store/setting.dart';
import 'package:toolbox/locator.dart';
import '../../core/utils/ui.dart';
import '../model/app/dynamic_color.dart';
class DynamicColor {
/// 白天模式显示的颜色
Color light;
Color primaryColor = Color(locator<SettingStore>().primaryColor.fetch()!);
/// 暗黑模式显示的颜色
Color dark;
DynamicColor(this.light, this.dark);
resolve(BuildContext context) => isDarkMode(context) ? dark : light;
}
final mainColor = DynamicColor(Colors.black87, Colors.white70);
final contentColor = DynamicColor(Colors.black87, Colors.white70);
final bgColor = DynamicColor(Colors.white, Colors.black);
final progressColor = DynamicColor(Colors.grey.shade100, Colors.white10);