refactor: UI 일관성 개선 및 테이블 구조 통일
장비관리 화면을 기준으로 전체 화면 UI 일관성 개선: - 모든 화면 검색바/버튼/드롭다운 높이 40px 통일 - 테이블 헤더 패딩 vertical 10px, 행 패딩 vertical 4px 통일 - 배지 스타일 통일 (border 제거, opacity 0.9 적용) - 페이지네이션 10개 이하에서도 항상 표시 - 테이블 헤더 폰트 스타일 통일 (fontSize: 13, fontWeight: w500) 각 화면별 수정사항: 1. 장비관리: 컬럼 너비 최적화, 검색 컴포넌트 높이 명시 2. 입고지 관리: 페이지네이션 조건 개선 3. 회사관리: UnifiedSearchBar 통합, 배지 스타일 개선 4. 유지보수: ListView.builder → map() 변경, 테이블 구조 재설계 키포인트 색상을 teal로 통일하여 브랜드 일관성 확보
This commit is contained in:
143
lib/screens/common/layouts/base_list_screen.dart
Normal file
143
lib/screens/common/layouts/base_list_screen.dart
Normal file
@@ -0,0 +1,143 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
|
||||
/// 모든 리스트 화면의 기본 레이아웃을 제공하는 베이스 위젯
|
||||
///
|
||||
/// 일관된 레이아웃 구조를 보장하기 위한 템플릿
|
||||
class BaseListScreen extends StatelessWidget {
|
||||
final Widget? headerSection; // 상단 통계 카드 등
|
||||
final Widget searchBar; // 검색바 섹션
|
||||
final Widget? filterSection; // 필터 섹션
|
||||
final Widget actionBar; // 액션 버튼 섹션
|
||||
final Widget dataTable; // 데이터 테이블
|
||||
final Widget? pagination; // 페이지네이션
|
||||
final bool isLoading;
|
||||
final String? error;
|
||||
final VoidCallback? onRefresh;
|
||||
final String emptyMessage;
|
||||
final IconData emptyIcon;
|
||||
|
||||
const BaseListScreen({
|
||||
Key? key,
|
||||
this.headerSection,
|
||||
required this.searchBar,
|
||||
this.filterSection,
|
||||
required this.actionBar,
|
||||
required this.dataTable,
|
||||
this.pagination,
|
||||
this.isLoading = false,
|
||||
this.error,
|
||||
this.onRefresh,
|
||||
this.emptyMessage = '데이터가 없습니다',
|
||||
this.emptyIcon = Icons.inbox_outlined,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isLoading) {
|
||||
return _buildLoadingState();
|
||||
}
|
||||
|
||||
if (error != null) {
|
||||
return _buildErrorState();
|
||||
}
|
||||
|
||||
return Container(
|
||||
color: ShadcnTheme.background,
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 헤더 섹션 (통계 카드 등)
|
||||
if (headerSection != null) ...[
|
||||
headerSection!,
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
],
|
||||
|
||||
// 검색바 섹션
|
||||
searchBar,
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
|
||||
// 필터 섹션
|
||||
if (filterSection != null) ...[
|
||||
filterSection!,
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
],
|
||||
|
||||
// 액션바 섹션
|
||||
actionBar,
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
|
||||
// 데이터 테이블
|
||||
dataTable,
|
||||
|
||||
// 페이지네이션
|
||||
if (pagination != null) ...[
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
pagination!,
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLoadingState() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(color: ShadcnTheme.primary),
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
Text('데이터를 불러오는 중...', style: ShadcnTheme.bodyMuted),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildErrorState() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 48, color: ShadcnTheme.destructive),
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
Text('오류가 발생했습니다', style: ShadcnTheme.headingH4),
|
||||
const SizedBox(height: ShadcnTheme.spacing2),
|
||||
Text(error ?? '', style: ShadcnTheme.bodyMuted),
|
||||
if (onRefresh != null) ...[
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
ElevatedButton(
|
||||
onPressed: onRefresh,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ShadcnTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
),
|
||||
child: const Text('다시 시도'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildEmptyState() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(emptyIcon, size: 48, color: ShadcnTheme.mutedForeground),
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
Text(emptyMessage, style: ShadcnTheme.bodyMuted),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user