Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ class QueryaApp extends StatelessWidget {
scale: scale,
child: MediaQuery(
data: (mq ?? const MediaQueryData()).copyWith(
textScaler: TextScaler.linear(scale),
textScaler: TextScaler.linear(
(mq ?? const MediaQueryData())
.textScaler
.scale(1.0) *
scale,
),
),
child: QueryaThemeScope(
data: queryaTheme,
Expand Down
3 changes: 1 addition & 2 deletions lib/core/database/mongodb_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ class MongoConnection {
// fall back to "admin" (Mongo's default authSource).
final existingAuthSource = uri.queryParameters['authSource'];
final hasCredentials =
uri.userInfo.isNotEmpty ||
(username != null && username!.isNotEmpty);
uri.userInfo.isNotEmpty || (username != null && username!.isNotEmpty);

Map<String, String>? newQueryParams;
if (existingAuthSource == null && hasCredentials) {
Expand Down
6 changes: 4 additions & 2 deletions lib/core/database/mongodb_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ class MongoService {

return _withDb(connection, database, (db) async {
final coll = db.collection(collection);

final selector = where;
if (filter != null && filter.isNotEmpty) {
selector.raw(filter);
}
if (sort != null && sort.isNotEmpty) {
for (final entry in sort.entries) {
final isDesc = entry.value == -1 || entry.value == 'desc' || entry.value == 'DESC';
final isDesc = entry.value == -1 ||
entry.value == 'desc' ||
entry.value == 'DESC';
selector.sortBy(entry.key, descending: isDesc);
}
}
Expand Down
3 changes: 1 addition & 2 deletions lib/core/database/postgres_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,7 @@ ORDER BY grantee, privilege_type
.toList();
}

static String _quoteIdent(String id) =>
'"${id.replaceAll('"', '""')}"';
static String _quoteIdent(String id) => '"${id.replaceAll('"', '""')}"';

static bool _parsePgBool(Object? v) {
if (v is bool) return v;
Expand Down
3 changes: 2 additions & 1 deletion lib/core/database/postgres_connection_pool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class PostgresConnectionPool {
entry.refs++;
if (!entry.connection.isConnected) {
await entry.connection.connect();
await entry.connection.setSessionReadOnly(mode == PgSessionMode.readOnly);
await entry.connection
.setSessionReadOnly(mode == PgSessionMode.readOnly);
}
return PgLease._(this, k, entry.connection);
}
Expand Down
1 change: 0 additions & 1 deletion lib/core/database/postgres_sql.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ String injectSqlLimit(String sql, int limit) {

return '$body\nLIMIT $limit$suffix';
}

6 changes: 2 additions & 4 deletions lib/core/database/redis_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ class RedisConnection {
final result = await sendCommand(args);
if (result is List && result.length == 2) {
final nextCursor = int.tryParse(result[0].toString()) ?? 0;
final keys = (result[1] as List?)
?.map((e) => e.toString())
.toList() ??
[];
final keys =
(result[1] as List?)?.map((e) => e.toString()).toList() ?? [];
return (nextCursor, keys);
}
return (0, <String>[]);
Expand Down
4 changes: 2 additions & 2 deletions lib/core/editor/querya_code_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ class _QueryaCodeEditorState extends State<QueryaCodeEditor> {
decoration: material.InputDecoration(
border: material.InputBorder.none,
hintText: widget.hintText,
contentPadding: widget.contentPadding ??
const material.EdgeInsets.all(12),
contentPadding:
widget.contentPadding ?? const material.EdgeInsets.all(12),
),
onChanged: widget.onChanged,
);
Expand Down
5 changes: 2 additions & 3 deletions lib/core/editor/querya_highlight_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ class QueryaHighlightController extends TextEditingController {
required bool withComposing,
}) {
final brightness = Theme.of(context).brightness;
final themeConfig = brightness == Brightness.light
? lightThemeConfig
: darkThemeConfig;
final themeConfig =
brightness == Brightness.light ? lightThemeConfig : darkThemeConfig;

if (_cachedText == text &&
_cachedBrightness == brightness &&
Expand Down
5 changes: 2 additions & 3 deletions lib/core/editor/syntax_highlight_isolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ TextStyle? _styleFromSegment(HighlightSegment s, TextStyle? base) {
return (base ?? const TextStyle()).copyWith(
color: s.colorArgb != null ? Color(s.colorArgb!) : null,
fontWeight: _fontWeightFromValue(s.fontWeightValue),
fontStyle: s.fontStyleIndex != null
? FontStyle.values[s.fontStyleIndex!]
: null,
fontStyle:
s.fontStyleIndex != null ? FontStyle.values[s.fontStyleIndex!] : null,
);
}

Expand Down
6 changes: 4 additions & 2 deletions lib/core/layout/window_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ abstract class WindowLayout {
return BoxConstraints(
maxWidth: maxWidth != null ? context.scaled(maxWidth) : double.infinity,
minWidth: minWidth != null ? context.scaled(minWidth) : 0,
maxHeight: maxHeight != null ? context.scaled(maxHeight) : double.infinity,
maxHeight:
maxHeight != null ? context.scaled(maxHeight) : double.infinity,
minHeight: minHeight != null ? context.scaled(minHeight) : 0,
);
}
Expand All @@ -45,7 +46,8 @@ abstract class WindowLayout {
double viewportFactor = 1.0,
}) {
final available = math.max(0.0, screenExtent - insetTotal);
final base = math.min(baseMax, math.max(baseMin, available * viewportFactor));
final base =
math.min(baseMax, math.max(baseMin, available * viewportFactor));
return math.min(context.scaled(base), available);
}

Expand Down
14 changes: 6 additions & 8 deletions lib/core/market/marketplace_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ class MockMarketplaceClient implements MarketplaceClient {
String? type,
}) async {
final normalized = query.trim().toLowerCase();
return _items
.where((item) {
if (type != null && item.type != type) return false;
if (normalized.isEmpty) return true;
return item.name.toLowerCase().contains(normalized) ||
item.id.toLowerCase().contains(normalized);
})
.toList(growable: false);
return _items.where((item) {
if (type != null && item.type != type) return false;
if (normalized.isEmpty) return true;
return item.name.toLowerCase().contains(normalized) ||
item.id.toLowerCase().contains(normalized);
}).toList(growable: false);
}
}
5 changes: 2 additions & 3 deletions lib/core/motion/querya_animated_expand.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ class QueryaAnimatedExpand extends StatelessWidget {
curve: context.motionCurve(QueryaMotion.enter),
alignment: alignment,
clipBehavior: Clip.hardEdge,
child: expanded
? child
: const SizedBox(width: double.infinity, height: 0),
child:
expanded ? child : const SizedBox(width: double.infinity, height: 0),
);
}
}
23 changes: 14 additions & 9 deletions lib/core/storage/app_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ class AppSettings {
}

Future<String?> getSelectedThemeId() async {
final v = await LocalDb.instance.getAppSetting(AppSettingsKeys.themeSelectedId);
final v =
await LocalDb.instance.getAppSetting(AppSettingsKeys.themeSelectedId);
if (v == null || v.isEmpty) return null;
return v;
}
Expand All @@ -348,8 +349,8 @@ class AppSettings {
}

Future<String?> getSelectedThemeSource() async {
final v =
await LocalDb.instance.getAppSetting(AppSettingsKeys.themeSelectedSource);
final v = await LocalDb.instance
.getAppSetting(AppSettingsKeys.themeSelectedSource);
if (v == null || v.isEmpty) return null;
return v;
}
Expand Down Expand Up @@ -377,7 +378,8 @@ class AppSettings {

Future<void> setSelectedThemePath(String? path) async {
if (path == null || path.isEmpty) {
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedPath);
await LocalDb.instance
.deleteAppSetting(AppSettingsKeys.themeSelectedPath);
} else {
await LocalDb.instance.setAppSetting(
AppSettingsKeys.themeSelectedPath,
Expand All @@ -389,7 +391,8 @@ class AppSettings {

Future<void> clearSelectedThemeRegistry() async {
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedId);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedSource);
await LocalDb.instance
.deleteAppSetting(AppSettingsKeys.themeSelectedSource);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedPath);
AppSettingsRevision.bump();
}
Expand Down Expand Up @@ -452,8 +455,8 @@ class AppSettings {
}

Future<Map<String, String>> getThemeColorOverrides() async {
final v =
await LocalDb.instance.getAppSetting(AppSettingsKeys.themeOverridesJson);
final v = await LocalDb.instance
.getAppSetting(AppSettingsKeys.themeOverridesJson);
if (v == null || v.isEmpty) return {};
try {
final decoded = jsonDecode(v);
Expand Down Expand Up @@ -519,9 +522,11 @@ class AppSettings {
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeMode);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themePreset);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeOverridesJson);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeAnimationEnabled);
await LocalDb.instance
.deleteAppSetting(AppSettingsKeys.themeAnimationEnabled);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedId);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedSource);
await LocalDb.instance
.deleteAppSetting(AppSettingsKeys.themeSelectedSource);
await LocalDb.instance.deleteAppSetting(AppSettingsKeys.themeSelectedPath);
await deleteThemeImportKeys();
AppSettingsRevision.bump();
Expand Down
9 changes: 6 additions & 3 deletions lib/core/storage/connection_secrets_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class ConnectionSecretsStore {

static const _keyPrefix = 'querya.v1.conn';

static String _passwordKey(int connectionId) => '$_keyPrefix.$connectionId.password';
static String _passwordKey(int connectionId) =>
'$_keyPrefix.$connectionId.password';
static String _connectionStringKey(int connectionId) =>
'$_keyPrefix.$connectionId.connection_string';

Expand All @@ -51,11 +52,13 @@ class ConnectionSecretsStore {
await backend.write(_connectionStringKey(connectionId), connectionString);
}

static Future<({String? password, String? connectionString})> readForConnection(
static Future<({String? password, String? connectionString})>
readForConnection(
int connectionId,
) async {
final password = await backend.read(_passwordKey(connectionId));
final connectionString = await backend.read(_connectionStringKey(connectionId));
final connectionString =
await backend.read(_connectionStringKey(connectionId));
return (password: password, connectionString: connectionString);
}

Expand Down
5 changes: 4 additions & 1 deletion lib/core/storage/folders_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class FoldersStorage {
final decoded = jsonDecode(content) as Map<String, Object?>;
final list = decoded[_keyFolders];
final names = list != null && list is List<Object?>
? list.map((e) => e?.toString() ?? '').where((s) => s.isNotEmpty).toList()
? list
.map((e) => e?.toString() ?? '')
.where((s) => s.isNotEmpty)
.toList()
: <String>[];
final existing = await LocalDb.instance.getFolders();
for (final name in names) {
Expand Down
15 changes: 10 additions & 5 deletions lib/core/storage/local_db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ class LocalDb {
await db.execute('ALTER TABLE connections ADD COLUMN password TEXT');
await db.execute('ALTER TABLE connections ADD COLUMN database_name TEXT');
await db.execute('ALTER TABLE connections ADD COLUMN auth_source TEXT');
await db.execute('ALTER TABLE connections ADD COLUMN use_ssl INTEGER NOT NULL DEFAULT 0');
await db.execute('ALTER TABLE connections ADD COLUMN connection_string TEXT');
await db.execute(
'ALTER TABLE connections ADD COLUMN use_ssl INTEGER NOT NULL DEFAULT 0');
await db
.execute('ALTER TABLE connections ADD COLUMN connection_string TEXT');
}
if (oldVersion < 3) {
await db.execute('PRAGMA foreign_keys=ON');
Expand Down Expand Up @@ -319,15 +321,18 @@ class LocalDb {

Future<int?> getFolderIdByName(String name) async {
final db = await _open();
final rows = await db.query('folders', columns: ['id'], where: 'name = ?', whereArgs: [name]);
final rows = await db.query('folders',
columns: ['id'], where: 'name = ?', whereArgs: [name]);
if (rows.isEmpty) return null;
return _sqliteInt(rows.first['id']);
}

Future<List<ConnectionRow>> getConnections() async {
final db = await _open();
final rows = await db.query('connections', orderBy: 'sort_order ASC, name ASC');
final futures = rows.map((m) => _hydrateConnection(ConnectionRow.fromMap(m)));
final rows =
await db.query('connections', orderBy: 'sort_order ASC, name ASC');
final futures =
rows.map((m) => _hydrateConnection(ConnectionRow.fromMap(m)));
return Future.wait(futures);
}

Expand Down
7 changes: 5 additions & 2 deletions lib/core/theme/parser/color_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ Color parseQueryaThemeColor(String raw) {

/// Encodes a [Color] as a VS Code hex string (`#RRGGBB` or `#RRGGBBAA`).
String formatVsCodeColor(Color color) {
String channel(double component) =>
(component * 255.0).round().clamp(0, 255).toRadixString(16).padLeft(2, '0');
String channel(double component) => (component * 255.0)
.round()
.clamp(0, 255)
.toRadixString(16)
.padLeft(2, '0');
final rr = channel(color.r);
final gg = channel(color.g);
final bb = channel(color.b);
Expand Down
3 changes: 2 additions & 1 deletion lib/core/theme/parser/querya_theme_color_scheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ ColorScheme colorSchemeFromQueryaThemeColors({
final destructive = pick('destructive', base.destructive);
// querya.theme.v1 still maps this key; shadcn marks the ColorScheme field legacy.
// ignore: deprecated_member_use
final destructiveForeground = pick('destructiveForeground', base.destructiveForeground);
final destructiveForeground =
pick('destructiveForeground', base.destructiveForeground);

return ColorScheme(
brightness: base.brightness,
Expand Down
3 changes: 1 addition & 2 deletions lib/core/theme/parser/querya_theme_from_manifest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import 'querya_workbench_theme_from_manifest.dart';
QueryaTheme queryaThemeFromManifest(QueryaThemeManifest manifest) {
final fallback =
manifest.isLight ? QueryaTheme.lightDefault : QueryaTheme.darkDefault;
final brightness =
manifest.isLight ? Brightness.light : Brightness.dark;
final brightness = manifest.isLight ? Brightness.light : Brightness.dark;

var editor = editorThemeFromQueryaColors(
colors: manifest.editorColors,
Expand Down
3 changes: 1 addition & 2 deletions lib/core/theme/parser/querya_theme_from_vscode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ QueryaTheme buildQueryaThemeFromVsCodeManifest(
brightness: brightness,
);

final editorForegroundChanged =
editor.foreground != base.editor.foreground;
final editorForegroundChanged = editor.foreground != base.editor.foreground;
if (schemeForeground != null || editorForegroundChanged) {
final fg = schemeForeground ?? editor.foreground;
colorScheme = colorScheme.copyWith(
Expand Down
9 changes: 6 additions & 3 deletions lib/core/theme/parser/querya_theme_manifest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,19 @@ class QueryaThemeManifest {
case 'light':
return QueryaThemeType.light;
default:
throw QueryaThemeManifestParseException('Invalid type "$raw"; expected dark or light');
throw QueryaThemeManifestParseException(
'Invalid type "$raw"; expected dark or light');
}
}

static Map<String, String> _parseColorMap(Object? raw, String fieldName) {
if (raw == null) {
throw QueryaThemeManifestParseException('Missing required field "$fieldName"');
throw QueryaThemeManifestParseException(
'Missing required field "$fieldName"');
}
if (raw is! Map) {
throw QueryaThemeManifestParseException('"$fieldName" must be a JSON object');
throw QueryaThemeManifestParseException(
'"$fieldName" must be a JSON object');
}

final colors = <String, String>{};
Expand Down
3 changes: 1 addition & 2 deletions lib/core/theme/parser/token_style_resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class TokenStyleResolver {
List<String> _scopePrefixes(String scope) {
final parts = scope.split('.');
return [
for (var i = parts.length; i >= 1; i--)
parts.sublist(0, i).join('.'),
for (var i = parts.length; i >= 1; i--) parts.sublist(0, i).join('.'),
];
}

Expand Down
3 changes: 2 additions & 1 deletion lib/core/theme/parser/vscode_theme_manifest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class VsCodeThemeManifest {
try {
decoded = jsonDecode(cleaned);
} on FormatException catch (e) {
throw VsCodeThemeParseException('Invalid JSON after JSONC strip: ${e.message}');
throw VsCodeThemeParseException(
'Invalid JSON after JSONC strip: ${e.message}');
}
if (decoded is! Map<String, dynamic>) {
throw VsCodeThemeParseException('Theme root must be a JSON object');
Expand Down
Loading
Loading