search json text (#554)(#507)(#110)

This commit is contained in:
wanghongenpin
2025-08-23 05:30:42 +08:00
parent 26fe6115cd
commit bde6c4e0ce
6 changed files with 228 additions and 87 deletions

View File

@@ -1,20 +1,27 @@
import 'package:flutter/material.dart';
enum ColorTheme {
light(
background: Color(0xffffffff),
propertyKey: Color(0xff871094),
colon: Colors.black,
string: Color(0xff067d17),
number: Color(0xff1750eb),
keyword: Color(0xff0033b3)),
dark(
background: Color(0xff2b2b2b),
propertyKey: Color(0xff9876aa),
colon: Color(0xffcc7832),
string: Color(0xff6a8759),
number: Color(0xff6897bb),
keyword: Color(0xffcc7832));
class ColorTheme {
static ColorTheme light(ColorScheme colorScheme) => ColorTheme(
background: const Color(0xffffffff),
propertyKey: const Color(0xff871094),
colon: Colors.black,
string: const Color(0xff067d17),
number: const Color(0xff1750eb),
keyword: const Color(0xff0033b3),
searchMatchColor: colorScheme.inversePrimary,
searchMatchCurrentColor: colorScheme.primary,
);
static ColorTheme dark(ColorScheme colorScheme) => ColorTheme(
background: const Color(0xff2b2b2b),
propertyKey: const Color(0xff9876aa),
colon: const Color(0xffcc7832),
string: const Color(0xff6a8759),
number: const Color(0xff6897bb),
keyword: const Color(0xffcc7832),
searchMatchColor: colorScheme.inversePrimary,
searchMatchCurrentColor: colorScheme.primary,
);
final Color background;
final Color propertyKey;
@@ -22,16 +29,23 @@ enum ColorTheme {
final Color string;
final Color number;
final Color keyword;
final Color? searchMatchColor;
final Color? searchMatchCurrentColor;
const ColorTheme(
{required this.background,
required this.propertyKey,
required this.colon,
required this.string,
required this.number,
required this.keyword});
const ColorTheme({
required this.background,
required this.propertyKey,
required this.colon,
required this.string,
required this.number,
required this.keyword,
required this.searchMatchColor,
required this.searchMatchCurrentColor,
});
static ColorTheme of(Brightness brightness) {
return brightness == Brightness.dark ? ColorTheme.dark : ColorTheme.light;
static ColorTheme of(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
final brightness = Theme.of(context).brightness;
return brightness == Brightness.dark ? ColorTheme.dark(colorScheme) : ColorTheme.light(colorScheme);
}
}