bharat_erp/lib/shared/widgets/app_table_shell.dart
2026-07-17 12:21:02 +05:30

62 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'app_card.dart';
import 'app_search_filter_toggle.dart';
/// Card shell for list pages: toolbar, divider, full-width table body, footer.
class AppTableShell extends StatelessWidget {
const AppTableShell({
super.key,
required this.toolbar,
required this.child,
this.footer,
this.toolbarExpanded = false,
});
final Widget toolbar;
final Widget child;
final Widget? footer;
/// When false (default), the search/filter toolbar is collapsed.
final bool toolbarExpanded;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return AppCard(
enableHover: false,
clipBehavior: Clip.none,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: theme.colorScheme.outline.withValues(alpha: 0.12),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
AppCollapsibleFilterPanel(
expanded: toolbarExpanded,
child: toolbar,
),
// Clip so scrolling rows cannot paint over the footer/pagination.
Expanded(child: ClipRect(child: child)),
if (footer != null) ...[
const Divider(height: 1),
Material(
color: theme.colorScheme.surface,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: footer!,
),
),
],
],
),
);
}
}