프로젝트 최초 커밋
This commit is contained in:
57
lib/screens/common/metronic_data_table.dart
Normal file
57
lib/screens/common/metronic_data_table.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user