58 lines
1.7 KiB
Dart
58 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:superport/screens/common/theme_tailwind.dart';
|
|
import 'package:superport/screens/common/metronic_card.dart';
|
|
|
|
/// 메트로닉 스타일 데이터 테이블 카드 위젯 (SRP 분리)
|
|
class MetronicDataTable extends StatelessWidget {
|
|
final List<DataColumn> columns;
|
|
final List<DataRow> rows;
|
|
final String? title;
|
|
final bool isLoading;
|
|
final String? emptyMessage;
|
|
|
|
const MetronicDataTable({
|
|
Key? key,
|
|
required this.columns,
|
|
required this.rows,
|
|
this.title,
|
|
this.isLoading = false,
|
|
this.emptyMessage,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MetronicCard(
|
|
title: title,
|
|
child:
|
|
isLoading
|
|
? const Center(child: CircularProgressIndicator())
|
|
: rows.isEmpty
|
|
? Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: Text(
|
|
emptyMessage ?? '데이터가 없습니다.',
|
|
style: AppThemeTailwind.bodyStyle,
|
|
),
|
|
),
|
|
)
|
|
: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: DataTable(
|
|
columns: columns,
|
|
rows: rows,
|
|
headingRowColor: MaterialStateProperty.all(
|
|
AppThemeTailwind.light,
|
|
),
|
|
dataRowMaxHeight: 60,
|
|
columnSpacing: 24,
|
|
horizontalMargin: 16,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|