fix(app): cap the list width on very wide monitors
This commit is contained in:
@@ -3,6 +3,8 @@ import 'dart:async';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/layout/content_width.dart';
|
||||
|
||||
import '../../../../core/api_gateway.dart';
|
||||
import '../../../../shell/shell_bar.dart';
|
||||
import '../../data/chat_repository.dart';
|
||||
@@ -201,7 +203,8 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
ChatSessionsBody(
|
||||
ContentWidth(
|
||||
child: ChatSessionsBody(
|
||||
sessions: _controller.sessions,
|
||||
activeSessionId: widget.activeSessionId,
|
||||
query: _search.text,
|
||||
@@ -224,6 +227,7 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||
isUnseen: _controller.isUnseen,
|
||||
errorFor: _controller.errorFor,
|
||||
onDismissError: _controller.dismissError,
|
||||
),
|
||||
),
|
||||
// The web's hide report is a fixed overlay: replacing or
|
||||
// growing it must never move the list or overflow the screen.
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../core/api_gateway.dart';
|
||||
import '../../shell/shell_bar.dart';
|
||||
import '../../ui/layout/content_width.dart';
|
||||
import 'pipeline_models.dart';
|
||||
import 'pipeline_repository.dart';
|
||||
import 'pipelines_controller.dart';
|
||||
@@ -239,9 +240,15 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
),
|
||||
),
|
||||
);
|
||||
if (!wide) return PipelineListPanel(controller: _controller);
|
||||
if (!wide) {
|
||||
return ContentWidth(
|
||||
child: PipelineListPanel(controller: _controller),
|
||||
);
|
||||
}
|
||||
return ListDetailPanes(
|
||||
list: PipelineListPanel(controller: _controller),
|
||||
list: ContentWidth(
|
||||
child: PipelineListPanel(controller: _controller),
|
||||
),
|
||||
detail: PipelineDetailPanel(
|
||||
controller: _controller,
|
||||
gateway: widget.gateway,
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../../shell/detail_page.dart';
|
||||
import '../../shell/list_detail.dart';
|
||||
import '../../ui/adaptive/host.dart';
|
||||
import '../attention/notify/notification_controller.dart';
|
||||
import '../../ui/layout/content_width.dart';
|
||||
import '../attention/runtime/attention_controller.dart';
|
||||
import '../attention/runtime/attention_store.dart';
|
||||
import 'actions/decision_action.dart';
|
||||
@@ -259,7 +260,8 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
);
|
||||
final list = AnimatedBuilder(
|
||||
animation: controller,
|
||||
builder: (context, _) => RunsList(
|
||||
builder: (context, _) => ContentWidth(
|
||||
child: RunsList(
|
||||
active: narrow ? !selected : true,
|
||||
controller: controller,
|
||||
onSelected: _select,
|
||||
@@ -269,6 +271,7 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
notifications: widget.notifications,
|
||||
attention: widget.attention,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (narrow) return list;
|
||||
return ListDetailPanes(
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// The widest a list column grows on a large monitor.
|
||||
///
|
||||
/// Web pages keep their lists readable instead of stretching a row across the
|
||||
/// whole display; the same cap applies to the native lists.
|
||||
const double kContentMaxWidth = 1100;
|
||||
|
||||
/// Centres [child] and caps its width, keeping the incoming height constraints.
|
||||
class ContentWidth extends StatelessWidget {
|
||||
const ContentWidth({super.key, required this.child, this.maxWidth = kContentMaxWidth});
|
||||
|
||||
final Widget child;
|
||||
final double maxWidth;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user