feat: add Control Room with containers and stacks management
- Add Control Room page with stacks sidebar and containers list - Implement container actions (start/stop/restart) with snackbars - Add container logs viewer dialog - Add search/filter for both stacks and containers lists - Add external links for Portainer and Netdata (url_launcher) - Add VS Code launch configuration for Flutter web debugging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
dd6bcbdbda
commit
3b89ed8c18
@@ -0,0 +1,144 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data_grid_column.dart';
|
||||
import '../data_grid_config.dart';
|
||||
|
||||
/// Header row for DataGrid.
|
||||
class DataGridHeader<T> extends StatelessWidget {
|
||||
const DataGridHeader({
|
||||
super.key,
|
||||
required this.config,
|
||||
required this.sortColumnIndex,
|
||||
required this.sortDescending,
|
||||
required this.onSort,
|
||||
this.showCheckbox = false,
|
||||
this.allSelected = false,
|
||||
this.someSelected = false,
|
||||
this.onSelectAll,
|
||||
});
|
||||
|
||||
final DataGridConfig<T> config;
|
||||
final int? sortColumnIndex;
|
||||
final bool sortDescending;
|
||||
final void Function(int columnIndex) onSort;
|
||||
final bool showCheckbox;
|
||||
final bool allSelected;
|
||||
final bool someSelected;
|
||||
final VoidCallback? onSelectAll;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final columns = config.visibleColumns;
|
||||
|
||||
return Container(
|
||||
height: config.headerHeight,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: colorScheme.outlineVariant),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (showCheckbox)
|
||||
SizedBox(
|
||||
width: 56,
|
||||
child: Center(
|
||||
child: Checkbox(
|
||||
value: allSelected ? true : (someSelected ? null : false),
|
||||
tristate: true,
|
||||
onChanged: (_) => onSelectAll?.call(),
|
||||
),
|
||||
),
|
||||
),
|
||||
...columns.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final column = entry.value;
|
||||
final isSorted = sortColumnIndex == index;
|
||||
|
||||
return _buildHeaderCell(
|
||||
context,
|
||||
column,
|
||||
index,
|
||||
isSorted,
|
||||
isSorted && sortDescending,
|
||||
);
|
||||
}),
|
||||
if (config.actions.isNotEmpty)
|
||||
const SizedBox(width: 56), // Space for actions column
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeaderCell(
|
||||
BuildContext context,
|
||||
DataGridColumn<T> column,
|
||||
int index,
|
||||
bool isSorted,
|
||||
bool isDescending,
|
||||
) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final textStyle = Theme.of(context).textTheme.labelLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
);
|
||||
|
||||
Widget content = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
column.header,
|
||||
style: textStyle,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: column.textAlign,
|
||||
),
|
||||
),
|
||||
if (column.sortable) ...[
|
||||
const SizedBox(width: 4),
|
||||
AnimatedRotation(
|
||||
turns: isDescending ? 0.5 : 0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: Icon(
|
||||
isSorted ? Icons.arrow_upward : Icons.unfold_more,
|
||||
size: 16,
|
||||
color: isSorted
|
||||
? colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
|
||||
if (column.sortable) {
|
||||
content = InkWell(
|
||||
onTap: () => onSort(index),
|
||||
child: Padding(
|
||||
padding: config.cellPadding,
|
||||
child: content,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
content = Padding(
|
||||
padding: config.cellPadding,
|
||||
child: content,
|
||||
);
|
||||
}
|
||||
|
||||
return _wrapWithWidth(column.width, content);
|
||||
}
|
||||
|
||||
Widget _wrapWithWidth(DataGridColumnWidth width, Widget child) {
|
||||
return switch (width) {
|
||||
GridFixedWidth(:final width) => SizedBox(width: width, child: child),
|
||||
GridFlexWidth(:final flex) => Expanded(flex: flex, child: child),
|
||||
GridFractionWidth(:final fraction) => FractionallySizedBox(
|
||||
widthFactor: fraction,
|
||||
child: child,
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user