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,110 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Column width specification for DataGrid columns.
|
||||
sealed class DataGridColumnWidth {
|
||||
const DataGridColumnWidth._();
|
||||
|
||||
/// Fixed width in logical pixels.
|
||||
const factory DataGridColumnWidth.fixed(double width) = GridFixedWidth;
|
||||
|
||||
/// Flexible width with flex factor (like Expanded).
|
||||
const factory DataGridColumnWidth.flex([int flex]) = GridFlexWidth;
|
||||
|
||||
/// Fraction of available width (0.0 to 1.0).
|
||||
const factory DataGridColumnWidth.fraction(double fraction) =
|
||||
GridFractionWidth;
|
||||
}
|
||||
|
||||
/// Fixed column width.
|
||||
final class GridFixedWidth extends DataGridColumnWidth {
|
||||
const GridFixedWidth(this.width) : super._();
|
||||
final double width;
|
||||
}
|
||||
|
||||
/// Flexible column width.
|
||||
final class GridFlexWidth extends DataGridColumnWidth {
|
||||
const GridFlexWidth([this.flex = 1]) : super._();
|
||||
final int flex;
|
||||
}
|
||||
|
||||
/// Fractional column width.
|
||||
final class GridFractionWidth extends DataGridColumnWidth {
|
||||
const GridFractionWidth(this.fraction)
|
||||
: assert(fraction > 0 && fraction <= 1),
|
||||
super._();
|
||||
final double fraction;
|
||||
}
|
||||
|
||||
/// Column alignment options.
|
||||
enum DataGridColumnAlignment {
|
||||
start,
|
||||
center,
|
||||
end,
|
||||
}
|
||||
|
||||
/// Column definition for DataGrid.
|
||||
class DataGridColumn<T> {
|
||||
const DataGridColumn({
|
||||
required this.header,
|
||||
required this.valueBuilder,
|
||||
this.cellBuilder,
|
||||
this.cellControlsBuilder,
|
||||
this.width = const DataGridColumnWidth.flex(1),
|
||||
this.alignment = DataGridColumnAlignment.start,
|
||||
this.sortable = false,
|
||||
this.sortField,
|
||||
this.searchable = false,
|
||||
this.visible = true,
|
||||
this.tooltip,
|
||||
});
|
||||
|
||||
/// Column header text.
|
||||
final String header;
|
||||
|
||||
/// Extracts the string value from an item for sorting/searching.
|
||||
final String Function(T item) valueBuilder;
|
||||
|
||||
/// Custom cell widget builder. If null, displays valueBuilder result as text.
|
||||
final Widget Function(BuildContext context, T item)? cellBuilder;
|
||||
|
||||
/// Additional controls to show in the cell (e.g., quick actions).
|
||||
final Widget Function(BuildContext context, T item)? cellControlsBuilder;
|
||||
|
||||
/// Column width specification.
|
||||
final DataGridColumnWidth width;
|
||||
|
||||
/// Text alignment within the column.
|
||||
final DataGridColumnAlignment alignment;
|
||||
|
||||
/// Whether this column can be sorted.
|
||||
final bool sortable;
|
||||
|
||||
/// API field name for server-side sorting. Defaults to using header if null.
|
||||
final String? sortField;
|
||||
|
||||
/// Whether this column is included in search.
|
||||
final bool searchable;
|
||||
|
||||
/// Whether this column is visible.
|
||||
final bool visible;
|
||||
|
||||
/// Tooltip builder for cell hover.
|
||||
final String Function(T item)? tooltip;
|
||||
|
||||
/// Gets the effective sort field name.
|
||||
String get effectiveSortField => sortField ?? header.toLowerCase();
|
||||
|
||||
/// Converts alignment enum to CrossAxisAlignment.
|
||||
CrossAxisAlignment get crossAxisAlignment => switch (alignment) {
|
||||
DataGridColumnAlignment.start => CrossAxisAlignment.start,
|
||||
DataGridColumnAlignment.center => CrossAxisAlignment.center,
|
||||
DataGridColumnAlignment.end => CrossAxisAlignment.end,
|
||||
};
|
||||
|
||||
/// Converts alignment enum to TextAlign.
|
||||
TextAlign get textAlign => switch (alignment) {
|
||||
DataGridColumnAlignment.start => TextAlign.start,
|
||||
DataGridColumnAlignment.center => TextAlign.center,
|
||||
DataGridColumnAlignment.end => TextAlign.end,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user