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:
235
lib/screens/common/widgets/standard_action_bar.dart
Normal file
235
lib/screens/common/widgets/standard_action_bar.dart
Normal file
@@ -0,0 +1,235 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||
|
||||
/// 표준 액션바 위젯
|
||||
///
|
||||
/// 모든 리스트 화면에서 일관된 액션 버튼 배치와 상태 표시 제공
|
||||
class StandardActionBar extends StatelessWidget {
|
||||
final List<Widget> leftActions; // 왼쪽 액션 버튼들
|
||||
final List<Widget> rightActions; // 오른쪽 액션 버튼들
|
||||
final int? selectedCount; // 선택된 항목 수
|
||||
final int totalCount; // 전체 항목 수
|
||||
final VoidCallback? onRefresh; // 새로고침 콜백
|
||||
final String? statusMessage; // 추가 상태 메시지
|
||||
|
||||
const StandardActionBar({
|
||||
Key? key,
|
||||
this.leftActions = const [],
|
||||
this.rightActions = const [],
|
||||
this.selectedCount,
|
||||
required this.totalCount,
|
||||
this.onRefresh,
|
||||
this.statusMessage,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// 왼쪽 액션 버튼들
|
||||
Row(
|
||||
children: [
|
||||
...leftActions.map((action) => Padding(
|
||||
padding: const EdgeInsets.only(right: ShadcnTheme.spacing2),
|
||||
child: action,
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
||||
// 오른쪽 상태 표시 및 액션들
|
||||
Row(
|
||||
children: [
|
||||
// 추가 상태 메시지
|
||||
if (statusMessage != null) ...[
|
||||
Text(statusMessage!, style: ShadcnTheme.bodyMuted),
|
||||
const SizedBox(width: ShadcnTheme.spacing3),
|
||||
],
|
||||
|
||||
// 선택된 항목 수 표시
|
||||
if (selectedCount != null && selectedCount! > 0) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.primary.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusSm),
|
||||
border: Border.all(color: ShadcnTheme.primary.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Text(
|
||||
'$selectedCount개 선택됨',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ShadcnTheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing3),
|
||||
],
|
||||
|
||||
// 전체 항목 수 표시
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 6,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusSm),
|
||||
),
|
||||
child: Text(
|
||||
'총 $totalCount개',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
|
||||
// 새로고침 버튼
|
||||
if (onRefresh != null) ...[
|
||||
const SizedBox(width: ShadcnTheme.spacing3),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: onRefresh,
|
||||
tooltip: '새로고침',
|
||||
iconSize: 20,
|
||||
),
|
||||
],
|
||||
|
||||
// 오른쪽 액션 버튼들
|
||||
...rightActions.map((action) => Padding(
|
||||
padding: const EdgeInsets.only(left: ShadcnTheme.spacing2),
|
||||
child: action,
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 표준 액션 버튼 그룹
|
||||
class StandardActionButtons {
|
||||
/// 추가 버튼
|
||||
static Widget addButton({
|
||||
required String text,
|
||||
required VoidCallback onPressed,
|
||||
IconData icon = Icons.add,
|
||||
}) {
|
||||
return ShadcnButton(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: Icon(icon, size: 16),
|
||||
);
|
||||
}
|
||||
|
||||
/// 삭제 버튼
|
||||
static Widget deleteButton({
|
||||
required VoidCallback? onPressed,
|
||||
bool enabled = true,
|
||||
String text = '삭제',
|
||||
}) {
|
||||
return ShadcnButton(
|
||||
text: text,
|
||||
onPressed: enabled ? onPressed : null,
|
||||
variant: enabled
|
||||
? ShadcnButtonVariant.destructive
|
||||
: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.delete, size: 16),
|
||||
);
|
||||
}
|
||||
|
||||
/// 엑셀 내보내기 버튼
|
||||
static Widget exportButton({
|
||||
required VoidCallback onPressed,
|
||||
String text = '엑셀 내보내기',
|
||||
}) {
|
||||
return ShadcnButton(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.download, size: 16),
|
||||
);
|
||||
}
|
||||
|
||||
/// 엑셀 가져오기 버튼
|
||||
static Widget importButton({
|
||||
required VoidCallback onPressed,
|
||||
String text = '엑셀 가져오기',
|
||||
}) {
|
||||
return ShadcnButton(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.upload, size: 16),
|
||||
);
|
||||
}
|
||||
|
||||
/// 새로고침 버튼
|
||||
static Widget refreshButton({
|
||||
required VoidCallback onPressed,
|
||||
String text = '새로고침',
|
||||
}) {
|
||||
return ShadcnButton(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.refresh, size: 16),
|
||||
);
|
||||
}
|
||||
|
||||
/// 필터 초기화 버튼
|
||||
static Widget clearFiltersButton({
|
||||
required VoidCallback onPressed,
|
||||
String text = '필터 초기화',
|
||||
}) {
|
||||
return ShadcnButton(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
variant: ShadcnButtonVariant.ghost,
|
||||
icon: const Icon(Icons.clear_all, size: 16),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 표준 필터 드롭다운
|
||||
class StandardFilterDropdown<T> extends StatelessWidget {
|
||||
final T value;
|
||||
final List<DropdownMenuItem<T>> items;
|
||||
final ValueChanged<T?> onChanged;
|
||||
final String? hint;
|
||||
|
||||
const StandardFilterDropdown({
|
||||
Key? key,
|
||||
required this.value,
|
||||
required this.items,
|
||||
required this.onChanged,
|
||||
this.hint,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 40,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<T>(
|
||||
value: value,
|
||||
items: items,
|
||||
onChanged: onChanged,
|
||||
hint: hint != null ? Text(hint!) : null,
|
||||
style: ShadcnTheme.bodySmall,
|
||||
icon: const Icon(Icons.arrow_drop_down, size: 20),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user