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
31 changes: 31 additions & 0 deletions lib/core/motion/querya_animated_expand.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';

import 'querya_motion.dart';
import 'querya_motion_context.dart';

/// Animates height when [expanded] toggles (connection tree sections, etc.).
class QueryaAnimatedExpand extends StatelessWidget {
const QueryaAnimatedExpand({
super.key,
required this.expanded,
required this.child,
this.alignment = Alignment.topCenter,
});

final bool expanded;
final Widget child;
final Alignment alignment;

@override
Widget build(BuildContext context) {
return AnimatedSize(
duration: context.motionDuration(QueryaMotion.standard),
curve: context.motionCurve(QueryaMotion.enter),
alignment: alignment,
clipBehavior: Clip.hardEdge,
child: expanded
? child
: const SizedBox(width: double.infinity, height: 0),
);
}
}
41 changes: 41 additions & 0 deletions lib/core/motion/querya_cross_fade_stack.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';

import 'querya_motion.dart';
import 'querya_motion_context.dart';

/// Like [IndexedStack] but cross-fades the active child; off-screen children
/// stay mounted (preserves SQL editor state, etc.).
class QueryaCrossFadeStack extends StatelessWidget {
const QueryaCrossFadeStack({
super.key,
required this.index,
required this.children,
});

final int index;
final List<Widget> children;

@override
Widget build(BuildContext context) {
final duration = context.motionDuration(QueryaMotion.standard);
final curve = context.motionCurve(QueryaMotion.enter);

return Stack(
fit: StackFit.expand,
children: [
for (var i = 0; i < children.length; i++)
Positioned.fill(
child: IgnorePointer(
ignoring: index != i,
child: AnimatedOpacity(
opacity: index == i ? 1 : 0,
duration: duration,
curve: curve,
child: children[i],
),
),
),
],
);
}
}
1 change: 1 addition & 0 deletions lib/features/connections/connections_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:querya_desktop/core/database/redis_info.dart';
import 'package:querya_desktop/core/storage/folders_storage.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/theme/querya_typography.dart';
import 'package:querya_desktop/core/motion/querya_animated_expand.dart';
import 'package:querya_desktop/core/motion/querya_motion.dart';
import 'package:querya_desktop/core/motion/querya_motion_context.dart';
import 'package:querya_desktop/features/connections/connection_creation_flow.dart';
Expand Down
9 changes: 8 additions & 1 deletion lib/features/connections/connections_panel_mongo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ class _MongoConnectionTileState extends State<_MongoConnectionTile> {
],
),
// Expanded database children
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
if (_loading)
material.Padding(
padding: const material.EdgeInsets.only(left: 28, top: 4, bottom: 4),
Expand Down Expand Up @@ -301,6 +306,8 @@ class _MongoConnectionTileState extends State<_MongoConnectionTile> {
},
),
],
),
),
],
),
),
Expand Down
20 changes: 17 additions & 3 deletions lib/features/connections/connections_panel_mysql.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ class _MysqlConnectionTileState extends State<_MysqlConnectionTile> {
),
],
),
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
if (_loading)
material.Padding(
padding:
Expand Down Expand Up @@ -236,6 +241,8 @@ class _MysqlConnectionTileState extends State<_MysqlConnectionTile> {
onMysqlOpenSqlWorkspace: widget.onMysqlOpenSqlWorkspace,
),
],
),
),
],
),
),
Expand Down Expand Up @@ -412,7 +419,12 @@ class _MysqlDatabaseNodeState extends State<_MysqlDatabaseNode> {
: (c, {database, schema, name, kind}) =>
widget.onMysqlOpenSqlWorkspace!(c),
),
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
if (_loading)
material.Padding(
padding:
Expand Down Expand Up @@ -541,7 +553,9 @@ class _MysqlDatabaseNodeState extends State<_MysqlDatabaseNode> {
],
),
),
],
],
),
),
],
),
);
Expand Down
40 changes: 30 additions & 10 deletions lib/features/connections/connections_panel_pg_tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,9 @@ class _PgDatabasesNodeState extends State<_PgDatabasesNode> {
onContextRefresh: widget.onRefreshDatabases,
onOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace,
),
if (_expanded)
lazyConnectionTreeList(
QueryaAnimatedExpand(
expanded: _expanded,
child: lazyConnectionTreeList(
context: context,
itemCount: widget.databases.length,
itemBuilder: (context, index) {
Expand All @@ -249,6 +250,7 @@ class _PgDatabasesNodeState extends State<_PgDatabasesNode> {
);
},
),
),
],
),
);
Expand Down Expand Up @@ -350,7 +352,12 @@ class _PgDatabaseNodeState extends State<_PgDatabaseNode> {
onContextRefresh: _loadSchemas,
onOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace,
),
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
_PgDbToolRow(
connection: widget.connection,
databaseName: widget.databaseName,
Expand Down Expand Up @@ -397,7 +404,9 @@ class _PgDatabaseNodeState extends State<_PgDatabaseNode> {
onPostgresOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace,
onRefreshSchemas: _loadSchemas,
),
],
],
),
),
],
),
);
Expand Down Expand Up @@ -531,8 +540,9 @@ class _PgSchemasNodeState extends State<_PgSchemasNode> {
onContextRefresh: widget.onRefreshSchemas,
onOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace,
),
if (_expanded)
lazyConnectionTreeList(
QueryaAnimatedExpand(
expanded: _expanded,
child: lazyConnectionTreeList(
context: context,
itemCount: widget.schemas.length,
itemBuilder: (context, index) {
Expand All @@ -549,6 +559,7 @@ class _PgSchemasNodeState extends State<_PgSchemasNode> {
);
},
),
),
],
),
);
Expand Down Expand Up @@ -672,7 +683,12 @@ class _PgSchemaNodeState extends State<_PgSchemaNode> {
onContextRefresh: _loadObjects,
onOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace,
),
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
if (_loading)
material.Padding(
padding:
Expand Down Expand Up @@ -825,7 +841,9 @@ class _PgSchemaNodeState extends State<_PgSchemaNode> {
onContextRefresh: _loadObjects,
),
],
],
],
),
),
],
),
);
Expand Down Expand Up @@ -963,8 +981,9 @@ class _PgObjectGroupState extends State<_PgObjectGroup> {
onContextRefresh: widget.onRefresh,
onOpenSqlWorkspace: widget.onPostgresOpenSqlWorkspace,
),
if (_expanded)
lazyConnectionTreeList(
QueryaAnimatedExpand(
expanded: _expanded,
child: lazyConnectionTreeList(
context: context,
itemCount: widget.items.length,
itemExtent: kConnectionTreeRowExtent,
Expand Down Expand Up @@ -998,6 +1017,7 @@ class _PgObjectGroupState extends State<_PgObjectGroup> {
);
},
),
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ class _PostgresConnectionTileState extends State<_PostgresConnectionTile> {
),
],
),
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
if (_loading)
material.Padding(
padding:
Expand Down Expand Up @@ -231,6 +236,8 @@ class _PostgresConnectionTileState extends State<_PostgresConnectionTile> {
},
),
],
),
),
],
),
),
Expand Down
9 changes: 8 additions & 1 deletion lib/features/connections/connections_panel_redis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ class _RedisConnectionTileState extends State<_RedisConnectionTile> {
],
),
// Expanded database children — ALL 16 databases
if (_expanded) ...[
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.stretch,
children: [
if (_loading)
material.Padding(
padding: const material.EdgeInsets.only(left: 28, top: 4, bottom: 4),
Expand Down Expand Up @@ -242,6 +247,8 @@ class _RedisConnectionTileState extends State<_RedisConnectionTile> {
onTap: () => widget.onDatabaseTap?.call(db.index),
),
],
),
),
],
),
),
Expand Down
6 changes: 4 additions & 2 deletions lib/features/connections/connections_panel_sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ class _FolderTileState extends State<_FolderTile> {
),
),
),
if (_expanded)
material.Padding(
QueryaAnimatedExpand(
expanded: _expanded,
child: material.Padding(
padding: const material.EdgeInsets.only(left: 24),
child: lazyConnectionTreeList(
context: context,
Expand All @@ -295,6 +296,7 @@ class _FolderTileState extends State<_FolderTile> {
},
),
),
),
],
),
),
Expand Down
5 changes: 3 additions & 2 deletions lib/features/main_screen/workspace_panel.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart' as material show Alignment, Axis, Container, EdgeInsets, BoxDecoration, GestureDetector, Padding, BorderRadius, Center, Icon, Icons, MouseRegion, AnimatedContainer, AnimatedScale, SystemMouseCursors, SizedBox, SingleChildScrollView, Row, MainAxisSize;
import 'package:querya_desktop/core/layout/vertical_split_pane.dart';
import 'package:querya_desktop/core/motion/querya_cross_fade_stack.dart';
import 'package:querya_desktop/core/motion/querya_motion.dart';
import 'package:querya_desktop/core/motion/querya_motion_context.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
Expand Down Expand Up @@ -212,7 +213,7 @@ class _WorkspacePanelState extends State<WorkspacePanel> {
),
const Divider(height: 1),
Expanded(
child: IndexedStack(
child: QueryaCrossFadeStack(
index: _editorTabIndex,
children: const [
QueryEditorTab(),
Expand All @@ -233,7 +234,7 @@ class _WorkspacePanelState extends State<WorkspacePanel> {
),
const Divider(height: 1),
Expanded(
child: IndexedStack(
child: QueryaCrossFadeStack(
index: _outputTabIndex,
children: const [
ResultsTab(),
Expand Down
4 changes: 2 additions & 2 deletions lib/features/mysql/mysql_workspace_home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async' show unawaited;

import 'package:flutter/material.dart' as material;
import 'package:querya_desktop/core/motion/querya_cross_fade_stack.dart';
import 'package:querya_desktop/core/motion/querya_motion.dart';
import 'package:querya_desktop/core/motion/querya_motion_context.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
Expand Down Expand Up @@ -109,9 +110,8 @@ class _MysqlWorkspaceHomeState extends material.State<MysqlWorkspaceHome> {
),
const Divider(height: 1),
Expanded(
child: material.IndexedStack(
child: QueryaCrossFadeStack(
index: _tab,
sizing: material.StackFit.expand,
children: [
MysqlStatsView(
key: ValueKey('mysql_stats_${widget.connectionRow.id}'),
Expand Down
4 changes: 2 additions & 2 deletions lib/features/postgresql/postgres_workspace_home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async' show unawaited;

import 'package:flutter/material.dart' as material;
import 'package:querya_desktop/core/motion/querya_cross_fade_stack.dart';
import 'package:querya_desktop/core/motion/querya_motion.dart';
import 'package:querya_desktop/core/motion/querya_motion_context.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
Expand Down Expand Up @@ -152,9 +153,8 @@ class _PostgresWorkspaceHomeState extends material.State<PostgresWorkspaceHome>
),
const Divider(height: 1),
Expanded(
child: material.IndexedStack(
child: QueryaCrossFadeStack(
index: _tab,
sizing: material.StackFit.expand,
children: [
PostgresStatsView(
key: ValueKey('pg_stats_${widget.connectionRow.id}'),
Expand Down
Loading
Loading