@@ -661,6 +661,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
661661 session.rows = [];
662662 session.affectedRows = null ;
663663 session.statusLine = null ;
664+ session.elapsed = null ;
664665 session.planRoot = null ;
665666 session.resultGridPrimaryKeys = const [];
666667 session.resultGridColumnDataTypes = null ;
@@ -756,6 +757,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
756757 session.stagingBuffer = null ;
757758 session.statusLine = scriptStatus ??
758759 _resultStatus (result, cols, outRows, null );
760+ session.elapsed = multi ? sw.elapsed : result.elapsed ?? sw.elapsed;
759761 session.running = false ;
760762 });
761763 // Anything that is not a read may change table shapes: forget the cache.
@@ -903,6 +905,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
903905 session.rows = [];
904906 session.affectedRows = null ;
905907 session.statusLine = null ;
908+ session.elapsed = null ;
906909 session.planRoot = null ;
907910 session.resultGridPrimaryKeys = const [];
908911 session.resultGridColumnDataTypes = null ;
@@ -1322,6 +1325,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
13221325 isLoading: session.running,
13231326 affectedRows: session.affectedRows,
13241327 statusLine: session.statusLine,
1328+ elapsed: session.elapsed,
13251329 stagingBuffer: session.stagingBuffer,
13261330 columnDataTypes: session.resultGridColumnDataTypes,
13271331 onApplyChanges: widget.isReadOnly ||
@@ -1349,7 +1353,12 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
13491353 ) {
13501354 final accent = context.workbench.accent;
13511355 final historyEnabled = widget.connectionRow.id != null && ! session.running;
1352- return material.SingleChildScrollView (
1356+ return material.LayoutBuilder (
1357+ builder: (context, constraints) {
1358+ // Below the breakpoint the labels hide and the icons stay (the
1359+ // tooltips name them), so the toolbar stays on one row.
1360+ final compact = constraints.maxWidth < _toolbarCompactWidth;
1361+ return material.SingleChildScrollView (
13531362 scrollDirection: material.Axis .horizontal,
13541363 child: material.Row (
13551364 children: [
@@ -1361,6 +1370,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
13611370 key: const material.ValueKey ('run_script' ),
13621371 label: 'Execute (F5)' ,
13631372 icon: material.Icons .play_arrow_rounded,
1373+ compact: compact,
13641374 loading: session.running,
13651375 onPressed: () => execute (session),
13661376 ),
@@ -1395,6 +1405,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
13951405 key: const material.ValueKey ('explain_query' ),
13961406 label: 'Explain' ,
13971407 icon: material.Icons .account_tree_outlined,
1408+ compact: compact,
13981409 tooltip: 'Show the query plan' ,
13991410 onPressed: session.running ? null : () => explain (session),
14001411 ),
@@ -1405,6 +1416,7 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
14051416 key: const material.ValueKey ('cancel_query' ),
14061417 label: 'Cancel' ,
14071418 icon: material.Icons .stop_rounded,
1419+ compact: compact,
14081420 isDestructive: true ,
14091421 tooltip: 'Interrupt the running query' ,
14101422 onPressed: () => cancelRunning (session),
@@ -1480,10 +1492,12 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
14801492 material.Icon (material.Icons .tune_rounded,
14811493 size: 16 , color: accent),
14821494 const material.SizedBox (width: 6 ),
1483- Text (_autocommit
1484- ? 'Session · auto-commit'
1485- : 'Session · manual' ),
1486- const material.SizedBox (width: 4 ),
1495+ if (! compact) ...[
1496+ Text (_autocommit
1497+ ? 'Session · auto-commit'
1498+ : 'Session · manual' ),
1499+ const material.SizedBox (width: 4 ),
1500+ ],
14871501 material.Icon (material.Icons .expand_more_rounded,
14881502 size: 16 , color: accent),
14891503 ],
@@ -1499,8 +1513,13 @@ class GenericSqlWorkspaceState extends material.State<GenericSqlWorkspace> {
14991513 ],
15001514 ),
15011515 );
1516+ },
1517+ );
15021518 }
15031519
1520+ /// Toolbar width below which button labels hide and only icons stay.
1521+ static const double _toolbarCompactWidth = 900 ;
1522+
15041523 /// Transaction state as a badge: an open transaction is a warning, because
15051524 /// work can be lost, and looks different from no transaction.
15061525 material.Widget _txBadge () {
0 commit comments