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:
@@ -199,7 +199,7 @@ class _AppLayoutRedesignState extends State<AppLayoutRedesign>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.background,
|
color: ShadcnTheme.background,
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
boxShadow: ShadcnTheme.cardShadow,
|
boxShadow: ShadcnTheme.cardShadow,
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -237,10 +237,9 @@ class _AppLayoutRedesignState extends State<AppLayoutRedesign>
|
|||||||
height: 64,
|
height: 64,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.background,
|
color: ShadcnTheme.background,
|
||||||
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
|
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.05),
|
color: Colors.black.withValues(alpha: 0.05),
|
||||||
blurRadius: 10,
|
blurRadius: 10,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 2),
|
||||||
),
|
),
|
||||||
@@ -368,7 +367,6 @@ class _AppLayoutRedesignState extends State<AppLayoutRedesign>
|
|||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.background,
|
color: ShadcnTheme.background,
|
||||||
border: Border(right: BorderSide(color: ShadcnTheme.border)),
|
|
||||||
),
|
),
|
||||||
child: SidebarMenuRedesign(
|
child: SidebarMenuRedesign(
|
||||||
currentRoute: _currentRoute,
|
currentRoute: _currentRoute,
|
||||||
@@ -385,7 +383,7 @@ class _AppLayoutRedesignState extends State<AppLayoutRedesign>
|
|||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
|
border: Border(bottom: BorderSide(color: Colors.black)),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class ShadcnCard extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.card,
|
color: ShadcnTheme.card,
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
boxShadow: ShadcnTheme.cardShadow,
|
boxShadow: ShadcnTheme.cardShadow,
|
||||||
),
|
),
|
||||||
child: child,
|
child: child,
|
||||||
@@ -145,7 +145,7 @@ class ShadcnButton extends StatelessWidget {
|
|||||||
return OutlinedButton.styleFrom(
|
return OutlinedButton.styleFrom(
|
||||||
backgroundColor: backgroundColor ?? ShadcnTheme.secondary,
|
backgroundColor: backgroundColor ?? ShadcnTheme.secondary,
|
||||||
foregroundColor: textColor ?? ShadcnTheme.secondaryForeground,
|
foregroundColor: textColor ?? ShadcnTheme.secondaryForeground,
|
||||||
side: const BorderSide(color: ShadcnTheme.border),
|
side: const BorderSide(color: Colors.black),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@@ -180,12 +180,12 @@ class ShadcnButton extends StatelessWidget {
|
|||||||
case ShadcnButtonSize.small:
|
case ShadcnButtonSize.small:
|
||||||
return const EdgeInsets.symmetric(
|
return const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing3,
|
horizontal: ShadcnTheme.spacing3,
|
||||||
vertical: ShadcnTheme.spacing1,
|
vertical: 6,
|
||||||
);
|
);
|
||||||
case ShadcnButtonSize.medium:
|
case ShadcnButtonSize.medium:
|
||||||
return const EdgeInsets.symmetric(
|
return const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing4,
|
horizontal: ShadcnTheme.spacing4,
|
||||||
vertical: ShadcnTheme.spacing2,
|
vertical: 10,
|
||||||
);
|
);
|
||||||
case ShadcnButtonSize.large:
|
case ShadcnButtonSize.large:
|
||||||
return const EdgeInsets.symmetric(
|
return const EdgeInsets.symmetric(
|
||||||
@@ -291,7 +291,7 @@ class ShadcnInput extends StatelessWidget {
|
|||||||
fillColor: ShadcnTheme.background,
|
fillColor: ShadcnTheme.background,
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing3,
|
horizontal: ShadcnTheme.spacing3,
|
||||||
vertical: ShadcnTheme.spacing2,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
@@ -317,7 +317,7 @@ class ShadcnInput extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintStyle: ShadcnTheme.bodyMedium.copyWith(
|
hintStyle: ShadcnTheme.bodyMedium.copyWith(
|
||||||
color: ShadcnTheme.mutedForeground,
|
color: ShadcnTheme.mutedForeground.withValues(alpha: 0.8),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -392,7 +392,7 @@ class ShadcnBadge extends StatelessWidget {
|
|||||||
Color _getBorderColor() {
|
Color _getBorderColor() {
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
case ShadcnBadgeVariant.outline:
|
case ShadcnBadgeVariant.outline:
|
||||||
return ShadcnTheme.border;
|
return Colors.black;
|
||||||
default:
|
default:
|
||||||
return Colors.transparent;
|
return Colors.transparent;
|
||||||
}
|
}
|
||||||
@@ -448,7 +448,7 @@ class ShadcnSeparator extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
width: direction == Axis.horizontal ? double.infinity : thickness,
|
width: direction == Axis.horizontal ? double.infinity : thickness,
|
||||||
height: direction == Axis.vertical ? double.infinity : thickness,
|
height: direction == Axis.vertical ? double.infinity : thickness,
|
||||||
color: color ?? ShadcnTheme.border,
|
color: color ?? Colors.black,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ class ShadcnAvatar extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: backgroundColor ?? ShadcnTheme.muted,
|
color: backgroundColor ?? ShadcnTheme.muted,
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
),
|
),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child:
|
child:
|
||||||
|
|||||||
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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,58 +3,63 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
|
|
||||||
/// shadcn/ui 스타일 테마 시스템
|
/// shadcn/ui 스타일 테마 시스템
|
||||||
class ShadcnTheme {
|
class ShadcnTheme {
|
||||||
// shadcn/ui 색상 시스템
|
// Teal 기반 색상 시스템
|
||||||
static const Color background = Color(0xFFFFFFFF);
|
static const Color background = Color(0xFFFFFFFF);
|
||||||
static const Color foreground = Color(0xFF020817);
|
static const Color foreground = Color(0xFF0F172A);
|
||||||
static const Color card = Color(0xFFFFFFFF);
|
static const Color card = Color(0xFFFFFFFF);
|
||||||
static const Color cardForeground = Color(0xFF020817);
|
static const Color cardForeground = Color(0xFF0F172A);
|
||||||
static const Color popover = Color(0xFFFFFFFF);
|
static const Color popover = Color(0xFFFFFFFF);
|
||||||
static const Color popoverForeground = Color(0xFF020817);
|
static const Color popoverForeground = Color(0xFF0F172A);
|
||||||
static const Color primary = Color(0xFF0F172A);
|
static const Color primary = Color(0xFF0D9488); // teal-600
|
||||||
static const Color primaryForeground = Color(0xFFF8FAFC);
|
static const Color primaryForeground = Color(0xFFFFFFFF);
|
||||||
static const Color secondary = Color(0xFFF1F5F9);
|
static const Color secondary = Color(0xFFF0FDFA); // teal-50
|
||||||
static const Color secondaryForeground = Color(0xFF0F172A);
|
static const Color secondaryForeground = Color(0xFF134E4A); // teal-900
|
||||||
static const Color muted = Color(0xFFF1F5F9);
|
static const Color muted = Color(0xFFF1F5F9); // slate-100
|
||||||
static const Color mutedForeground = Color(0xFF64748B);
|
static const Color mutedForeground = Color(0xFF64748B); // slate-500
|
||||||
static const Color accent = Color(0xFFF1F5F9);
|
static const Color accent = Color(0xFF14B8A6); // teal-500
|
||||||
static const Color accentForeground = Color(0xFF0F172A);
|
static const Color accentForeground = Color(0xFFFFFFFF);
|
||||||
static const Color destructive = Color(0xFFEF4444);
|
static const Color destructive = Color(0xFFEF4444); // red-500
|
||||||
static const Color destructiveForeground = Color(0xFFF8FAFC);
|
static const Color destructiveForeground = Color(0xFFFFFFFF);
|
||||||
static const Color border = Color(0xFFE2E8F0);
|
static const Color border = Color(0xFFE5E7EB); // gray-200 (기본 border는 연한 회색)
|
||||||
static const Color input = Color(0xFFE2E8F0);
|
static const Color input = Color(0xFFE5E7EB); // gray-200
|
||||||
static const Color ring = Color(0xFF020817);
|
static const Color ring = Color(0xFF14B8A6); // teal-500
|
||||||
static const Color radius = Color(0xFF000000); // 사용하지 않음
|
static const Color radius = Color(0xFF000000); // 사용하지 않음
|
||||||
|
|
||||||
// 그라데이션 색상
|
// Teal 그라데이션 색상
|
||||||
static const Color gradient1 = Color(0xFF6366F1);
|
static const Color gradient1 = Color(0xFF14B8A6); // teal-500
|
||||||
static const Color gradient2 = Color(0xFF8B5CF6);
|
static const Color gradient2 = Color(0xFF0D9488); // teal-600
|
||||||
static const Color gradient3 = Color(0xFFEC4899);
|
static const Color gradient3 = Color(0xFF0F766E); // teal-700
|
||||||
|
|
||||||
// 상태 색상
|
// 상태 색상
|
||||||
static const Color success = Color(0xFF10B981);
|
static const Color success = Color(0xFF10B981); // emerald-500
|
||||||
static const Color warning = Color(0xFFF59E0B);
|
static const Color warning = Color(0xFFF59E0B); // amber-500
|
||||||
static const Color error = Color(0xFFEF4444);
|
static const Color error = Color(0xFFEF4444); // red-500
|
||||||
static const Color info = Color(0xFF3B82F6);
|
static const Color info = Color(0xFF0891B2); // cyan-600
|
||||||
|
|
||||||
|
// 추가 색상 (회사 구분용)
|
||||||
|
static const Color blue = Color(0xFF3B82F6); // blue-500
|
||||||
|
static const Color purple = Color(0xFF8B5CF6); // purple-500
|
||||||
|
static const Color green = Color(0xFF22C55E); // green-500
|
||||||
|
|
||||||
// 그림자 설정
|
// 그림자 설정
|
||||||
static List<BoxShadow> get cardShadow => [
|
static List<BoxShadow> get cardShadow => [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.05),
|
color: primary.withValues(alpha: 0.08),
|
||||||
blurRadius: 6,
|
blurRadius: 8,
|
||||||
offset: const Offset(0, 2),
|
offset: const Offset(0, 2),
|
||||||
),
|
),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.1),
|
color: Colors.black.withValues(alpha: 0.04),
|
||||||
blurRadius: 20,
|
blurRadius: 16,
|
||||||
offset: const Offset(0, 10),
|
offset: const Offset(0, 8),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
static List<BoxShadow> get buttonShadow => [
|
static List<BoxShadow> get buttonShadow => [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.1),
|
color: primary.withValues(alpha: 0.2),
|
||||||
blurRadius: 3,
|
blurRadius: 4,
|
||||||
offset: const Offset(0, 1),
|
offset: const Offset(0, 2),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -81,37 +86,37 @@ class ShadcnTheme {
|
|||||||
static const double radius3xl = 24.0;
|
static const double radius3xl = 24.0;
|
||||||
static const double radiusFull = 9999.0;
|
static const double radiusFull = 9999.0;
|
||||||
|
|
||||||
// 타이포그래피 시스템
|
// 타이포그래피 시스템 (통일된 크기)
|
||||||
static TextStyle get headingH1 => GoogleFonts.inter(
|
static TextStyle get headingH1 => GoogleFonts.inter(
|
||||||
fontSize: 36,
|
fontSize: 32,
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
color: foreground,
|
|
||||||
letterSpacing: -0.02,
|
|
||||||
);
|
|
||||||
|
|
||||||
static TextStyle get headingH2 => GoogleFonts.inter(
|
|
||||||
fontSize: 30,
|
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: foreground,
|
color: foreground,
|
||||||
letterSpacing: -0.02,
|
letterSpacing: -0.02,
|
||||||
);
|
);
|
||||||
|
|
||||||
static TextStyle get headingH3 => GoogleFonts.inter(
|
static TextStyle get headingH2 => GoogleFonts.inter(
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: foreground,
|
color: foreground,
|
||||||
letterSpacing: -0.01,
|
letterSpacing: -0.01,
|
||||||
);
|
);
|
||||||
|
|
||||||
static TextStyle get headingH4 => GoogleFonts.inter(
|
static TextStyle get headingH3 => GoogleFonts.inter(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w500,
|
||||||
color: foreground,
|
color: foreground,
|
||||||
letterSpacing: -0.01,
|
letterSpacing: -0.01,
|
||||||
);
|
);
|
||||||
|
|
||||||
static TextStyle get bodyLarge => GoogleFonts.inter(
|
static TextStyle get headingH4 => GoogleFonts.inter(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: foreground,
|
||||||
|
letterSpacing: 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
static TextStyle get bodyLarge => GoogleFonts.inter(
|
||||||
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: foreground,
|
color: foreground,
|
||||||
letterSpacing: 0,
|
letterSpacing: 0,
|
||||||
@@ -194,7 +199,7 @@ class ShadcnTheme {
|
|||||||
foregroundColor: foreground,
|
foregroundColor: foreground,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 1,
|
scrolledUnderElevation: 1,
|
||||||
shadowColor: Colors.black.withOpacity(0.1),
|
shadowColor: Colors.black.withValues(alpha: 0.1),
|
||||||
surfaceTintColor: Colors.transparent,
|
surfaceTintColor: Colors.transparent,
|
||||||
titleTextStyle: headingH4,
|
titleTextStyle: headingH4,
|
||||||
iconTheme: const IconThemeData(color: foreground),
|
iconTheme: const IconThemeData(color: foreground),
|
||||||
@@ -206,7 +211,7 @@ class ShadcnTheme {
|
|||||||
borderRadius: BorderRadius.circular(radiusLg),
|
borderRadius: BorderRadius.circular(radiusLg),
|
||||||
side: const BorderSide(color: border, width: 1),
|
side: const BorderSide(color: border, width: 1),
|
||||||
),
|
),
|
||||||
shadowColor: Colors.black.withOpacity(0.05),
|
shadowColor: Colors.black.withValues(alpha: 0.05),
|
||||||
),
|
),
|
||||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
|
|
||||||
/// 페이지네이션 위젯 (<< < 1 2 3 ... 10 > >>)
|
/// 페이지네이션 위젯 (<< < 1 2 3 ... 10 > >>)
|
||||||
/// - totalCount: 전체 아이템 수
|
/// - totalCount: 전체 아이템 수
|
||||||
@@ -33,56 +34,105 @@ class Pagination extends StatelessWidget {
|
|||||||
for (int i = startPage; i <= endPage; i++) {
|
for (int i = startPage; i <= endPage; i++) {
|
||||||
pageButtons.add(
|
pageButtons.add(
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: ElevatedButton(
|
child: InkWell(
|
||||||
style: ElevatedButton.styleFrom(
|
onTap: i == currentPage ? null : () => onPageChanged(i),
|
||||||
minimumSize: const Size(36, 36),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
backgroundColor: i == currentPage ? Colors.blue : Colors.white,
|
child: Container(
|
||||||
foregroundColor: i == currentPage ? Colors.white : Colors.black,
|
height: 32,
|
||||||
padding: EdgeInsets.zero,
|
constraints: const BoxConstraints(minWidth: 32),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: i == currentPage ? ShadcnTheme.primary : Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(
|
||||||
|
color: i == currentPage ? ShadcnTheme.primary : Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'$i',
|
||||||
|
style: ShadcnTheme.labelMedium.copyWith(
|
||||||
|
color: i == currentPage
|
||||||
|
? ShadcnTheme.primaryForeground
|
||||||
|
: ShadcnTheme.foreground,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onPressed: i == currentPage ? null : () => onPageChanged(i),
|
|
||||||
child: Text('$i'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Row(
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: ShadcnTheme.spacing4),
|
||||||
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
// 가장 처음 페이지로 이동
|
// 가장 처음 페이지로 이동
|
||||||
IconButton(
|
_buildNavigationButton(
|
||||||
icon: const Icon(Icons.first_page),
|
icon: Icons.first_page,
|
||||||
tooltip: '처음',
|
tooltip: '처음',
|
||||||
onPressed: currentPage > 1 ? () => onPageChanged(1) : null,
|
onPressed: currentPage > 1 ? () => onPageChanged(1) : null,
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
// 이전 페이지로 이동
|
// 이전 페이지로 이동
|
||||||
IconButton(
|
_buildNavigationButton(
|
||||||
icon: const Icon(Icons.chevron_left),
|
icon: Icons.chevron_left,
|
||||||
tooltip: '이전',
|
tooltip: '이전',
|
||||||
onPressed:
|
onPressed: currentPage > 1 ? () => onPageChanged(currentPage - 1) : null,
|
||||||
currentPage > 1 ? () => onPageChanged(currentPage - 1) : null,
|
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
// 페이지 번호 버튼들
|
// 페이지 번호 버튼들
|
||||||
...pageButtons,
|
...pageButtons,
|
||||||
|
const SizedBox(width: 8),
|
||||||
// 다음 페이지로 이동
|
// 다음 페이지로 이동
|
||||||
IconButton(
|
_buildNavigationButton(
|
||||||
icon: const Icon(Icons.chevron_right),
|
icon: Icons.chevron_right,
|
||||||
tooltip: '다음',
|
tooltip: '다음',
|
||||||
onPressed:
|
onPressed: currentPage < totalPages
|
||||||
currentPage < totalPages
|
|
||||||
? () => onPageChanged(currentPage + 1)
|
? () => onPageChanged(currentPage + 1)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
// 마지막 페이지로 이동
|
const SizedBox(width: 4),
|
||||||
IconButton(
|
// 마짉 페이지로 이동
|
||||||
icon: const Icon(Icons.last_page),
|
_buildNavigationButton(
|
||||||
tooltip: '마지막',
|
icon: Icons.last_page,
|
||||||
onPressed:
|
tooltip: '마짉',
|
||||||
currentPage < totalPages ? () => onPageChanged(totalPages) : null,
|
onPressed: currentPage < totalPages ? () => onPageChanged(totalPages) : null,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildNavigationButton({
|
||||||
|
required IconData icon,
|
||||||
|
required String tooltip,
|
||||||
|
VoidCallback? onPressed,
|
||||||
|
}) {
|
||||||
|
final isDisabled = onPressed == null;
|
||||||
|
return Tooltip(
|
||||||
|
message: tooltip,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: onPressed,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
child: Container(
|
||||||
|
height: 32,
|
||||||
|
width: 32,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(
|
||||||
|
color: isDisabled ? ShadcnTheme.muted : Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
icon,
|
||||||
|
size: 18,
|
||||||
|
color: isDisabled ? ShadcnTheme.mutedForeground : ShadcnTheme.foreground,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
315
lib/screens/common/widgets/standard_data_table.dart
Normal file
315
lib/screens/common/widgets/standard_data_table.dart
Normal file
@@ -0,0 +1,315 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
|
|
||||||
|
/// 표준 데이터 테이블 컬럼 정의
|
||||||
|
class DataColumn {
|
||||||
|
final String label;
|
||||||
|
final double? width;
|
||||||
|
final int? flex;
|
||||||
|
final bool isNumeric;
|
||||||
|
final TextAlign textAlign;
|
||||||
|
|
||||||
|
DataColumn({
|
||||||
|
required this.label,
|
||||||
|
this.width,
|
||||||
|
this.flex,
|
||||||
|
this.isNumeric = false,
|
||||||
|
TextAlign? textAlign,
|
||||||
|
}) : textAlign = textAlign ?? (isNumeric ? TextAlign.right : TextAlign.left);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 데이터 테이블 위젯
|
||||||
|
///
|
||||||
|
/// 모든 리스트 화면에서 일관된 테이블 스타일 제공
|
||||||
|
class StandardDataTable extends StatelessWidget {
|
||||||
|
final List<DataColumn> columns;
|
||||||
|
final List<Widget> rows;
|
||||||
|
final bool showCheckbox;
|
||||||
|
final bool? isAllSelected;
|
||||||
|
final ValueChanged<bool?>? onSelectAll;
|
||||||
|
final bool enableHorizontalScroll;
|
||||||
|
final ScrollController? horizontalScrollController;
|
||||||
|
final Widget? emptyWidget;
|
||||||
|
final bool applyZebraStripes; // 짝수 행 배경색 적용 여부
|
||||||
|
|
||||||
|
const StandardDataTable({
|
||||||
|
Key? key,
|
||||||
|
required this.columns,
|
||||||
|
required this.rows,
|
||||||
|
this.showCheckbox = false,
|
||||||
|
this.isAllSelected,
|
||||||
|
this.onSelectAll,
|
||||||
|
this.enableHorizontalScroll = false,
|
||||||
|
this.horizontalScrollController,
|
||||||
|
this.emptyWidget,
|
||||||
|
this.applyZebraStripes = true,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (rows.isEmpty) {
|
||||||
|
return _buildEmptyState();
|
||||||
|
}
|
||||||
|
|
||||||
|
final table = Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.card,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
boxShadow: ShadcnTheme.cardShadow,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// 테이블 헤더
|
||||||
|
_buildHeader(),
|
||||||
|
// 테이블 데이터 행들
|
||||||
|
...rows,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (enableHorizontalScroll) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
controller: horizontalScrollController,
|
||||||
|
child: table,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildHeader() {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: ShadcnTheme.spacing4,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// 체크박스 컬럼
|
||||||
|
if (showCheckbox)
|
||||||
|
SizedBox(
|
||||||
|
width: 40,
|
||||||
|
child: Checkbox(
|
||||||
|
value: isAllSelected,
|
||||||
|
onChanged: onSelectAll,
|
||||||
|
tristate: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 데이터 컬럼들
|
||||||
|
...columns.map((column) {
|
||||||
|
Widget child = Text(
|
||||||
|
column.label,
|
||||||
|
style: ShadcnTheme.bodyMedium.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: column.textAlign,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (column.width != null) {
|
||||||
|
return SizedBox(
|
||||||
|
width: column.width,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
} else if (column.flex != null) {
|
||||||
|
return Expanded(
|
||||||
|
flex: column.flex!,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Expanded(child: child);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyState() {
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.card,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
boxShadow: ShadcnTheme.cardShadow,
|
||||||
|
),
|
||||||
|
child: emptyWidget ??
|
||||||
|
Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.inbox_outlined,
|
||||||
|
size: 48,
|
||||||
|
color: ShadcnTheme.muted,
|
||||||
|
),
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing4),
|
||||||
|
Text(
|
||||||
|
'데이터가 없습니다',
|
||||||
|
style: ShadcnTheme.bodyMuted,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 데이터 행 위젯
|
||||||
|
class StandardDataRow extends StatelessWidget {
|
||||||
|
final int index;
|
||||||
|
final List<Widget> cells;
|
||||||
|
final bool showCheckbox;
|
||||||
|
final bool? isSelected;
|
||||||
|
final ValueChanged<bool?>? onSelect;
|
||||||
|
final bool applyZebraStripes;
|
||||||
|
final List<DataColumn> columns;
|
||||||
|
|
||||||
|
const StandardDataRow({
|
||||||
|
Key? key,
|
||||||
|
required this.index,
|
||||||
|
required this.cells,
|
||||||
|
this.showCheckbox = false,
|
||||||
|
this.isSelected,
|
||||||
|
this.onSelect,
|
||||||
|
this.applyZebraStripes = true,
|
||||||
|
required this.columns,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: ShadcnTheme.spacing4,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: applyZebraStripes && index % 2 == 1
|
||||||
|
? ShadcnTheme.muted.withValues(alpha: 0.1)
|
||||||
|
: null,
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// 체크박스
|
||||||
|
if (showCheckbox)
|
||||||
|
SizedBox(
|
||||||
|
width: 40,
|
||||||
|
child: Checkbox(
|
||||||
|
value: isSelected,
|
||||||
|
onChanged: onSelect,
|
||||||
|
tristate: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 데이터 셀들
|
||||||
|
...cells.asMap().entries.map((entry) {
|
||||||
|
final cellIndex = entry.key;
|
||||||
|
final cell = entry.value;
|
||||||
|
|
||||||
|
if (cellIndex >= columns.length) return const SizedBox.shrink();
|
||||||
|
|
||||||
|
final column = columns[cellIndex];
|
||||||
|
|
||||||
|
if (column.width != null) {
|
||||||
|
return SizedBox(
|
||||||
|
width: column.width,
|
||||||
|
child: cell,
|
||||||
|
);
|
||||||
|
} else if (column.flex != null) {
|
||||||
|
return Expanded(
|
||||||
|
flex: column.flex!,
|
||||||
|
child: cell,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Expanded(child: cell);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 관리 버튼 세트
|
||||||
|
class StandardActionButtons extends StatelessWidget {
|
||||||
|
final VoidCallback? onView;
|
||||||
|
final VoidCallback? onEdit;
|
||||||
|
final VoidCallback? onDelete;
|
||||||
|
final List<Widget>? customButtons;
|
||||||
|
final double buttonSize;
|
||||||
|
|
||||||
|
const StandardActionButtons({
|
||||||
|
Key? key,
|
||||||
|
this.onView,
|
||||||
|
this.onEdit,
|
||||||
|
this.onDelete,
|
||||||
|
this.customButtons,
|
||||||
|
this.buttonSize = 32,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (onView != null)
|
||||||
|
_buildIconButton(
|
||||||
|
Icons.visibility_outlined,
|
||||||
|
onView!,
|
||||||
|
'보기',
|
||||||
|
ShadcnTheme.primary,
|
||||||
|
),
|
||||||
|
if (onEdit != null)
|
||||||
|
_buildIconButton(
|
||||||
|
Icons.edit_outlined,
|
||||||
|
onEdit!,
|
||||||
|
'수정',
|
||||||
|
ShadcnTheme.primary,
|
||||||
|
),
|
||||||
|
if (onDelete != null)
|
||||||
|
_buildIconButton(
|
||||||
|
Icons.delete_outline,
|
||||||
|
onDelete!,
|
||||||
|
'삭제',
|
||||||
|
ShadcnTheme.destructive,
|
||||||
|
),
|
||||||
|
if (customButtons != null) ...customButtons!,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildIconButton(
|
||||||
|
IconData icon,
|
||||||
|
VoidCallback onPressed,
|
||||||
|
String tooltip,
|
||||||
|
Color color,
|
||||||
|
) {
|
||||||
|
return IconButton(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minWidth: buttonSize,
|
||||||
|
minHeight: buttonSize,
|
||||||
|
maxWidth: buttonSize,
|
||||||
|
maxHeight: buttonSize,
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
icon: Icon(icon, size: 16, color: color),
|
||||||
|
onPressed: onPressed,
|
||||||
|
tooltip: tooltip,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
297
lib/screens/common/widgets/standard_states.dart
Normal file
297
lib/screens/common/widgets/standard_states.dart
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
|
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||||
|
|
||||||
|
/// 표준 로딩 상태 위젯
|
||||||
|
class StandardLoadingState extends StatelessWidget {
|
||||||
|
final String message;
|
||||||
|
|
||||||
|
const StandardLoadingState({
|
||||||
|
Key? key,
|
||||||
|
this.message = '데이터를 불러오는 중...',
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
CircularProgressIndicator(
|
||||||
|
color: ShadcnTheme.primary,
|
||||||
|
strokeWidth: 3,
|
||||||
|
),
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing4),
|
||||||
|
Text(
|
||||||
|
message,
|
||||||
|
style: ShadcnTheme.bodyMuted,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 에러 상태 위젯
|
||||||
|
class StandardErrorState extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String? message;
|
||||||
|
final VoidCallback? onRetry;
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
const StandardErrorState({
|
||||||
|
Key? key,
|
||||||
|
this.title = '오류가 발생했습니다',
|
||||||
|
this.message,
|
||||||
|
this.onRetry,
|
||||||
|
this.icon = Icons.error_outline,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
size: 64,
|
||||||
|
color: ShadcnTheme.destructive.withValues(alpha: 0.8),
|
||||||
|
),
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing4),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: ShadcnTheme.headingH4,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
if (message != null) ...[
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing2),
|
||||||
|
Text(
|
||||||
|
message!,
|
||||||
|
style: ShadcnTheme.bodyMuted,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (onRetry != null) ...[
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing6),
|
||||||
|
ShadcnButton(
|
||||||
|
text: '다시 시도',
|
||||||
|
onPressed: onRetry,
|
||||||
|
variant: ShadcnButtonVariant.primary,
|
||||||
|
textColor: Colors.white,
|
||||||
|
icon: const Icon(Icons.refresh, size: 16),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 빈 상태 위젯
|
||||||
|
class StandardEmptyState extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String? message;
|
||||||
|
final Widget? action;
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
const StandardEmptyState({
|
||||||
|
Key? key,
|
||||||
|
this.title = '데이터가 없습니다',
|
||||||
|
this.message,
|
||||||
|
this.action,
|
||||||
|
this.icon = Icons.inbox_outlined,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
size: 64,
|
||||||
|
color: ShadcnTheme.mutedForeground.withValues(alpha: 0.5),
|
||||||
|
),
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing4),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: ShadcnTheme.headingH4.copyWith(
|
||||||
|
color: ShadcnTheme.mutedForeground,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
if (message != null) ...[
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing2),
|
||||||
|
Text(
|
||||||
|
message!,
|
||||||
|
style: ShadcnTheme.bodyMuted,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (action != null) ...[
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing6),
|
||||||
|
action!,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 정보 메시지 위젯
|
||||||
|
class StandardInfoMessage extends StatelessWidget {
|
||||||
|
final String message;
|
||||||
|
final IconData icon;
|
||||||
|
final Color? color;
|
||||||
|
final VoidCallback? onClose;
|
||||||
|
|
||||||
|
const StandardInfoMessage({
|
||||||
|
Key? key,
|
||||||
|
required this.message,
|
||||||
|
this.icon = Icons.info_outline,
|
||||||
|
this.color,
|
||||||
|
this.onClose,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final displayColor = color ?? ShadcnTheme.primary;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(ShadcnTheme.spacing3),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: displayColor.withValues(alpha: 0.1),
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(
|
||||||
|
color: displayColor.withValues(alpha: 0.3),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
size: 20,
|
||||||
|
color: displayColor,
|
||||||
|
),
|
||||||
|
const SizedBox(width: ShadcnTheme.spacing2),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
message,
|
||||||
|
style: TextStyle(
|
||||||
|
color: displayColor,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (onClose != null)
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
size: 16,
|
||||||
|
color: displayColor,
|
||||||
|
),
|
||||||
|
onPressed: onClose,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
maxHeight: 24,
|
||||||
|
maxWidth: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 표준 통계 카드 위젯
|
||||||
|
class StandardStatCard extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String value;
|
||||||
|
final IconData icon;
|
||||||
|
final Color color;
|
||||||
|
final String? subtitle;
|
||||||
|
|
||||||
|
const StandardStatCard({
|
||||||
|
Key? key,
|
||||||
|
required this.title,
|
||||||
|
required this.value,
|
||||||
|
required this.icon,
|
||||||
|
required this.color,
|
||||||
|
this.subtitle,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(ShadcnTheme.spacing5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.card,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withValues(alpha: 0.05),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color.withValues(alpha: 0.1),
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusSm),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
icon,
|
||||||
|
size: 20,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: ShadcnTheme.spacing3),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: ShadcnTheme.bodySmall.copyWith(
|
||||||
|
color: ShadcnTheme.mutedForeground,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing3),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: ShadcnTheme.headingH3.copyWith(
|
||||||
|
color: color,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (subtitle != null) ...[
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing1),
|
||||||
|
Text(
|
||||||
|
subtitle!,
|
||||||
|
style: ShadcnTheme.bodySmall.copyWith(
|
||||||
|
color: ShadcnTheme.mutedForeground,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
109
lib/screens/common/widgets/unified_search_bar.dart
Normal file
109
lib/screens/common/widgets/unified_search_bar.dart
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
|
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||||
|
|
||||||
|
/// 통일된 검색바 위젯
|
||||||
|
///
|
||||||
|
/// 모든 리스트 화면에서 동일한 스타일과 동작을 보장
|
||||||
|
class UnifiedSearchBar extends StatelessWidget {
|
||||||
|
final TextEditingController controller;
|
||||||
|
final String placeholder;
|
||||||
|
final VoidCallback onSearch;
|
||||||
|
final ValueChanged<String>? onChanged; // 실시간 검색을 위한 콜백
|
||||||
|
final VoidCallback? onClear;
|
||||||
|
final Widget? suffixButton; // 검색 버튼 외 추가 버튼
|
||||||
|
final List<Widget>? filters; // 필터 위젯들
|
||||||
|
final bool showSearchButton;
|
||||||
|
|
||||||
|
const UnifiedSearchBar({
|
||||||
|
Key? key,
|
||||||
|
required this.controller,
|
||||||
|
this.placeholder = '검색어를 입력하세요...',
|
||||||
|
required this.onSearch,
|
||||||
|
this.onChanged,
|
||||||
|
this.onClear,
|
||||||
|
this.suffixButton,
|
||||||
|
this.filters,
|
||||||
|
this.showSearchButton = true,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
// 검색 입력 필드
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.card,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
controller: controller,
|
||||||
|
onChanged: onChanged,
|
||||||
|
onSubmitted: (_) => onSearch(),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: placeholder,
|
||||||
|
hintStyle: TextStyle(color: ShadcnTheme.muted),
|
||||||
|
prefixIcon: Icon(Icons.search, color: ShadcnTheme.muted, size: 20),
|
||||||
|
suffixIcon: controller.text.isNotEmpty && onClear != null
|
||||||
|
? IconButton(
|
||||||
|
icon: Icon(Icons.clear, color: ShadcnTheme.muted, size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
controller.clear();
|
||||||
|
onClear!();
|
||||||
|
},
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
constraints: const BoxConstraints(maxHeight: 40, maxWidth: 40),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
border: InputBorder.none,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 검색 버튼
|
||||||
|
if (showSearchButton) ...[
|
||||||
|
const SizedBox(width: ShadcnTheme.spacing2),
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: ShadcnButton(
|
||||||
|
text: '검색',
|
||||||
|
onPressed: onSearch,
|
||||||
|
variant: ShadcnButtonVariant.primary,
|
||||||
|
textColor: Colors.white,
|
||||||
|
icon: const Icon(Icons.search, size: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
// 추가 버튼 (예: 추가, 필터 등)
|
||||||
|
if (suffixButton != null) ...[
|
||||||
|
const SizedBox(width: ShadcnTheme.spacing2),
|
||||||
|
suffixButton!,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
// 필터 섹션
|
||||||
|
if (filters != null && filters!.isNotEmpty) ...[
|
||||||
|
const SizedBox(height: ShadcnTheme.spacing3),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
...filters!.map((filter) => Padding(
|
||||||
|
padding: const EdgeInsets.only(right: ShadcnTheme.spacing2),
|
||||||
|
child: filter,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,11 +4,17 @@ import 'dart:async';
|
|||||||
import 'package:superport/models/company_model.dart';
|
import 'package:superport/models/company_model.dart';
|
||||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/unified_search_bar.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/standard_data_table.dart' as std_table;
|
||||||
|
import 'package:superport/screens/common/widgets/standard_action_bar.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/standard_states.dart';
|
||||||
|
import 'package:superport/screens/common/layouts/base_list_screen.dart';
|
||||||
import 'package:superport/services/mock_data_service.dart';
|
import 'package:superport/services/mock_data_service.dart';
|
||||||
import 'package:superport/screens/company/widgets/company_branch_dialog.dart';
|
import 'package:superport/screens/company/widgets/company_branch_dialog.dart';
|
||||||
import 'package:superport/screens/company/controllers/company_list_controller.dart';
|
import 'package:superport/screens/company/controllers/company_list_controller.dart';
|
||||||
|
|
||||||
/// shadcn/ui 스타일로 재설계된 회사 관리 화면
|
/// shadcn/ui 스타일로 재설계된 회사 관리 화면 (통일된 UI 컴포넌트 사용)
|
||||||
class CompanyListRedesign extends StatefulWidget {
|
class CompanyListRedesign extends StatefulWidget {
|
||||||
const CompanyListRedesign({super.key});
|
const CompanyListRedesign({super.key});
|
||||||
|
|
||||||
@@ -18,41 +24,33 @@ class CompanyListRedesign extends StatefulWidget {
|
|||||||
|
|
||||||
class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
||||||
late CompanyListController _controller;
|
late CompanyListController _controller;
|
||||||
final ScrollController _scrollController = ScrollController();
|
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
Timer? _debounceTimer;
|
Timer? _debounceTimer;
|
||||||
|
int _currentPage = 1;
|
||||||
|
final int _pageSize = 10;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_controller = CompanyListController(dataService: MockDataService());
|
_controller = CompanyListController(dataService: MockDataService());
|
||||||
_controller.initialize();
|
_controller.initializeWithPageSize(_pageSize);
|
||||||
_setupScrollListener();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
_scrollController.dispose();
|
|
||||||
_searchController.dispose();
|
_searchController.dispose();
|
||||||
_debounceTimer?.cancel();
|
_debounceTimer?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 스크롤 리스너 설정 (무한 스크롤)
|
|
||||||
void _setupScrollListener() {
|
|
||||||
_scrollController.addListener(() {
|
|
||||||
if (_scrollController.position.pixels ==
|
|
||||||
_scrollController.position.maxScrollExtent) {
|
|
||||||
_controller.loadMore();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 검색어 입력 처리 (디바운싱)
|
/// 검색어 입력 처리 (디바운싱)
|
||||||
void _onSearchChanged(String value) {
|
void _onSearchChanged(String value) {
|
||||||
_debounceTimer?.cancel();
|
_debounceTimer?.cancel();
|
||||||
_debounceTimer = Timer(const Duration(milliseconds: 500), () {
|
_debounceTimer = Timer(const Duration(milliseconds: 500), () {
|
||||||
|
setState(() {
|
||||||
|
_currentPage = 1;
|
||||||
|
});
|
||||||
_controller.updateSearchKeyword(value);
|
_controller.updateSearchKeyword(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -82,7 +80,8 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
final success = await _controller.deleteCompany(id);
|
final success = await _controller.deleteCompany(id);
|
||||||
if (!success && mounted) {
|
if (!success) {
|
||||||
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(_controller.error ?? '삭제에 실패했습니다'),
|
content: Text(_controller.error ?? '삭제에 실패했습니다'),
|
||||||
@@ -90,6 +89,7 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: const Text('삭제'),
|
child: const Text('삭제'),
|
||||||
),
|
),
|
||||||
@@ -127,13 +127,38 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
spacing: ShadcnTheme.spacing1,
|
spacing: ShadcnTheme.spacing1,
|
||||||
children:
|
children:
|
||||||
types.map((type) {
|
types.map((type) {
|
||||||
return ShadcnBadge(
|
Color bgColor;
|
||||||
text: companyTypeToString(type),
|
Color borderColor;
|
||||||
variant:
|
Color textColor;
|
||||||
type == CompanyType.customer
|
|
||||||
? ShadcnBadgeVariant.primary
|
switch(type) {
|
||||||
: ShadcnBadgeVariant.secondary,
|
case CompanyType.customer:
|
||||||
size: ShadcnBadgeSize.small,
|
bgColor = ShadcnTheme.green.withValues(alpha: 0.9);
|
||||||
|
textColor = Colors.white;
|
||||||
|
break;
|
||||||
|
case CompanyType.partner:
|
||||||
|
bgColor = ShadcnTheme.purple.withValues(alpha: 0.9);
|
||||||
|
textColor = Colors.white;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bgColor = ShadcnTheme.muted.withValues(alpha: 0.9);
|
||||||
|
textColor = ShadcnTheme.foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: bgColor,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
companyTypeToString(type),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: textColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
);
|
);
|
||||||
@@ -141,11 +166,22 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
|
|
||||||
/// 본사/지점 구분 배지 생성
|
/// 본사/지점 구분 배지 생성
|
||||||
Widget _buildCompanyTypeLabel(bool isBranch) {
|
Widget _buildCompanyTypeLabel(bool isBranch) {
|
||||||
return ShadcnBadge(
|
return Container(
|
||||||
text: isBranch ? '지점' : '본사',
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||||
variant:
|
decoration: BoxDecoration(
|
||||||
isBranch ? ShadcnBadgeVariant.outline : ShadcnBadgeVariant.primary,
|
color: isBranch
|
||||||
size: ShadcnBadgeSize.small,
|
? ShadcnTheme.blue.withValues(alpha: 0.9)
|
||||||
|
: ShadcnTheme.primary.withValues(alpha: 0.9),
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
isBranch ? '지점' : '본사',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +220,6 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
'mainCompanyName': null,
|
'mainCompanyName': null,
|
||||||
});
|
});
|
||||||
if (company.branches != null) {
|
if (company.branches != null) {
|
||||||
print('[CompanyListRedesign] Company ${company.name} has ${company.branches!.length} branches');
|
|
||||||
for (final branch in company.branches!) {
|
for (final branch in company.branches!) {
|
||||||
displayCompanies.add({
|
displayCompanies.add({
|
||||||
'branch': branch,
|
'branch': branch,
|
||||||
@@ -193,207 +228,97 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
'mainCompanyName': company.name,
|
'mainCompanyName': company.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
print('[CompanyListRedesign] Company ${company.name} has no branches');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int totalCount = displayCompanies.length;
|
final int totalCount = displayCompanies.length;
|
||||||
print('[CompanyListRedesign] Total display items: $totalCount (companies + branches)');
|
|
||||||
|
|
||||||
return SingleChildScrollView(
|
// 페이지네이션을 위한 데이터 처리
|
||||||
controller: _scrollController,
|
final int startIndex = (_currentPage - 1) * _pageSize;
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
final int endIndex = startIndex + _pageSize;
|
||||||
child: Column(
|
final List<Map<String, dynamic>> pagedCompanies = displayCompanies.sublist(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
startIndex,
|
||||||
children: [
|
endIndex > displayCompanies.length ? displayCompanies.length : endIndex,
|
||||||
// 헤더 및 검색 바
|
);
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
height: 40,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: ShadcnTheme.card,
|
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
controller: _searchController,
|
|
||||||
onChanged: _onSearchChanged,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: '회사명, 담당자명, 연락처로 검색',
|
|
||||||
hintStyle: TextStyle(color: ShadcnTheme.muted),
|
|
||||||
prefixIcon: Icon(Icons.search, color: ShadcnTheme.muted),
|
|
||||||
border: InputBorder.none,
|
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: ShadcnTheme.spacing4),
|
|
||||||
ShadcnButton(
|
|
||||||
text: '회사 추가',
|
|
||||||
onPressed: _navigateToAddScreen,
|
|
||||||
variant: ShadcnButtonVariant.primary,
|
|
||||||
textColor: Colors.white,
|
|
||||||
icon: Icon(Icons.add),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: ShadcnTheme.spacing4),
|
// 로딩 상태
|
||||||
|
if (controller.isLoading && controller.companies.isEmpty) {
|
||||||
|
return const StandardLoadingState(
|
||||||
|
message: '회사 데이터를 불러오는 중...',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 결과 정보
|
return BaseListScreen(
|
||||||
Row(
|
isLoading: false,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
error: controller.error,
|
||||||
children: [
|
onRefresh: controller.refresh,
|
||||||
Text('총 $totalCount개 회사', style: ShadcnTheme.bodyMuted),
|
emptyMessage: controller.searchKeyword.isNotEmpty
|
||||||
if (controller.searchKeyword.isNotEmpty)
|
|
||||||
Text(
|
|
||||||
'"${controller.searchKeyword}" 검색 결과',
|
|
||||||
style: ShadcnTheme.bodyMuted,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: ShadcnTheme.spacing4),
|
|
||||||
|
|
||||||
// 에러 메시지
|
|
||||||
if (controller.error != null)
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
|
||||||
margin: const EdgeInsets.only(bottom: ShadcnTheme.spacing4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.red.shade50,
|
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
|
||||||
border: Border.all(color: Colors.red.shade200),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(Icons.error_outline, color: Colors.red),
|
|
||||||
const SizedBox(width: ShadcnTheme.spacing2),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
controller.error!,
|
|
||||||
style: TextStyle(color: Colors.red.shade700),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.close, size: 16),
|
|
||||||
onPressed: controller.clearError,
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
constraints: BoxConstraints(maxHeight: 24, maxWidth: 24),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 테이블 카드
|
|
||||||
Container(
|
|
||||||
width: double.infinity,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: ShadcnTheme.card,
|
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
|
||||||
boxShadow: ShadcnTheme.cardShadow,
|
|
||||||
),
|
|
||||||
child: controller.isLoading && controller.companies.isEmpty
|
|
||||||
? Container(
|
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
|
||||||
child: Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: displayCompanies.isEmpty
|
|
||||||
? Container(
|
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.business_outlined,
|
|
||||||
size: 48,
|
|
||||||
color: ShadcnTheme.muted,
|
|
||||||
),
|
|
||||||
const SizedBox(height: ShadcnTheme.spacing4),
|
|
||||||
Text(
|
|
||||||
controller.searchKeyword.isNotEmpty
|
|
||||||
? '검색 결과가 없습니다'
|
? '검색 결과가 없습니다'
|
||||||
: '등록된 회사가 없습니다',
|
: '등록된 회사가 없습니다',
|
||||||
style: ShadcnTheme.bodyMuted,
|
emptyIcon: Icons.business_outlined,
|
||||||
),
|
|
||||||
],
|
// 검색바
|
||||||
),
|
searchBar: UnifiedSearchBar(
|
||||||
),
|
controller: _searchController,
|
||||||
)
|
placeholder: '회사명, 담당자명, 연락처로 검색',
|
||||||
: Column(
|
onChanged: _onSearchChanged, // 실시간 검색 (디바운싱)
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
onSearch: () => _controller.updateSearchKeyword(_searchController.text), // 즉시 검색
|
||||||
children: [
|
onClear: () {
|
||||||
// 테이블 헤더
|
_searchController.clear();
|
||||||
Container(
|
_onSearchChanged('');
|
||||||
padding: const EdgeInsets.symmetric(
|
},
|
||||||
horizontal: ShadcnTheme.spacing4,
|
suffixButton: StandardActionButtons.addButton(
|
||||||
vertical: ShadcnTheme.spacing3,
|
text: '회사 추가',
|
||||||
),
|
onPressed: _navigateToAddScreen,
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Text(
|
|
||||||
'번호',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Text(
|
|
||||||
'회사명',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'구분',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'유형',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'연락처',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'관리',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 테이블 데이터
|
// 액션바
|
||||||
...displayCompanies.asMap().entries.map((entry) {
|
actionBar: StandardActionBar(
|
||||||
final int index = entry.key;
|
leftActions: [],
|
||||||
|
totalCount: totalCount,
|
||||||
|
onRefresh: controller.refresh,
|
||||||
|
statusMessage: controller.searchKeyword.isNotEmpty
|
||||||
|
? '"${controller.searchKeyword}" 검색 결과'
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
|
||||||
|
// 에러 메시지
|
||||||
|
filterSection: controller.error != null
|
||||||
|
? StandardInfoMessage(
|
||||||
|
message: controller.error!,
|
||||||
|
icon: Icons.error_outline,
|
||||||
|
color: ShadcnTheme.destructive,
|
||||||
|
onClose: controller.clearError,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
|
||||||
|
// 데이터 테이블
|
||||||
|
dataTable: displayCompanies.isEmpty
|
||||||
|
? StandardEmptyState(
|
||||||
|
title: controller.searchKeyword.isNotEmpty
|
||||||
|
? '검색 결과가 없습니다'
|
||||||
|
: '등록된 회사가 없습니다',
|
||||||
|
icon: Icons.business_outlined,
|
||||||
|
action: controller.searchKeyword.isEmpty
|
||||||
|
? StandardActionButtons.addButton(
|
||||||
|
text: '첫 회사 추가하기',
|
||||||
|
onPressed: _navigateToAddScreen,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
)
|
||||||
|
: std_table.StandardDataTable(
|
||||||
|
columns: [
|
||||||
|
std_table.DataColumn(label: '번호', flex: 1),
|
||||||
|
std_table.DataColumn(label: '회사명', flex: 3),
|
||||||
|
std_table.DataColumn(label: '구분', flex: 2),
|
||||||
|
std_table.DataColumn(label: '유형', flex: 2),
|
||||||
|
std_table.DataColumn(label: '연락처', flex: 2),
|
||||||
|
std_table.DataColumn(label: '관리', flex: 2),
|
||||||
|
],
|
||||||
|
rows: [
|
||||||
|
...pagedCompanies.asMap().entries.map((entry) {
|
||||||
|
final int index = startIndex + entry.key;
|
||||||
final companyData = entry.value;
|
final companyData = entry.value;
|
||||||
final bool isBranch = companyData['isBranch'] as bool;
|
final bool isBranch = companyData['isBranch'] as bool;
|
||||||
final Company company =
|
final Company company =
|
||||||
@@ -403,86 +328,60 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
final String? mainCompanyName =
|
final String? mainCompanyName =
|
||||||
companyData['mainCompanyName'] as String?;
|
companyData['mainCompanyName'] as String?;
|
||||||
|
|
||||||
return Container(
|
return std_table.StandardDataRow(
|
||||||
padding: const EdgeInsets.symmetric(
|
index: index,
|
||||||
horizontal: ShadcnTheme.spacing4,
|
columns: [
|
||||||
vertical: ShadcnTheme.spacing3,
|
std_table.DataColumn(label: '번호', flex: 1),
|
||||||
),
|
std_table.DataColumn(label: '회사명', flex: 3),
|
||||||
decoration: BoxDecoration(
|
std_table.DataColumn(label: '구분', flex: 2),
|
||||||
border: Border(
|
std_table.DataColumn(label: '유형', flex: 2),
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
std_table.DataColumn(label: '연락처', flex: 2),
|
||||||
),
|
std_table.DataColumn(label: '관리', flex: 2),
|
||||||
),
|
],
|
||||||
child: Row(
|
cells: [
|
||||||
children: [
|
|
||||||
// 번호
|
// 번호
|
||||||
Expanded(
|
Text(
|
||||||
flex: 1,
|
|
||||||
child: Text(
|
|
||||||
'${index + 1}',
|
'${index + 1}',
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// 회사명
|
// 회사명
|
||||||
Expanded(
|
_buildCompanyNameText(
|
||||||
flex: 3,
|
|
||||||
child: _buildCompanyNameText(
|
|
||||||
company,
|
company,
|
||||||
isBranch,
|
isBranch,
|
||||||
mainCompanyName: mainCompanyName,
|
mainCompanyName: mainCompanyName,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// 구분
|
// 구분
|
||||||
Expanded(
|
_buildCompanyTypeLabel(isBranch),
|
||||||
flex: 2,
|
|
||||||
child: _buildCompanyTypeLabel(isBranch),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 유형
|
// 유형
|
||||||
Expanded(
|
_buildCompanyTypeChips(
|
||||||
flex: 2,
|
|
||||||
child: _buildCompanyTypeChips(
|
|
||||||
company.companyTypes,
|
company.companyTypes,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// 연락처
|
// 연락처
|
||||||
Expanded(
|
Text(
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
company.contactPhone ?? '-',
|
company.contactPhone ?? '-',
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// 관리
|
// 관리
|
||||||
Expanded(
|
Row(
|
||||||
flex: 2,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
if (!isBranch &&
|
if (!isBranch &&
|
||||||
company.branches != null &&
|
company.branches != null &&
|
||||||
company.branches!.isNotEmpty)
|
company.branches!.isNotEmpty) ...[
|
||||||
ShadcnButton(
|
ShadcnButton(
|
||||||
text: '지점보기',
|
text: '지점',
|
||||||
onPressed:
|
onPressed:
|
||||||
() => _showBranchDialog(company),
|
() => _showBranchDialog(company),
|
||||||
variant:
|
variant:
|
||||||
ShadcnButtonVariant.secondary,
|
ShadcnButtonVariant.ghost,
|
||||||
size: ShadcnButtonSize.small,
|
size: ShadcnButtonSize.small,
|
||||||
),
|
),
|
||||||
if (!isBranch &&
|
|
||||||
company.branches != null &&
|
|
||||||
company.branches!.isNotEmpty)
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: ShadcnTheme.spacing2,
|
width: ShadcnTheme.spacing1,
|
||||||
),
|
),
|
||||||
ShadcnButton(
|
],
|
||||||
text: '수정',
|
std_table.StandardActionButtons(
|
||||||
onPressed: company.id != null
|
onEdit: company.id != null
|
||||||
? () {
|
? () {
|
||||||
if (isBranch) {
|
if (isBranch) {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
@@ -511,55 +410,28 @@ class _CompanyListRedesignState extends State<CompanyListRedesign> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
variant: ShadcnButtonVariant.secondary,
|
onDelete: (!isBranch && company.id != null)
|
||||||
size: ShadcnButtonSize.small,
|
? () => _deleteCompany(company.id!)
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: ShadcnTheme.spacing2,
|
|
||||||
),
|
|
||||||
ShadcnButton(
|
|
||||||
text: '삭제',
|
|
||||||
onPressed:
|
|
||||||
(!isBranch && company.id != null)
|
|
||||||
? () =>
|
|
||||||
_deleteCompany(company.id!)
|
|
||||||
: null,
|
: null,
|
||||||
variant:
|
|
||||||
ShadcnButtonVariant.destructive,
|
|
||||||
size: ShadcnButtonSize.small,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// 무한 스크롤 로딩 인디케이터
|
// 페이지네이션 (항상 표시)
|
||||||
if (controller.isLoading && controller.companies.isNotEmpty)
|
pagination: Pagination(
|
||||||
Container(
|
totalCount: totalCount,
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
currentPage: _currentPage,
|
||||||
child: Center(
|
pageSize: _pageSize,
|
||||||
child: CircularProgressIndicator(),
|
onPageChanged: (page) {
|
||||||
),
|
setState(() {
|
||||||
),
|
_currentPage = page;
|
||||||
|
});
|
||||||
// 더 이상 로드할 데이터가 없을 때 메시지
|
},
|
||||||
if (!controller.hasMore && controller.companies.isNotEmpty)
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'모든 회사를 불러왔습니다',
|
|
||||||
style: ShadcnTheme.bodyMuted,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
|
|
||||||
// 페이지네이션
|
// 페이지네이션
|
||||||
int _currentPage = 1;
|
int _currentPage = 1;
|
||||||
final int _perPage = 20;
|
int _perPage = 20;
|
||||||
bool _hasMore = true;
|
bool _hasMore = true;
|
||||||
|
|
||||||
// 필터
|
// 필터
|
||||||
@@ -41,6 +41,12 @@ class CompanyListController extends ChangeNotifier {
|
|||||||
await loadData(isRefresh: true);
|
await loadData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 페이지 크기를 지정하여 초기화
|
||||||
|
Future<void> initializeWithPageSize(int pageSize) async {
|
||||||
|
_perPage = pageSize;
|
||||||
|
await loadData(isRefresh: true);
|
||||||
|
}
|
||||||
|
|
||||||
// 데이터 로드 및 필터 적용
|
// 데이터 로드 및 필터 적용
|
||||||
Future<void> loadData({bool isRefresh = false}) async {
|
Future<void> loadData({bool isRefresh = false}) async {
|
||||||
print('[CompanyListController] loadData called - isRefresh: $isRefresh');
|
print('[CompanyListController] loadData called - isRefresh: $isRefresh');
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/unified_search_bar.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/standard_action_bar.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/standard_data_table.dart' as std_table;
|
||||||
|
import 'package:superport/screens/common/widgets/standard_states.dart';
|
||||||
import 'package:superport/screens/equipment/controllers/equipment_list_controller.dart';
|
import 'package:superport/screens/equipment/controllers/equipment_list_controller.dart';
|
||||||
import 'package:superport/services/mock_data_service.dart';
|
import 'package:superport/services/mock_data_service.dart';
|
||||||
import 'package:superport/models/equipment_unified_model.dart';
|
import 'package:superport/models/equipment_unified_model.dart';
|
||||||
@@ -24,7 +29,6 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
bool _showDetailedColumns = true;
|
bool _showDetailedColumns = true;
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
final ScrollController _horizontalScrollController = ScrollController();
|
final ScrollController _horizontalScrollController = ScrollController();
|
||||||
final ScrollController _verticalScrollController = ScrollController();
|
|
||||||
String _selectedStatus = 'all';
|
String _selectedStatus = 'all';
|
||||||
// String _searchKeyword = ''; // Removed - unused field
|
// String _searchKeyword = ''; // Removed - unused field
|
||||||
String _appliedSearchKeyword = '';
|
String _appliedSearchKeyword = '';
|
||||||
@@ -37,9 +41,6 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
_controller = EquipmentListController(dataService: MockDataService());
|
_controller = EquipmentListController(dataService: MockDataService());
|
||||||
_setInitialFilter();
|
_setInitialFilter();
|
||||||
|
|
||||||
// 무한 스크롤 리스너 추가
|
|
||||||
_verticalScrollController.addListener(_onScroll);
|
|
||||||
|
|
||||||
// API 호출을 위해 Future로 변경
|
// API 호출을 위해 Future로 변경
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_controller.loadData(); // 비동기 호출
|
_controller.loadData(); // 비동기 호출
|
||||||
@@ -50,7 +51,6 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
_searchController.dispose();
|
_searchController.dispose();
|
||||||
_horizontalScrollController.dispose();
|
_horizontalScrollController.dispose();
|
||||||
_verticalScrollController.dispose();
|
|
||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@@ -149,16 +149,6 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
_controller.selectedEquipmentIds.contains('${e.id}:${e.status}'));
|
_controller.selectedEquipmentIds.contains('${e.id}:${e.status}'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 스크롤 이벤트 처리 (무한 스크롤)
|
|
||||||
void _onScroll() {
|
|
||||||
if (_verticalScrollController.position.pixels >=
|
|
||||||
_verticalScrollController.position.maxScrollExtent * 0.8) {
|
|
||||||
// 스크롤이 80% 이상 내려갔을 때 다음 페이지 로드
|
|
||||||
if (!_controller.isLoading && _controller.hasMore) {
|
|
||||||
_controller.loadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 필터링된 장비 목록 반환
|
/// 필터링된 장비 목록 반환
|
||||||
List<UnifiedEquipment> _getFilteredEquipments() {
|
List<UnifiedEquipment> _getFilteredEquipments() {
|
||||||
@@ -433,36 +423,59 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
// 검색 입력
|
// 검색 입력
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: ShadcnInput(
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.card,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
placeholder: '장비명, 제조사, 카테고리, 시리얼번호 등...',
|
onSubmitted: (_) => _onSearch(),
|
||||||
prefixIcon: const Icon(Icons.search),
|
decoration: InputDecoration(
|
||||||
|
hintText: '장비명, 제조사, 카테고리, 시리얼번호 등...',
|
||||||
|
hintStyle: TextStyle(color: ShadcnTheme.mutedForeground.withValues(alpha: 0.8), fontSize: 14),
|
||||||
|
prefixIcon: Icon(Icons.search, color: ShadcnTheme.muted, size: 20),
|
||||||
|
border: InputBorder.none,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
),
|
||||||
|
style: ShadcnTheme.bodyMedium,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
// 검색 버튼
|
// 검색 버튼
|
||||||
ShadcnButton(
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: ShadcnButton(
|
||||||
text: '검색',
|
text: '검색',
|
||||||
onPressed: _onSearch,
|
onPressed: _onSearch,
|
||||||
variant: ShadcnButtonVariant.primary,
|
variant: ShadcnButtonVariant.primary,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
icon: const Icon(Icons.search, size: 16),
|
icon: const Icon(Icons.search, size: 16),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
// 상태 필터 드롭다운
|
// 상태 필터 드롭다운
|
||||||
Container(
|
Container(
|
||||||
|
height: 40,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
color: ShadcnTheme.card,
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
),
|
),
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
value: _selectedStatus,
|
value: _selectedStatus,
|
||||||
onChanged: (value) => _onStatusFilterChanged(value!),
|
onChanged: (value) => _onStatusFilterChanged(value!),
|
||||||
underline: const SizedBox.shrink(),
|
style: TextStyle(fontSize: 14, color: ShadcnTheme.foreground),
|
||||||
|
icon: const Icon(Icons.arrow_drop_down, size: 20),
|
||||||
items: const [
|
items: const [
|
||||||
DropdownMenuItem(value: 'all', child: Text('전체')),
|
DropdownMenuItem(value: 'all', child: Text('전체')),
|
||||||
DropdownMenuItem(value: 'in', child: Text('입고')),
|
DropdownMenuItem(value: 'in', child: Text('입고')),
|
||||||
@@ -471,6 +484,7 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -708,26 +722,26 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
double _calculateTableWidth(List<UnifiedEquipment> pagedEquipments) {
|
double _calculateTableWidth(List<UnifiedEquipment> pagedEquipments) {
|
||||||
double totalWidth = 0;
|
double totalWidth = 0;
|
||||||
|
|
||||||
// 기본 컬럼들
|
// 기본 컬럼들 (너비 최적화)
|
||||||
totalWidth += 40; // 체크박스
|
totalWidth += 40; // 체크박스
|
||||||
totalWidth += 60; // 번호
|
totalWidth += 50; // 번호
|
||||||
totalWidth += 150; // 제조사
|
totalWidth += 120; // 제조사
|
||||||
totalWidth += 150; // 장비명
|
totalWidth += 120; // 장비명
|
||||||
totalWidth += 150; // 카테고리
|
totalWidth += 100; // 카테고리
|
||||||
totalWidth += 60; // 수량
|
totalWidth += 50; // 수량
|
||||||
totalWidth += 80; // 상태
|
totalWidth += 70; // 상태
|
||||||
totalWidth += 100; // 날짜
|
totalWidth += 80; // 날짜
|
||||||
totalWidth += 100; // 관리
|
totalWidth += 90; // 관리
|
||||||
|
|
||||||
// 상세 컬럼들 (조건부)
|
// 상세 컬럼들 (조건부)
|
||||||
if (_showDetailedColumns) {
|
if (_showDetailedColumns) {
|
||||||
totalWidth += 150; // 시리얼번호
|
totalWidth += 120; // 시리얼번호
|
||||||
totalWidth += 150; // 바코드
|
totalWidth += 120; // 바코드
|
||||||
|
|
||||||
// 출고 정보 (조건부)
|
// 출고 정보 (조건부)
|
||||||
if (pagedEquipments.any((e) => e.status == EquipmentStatus.out || e.status == EquipmentStatus.rent)) {
|
if (pagedEquipments.any((e) => e.status == EquipmentStatus.out || e.status == EquipmentStatus.rent)) {
|
||||||
totalWidth += 150; // 회사
|
totalWidth += 120; // 회사
|
||||||
totalWidth += 100; // 담당자
|
totalWidth += 80; // 담당자
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +775,7 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
minWidth: MediaQuery.of(context).size.width - 48, // padding 고려
|
minWidth: MediaQuery.of(context).size.width - 48, // padding 고려
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
),
|
),
|
||||||
child:
|
child:
|
||||||
@@ -791,12 +805,12 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing4,
|
horizontal: ShadcnTheme.spacing4,
|
||||||
vertical: ShadcnTheme.spacing3,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -811,65 +825,65 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
// 번호
|
// 번호
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 60,
|
width: 50,
|
||||||
child: Text('번호', style: ShadcnTheme.bodyMedium),
|
child: Text('번호', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 제조사
|
// 제조사
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text('제조사', style: ShadcnTheme.bodyMedium),
|
child: Text('제조사', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 장비명
|
// 장비명
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text('장비명', style: ShadcnTheme.bodyMedium),
|
child: Text('장비명', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 카테고리
|
// 카테고리
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 100,
|
||||||
child: Text('카테고리', style: ShadcnTheme.bodyMedium),
|
child: Text('카테고리', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 상세 정보 (조건부)
|
// 상세 정보 (조건부)
|
||||||
if (_showDetailedColumns) ...[
|
if (_showDetailedColumns) ...[
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text('시리얼번호', style: ShadcnTheme.bodyMedium),
|
child: Text('시리얼번호', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text('바코드', style: ShadcnTheme.bodyMedium),
|
child: Text('바코드', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
// 수량
|
// 수량
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 60,
|
width: 50,
|
||||||
child: Text('수량', style: ShadcnTheme.bodyMedium),
|
child: Text('수량', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 상태
|
// 상태
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 70,
|
||||||
child: Text('상태', style: ShadcnTheme.bodyMedium),
|
child: Text('상태', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 날짜
|
// 날짜
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 80,
|
||||||
child: Text('날짜', style: ShadcnTheme.bodyMedium),
|
child: Text('날짜', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 출고 정보 (조건부 - 테이블에 출고/대여 항목이 있을 때만)
|
// 출고 정보 (조건부 - 테이블에 출고/대여 항목이 있을 때만)
|
||||||
if (_showDetailedColumns && pagedEquipments.any((e) => e.status == EquipmentStatus.out || e.status == EquipmentStatus.rent)) ...[
|
if (_showDetailedColumns && pagedEquipments.any((e) => e.status == EquipmentStatus.out || e.status == EquipmentStatus.rent)) ...[
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text('회사', style: ShadcnTheme.bodyMedium),
|
child: Text('회사', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 80,
|
||||||
child: Text('담당자', style: ShadcnTheme.bodyMedium),
|
child: Text('담당자', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
// 관리
|
// 관리
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 90,
|
||||||
child: Text('관리', style: ShadcnTheme.bodyMedium),
|
child: Text('관리', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -883,11 +897,11 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing4,
|
horizontal: ShadcnTheme.spacing4,
|
||||||
vertical: ShadcnTheme.spacing3,
|
vertical: 4,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -902,15 +916,15 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
// 번호
|
// 번호
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 60,
|
width: 50,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${startIndex + index + 1}',
|
'${startIndex + index + 1}',
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 제조사
|
// 제조사
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.equipment.manufacturer,
|
equipment.equipment.manufacturer,
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
@@ -918,8 +932,8 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 장비명
|
// 장비명
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.equipment.name,
|
equipment.equipment.name,
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
@@ -927,22 +941,22 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 카테고리
|
// 카테고리
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 100,
|
||||||
child: _buildCategoryWithTooltip(equipment),
|
child: _buildCategoryWithTooltip(equipment),
|
||||||
),
|
),
|
||||||
// 상세 정보 (조건부)
|
// 상세 정보 (조건부)
|
||||||
if (_showDetailedColumns) ...[
|
if (_showDetailedColumns) ...[
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.equipment.serialNumber ?? '-',
|
equipment.equipment.serialNumber ?? '-',
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.equipment.barcode ?? '-',
|
equipment.equipment.barcode ?? '-',
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
@@ -952,15 +966,15 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
],
|
],
|
||||||
// 수량
|
// 수량
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 60,
|
width: 50,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${equipment.equipment.quantity}',
|
'${equipment.equipment.quantity}',
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 상태
|
// 상태
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 70,
|
||||||
child: ShadcnBadge(
|
child: ShadcnBadge(
|
||||||
text: _getStatusDisplayText(
|
text: _getStatusDisplayText(
|
||||||
equipment.status,
|
equipment.status,
|
||||||
@@ -972,8 +986,8 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 날짜
|
// 날짜
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 80,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.date.toString().substring(0, 10),
|
equipment.date.toString().substring(0, 10),
|
||||||
style: ShadcnTheme.bodySmall,
|
style: ShadcnTheme.bodySmall,
|
||||||
@@ -981,8 +995,8 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
// 출고 정보 (조건부)
|
// 출고 정보 (조건부)
|
||||||
if (_showDetailedColumns && pagedEquipments.any((e) => e.status == EquipmentStatus.out || e.status == EquipmentStatus.rent)) ...[
|
if (_showDetailedColumns && pagedEquipments.any((e) => e.status == EquipmentStatus.out || e.status == EquipmentStatus.rent)) ...[
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 2,
|
width: 120,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.status == EquipmentStatus.out || equipment.status == EquipmentStatus.rent
|
equipment.status == EquipmentStatus.out || equipment.status == EquipmentStatus.rent
|
||||||
? _controller.getOutEquipmentInfo(equipment.id!, 'company')
|
? _controller.getOutEquipmentInfo(equipment.id!, 'company')
|
||||||
@@ -991,8 +1005,8 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 80,
|
||||||
child: Text(
|
child: Text(
|
||||||
equipment.status == EquipmentStatus.out || equipment.status == EquipmentStatus.rent
|
equipment.status == EquipmentStatus.out || equipment.status == EquipmentStatus.rent
|
||||||
? _controller.getOutEquipmentInfo(equipment.id!, 'manager')
|
? _controller.getOutEquipmentInfo(equipment.id!, 'manager')
|
||||||
@@ -1003,8 +1017,8 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
// 관리 버튼
|
// 관리 버튼
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 1,
|
width: 90,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@@ -1057,48 +1071,17 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 페이지네이션
|
// 페이지네이션 컴포넌트
|
||||||
if (totalCount > _pageSize)
|
if (totalCount > _pageSize)
|
||||||
Container(
|
Pagination(
|
||||||
padding: const EdgeInsets.symmetric(
|
totalCount: totalCount,
|
||||||
vertical: ShadcnTheme.spacing4,
|
currentPage: _currentPage,
|
||||||
),
|
pageSize: _pageSize,
|
||||||
child: Row(
|
onPageChanged: (page) {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
setState(() {
|
||||||
children: [
|
_currentPage = page;
|
||||||
// 이전 페이지 버튼
|
});
|
||||||
ShadcnButton(
|
},
|
||||||
text: '이전',
|
|
||||||
onPressed:
|
|
||||||
_currentPage > 1
|
|
||||||
? () => setState(() => _currentPage--)
|
|
||||||
: null,
|
|
||||||
variant: ShadcnButtonVariant.secondary,
|
|
||||||
size: ShadcnButtonSize.small,
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(width: ShadcnTheme.spacing4),
|
|
||||||
|
|
||||||
// 페이지 정보
|
|
||||||
Text(
|
|
||||||
'$_currentPage / ${((totalCount - 1) ~/ _pageSize) + 1}',
|
|
||||||
style: ShadcnTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(width: ShadcnTheme.spacing4),
|
|
||||||
|
|
||||||
// 다음 페이지 버튼
|
|
||||||
ShadcnButton(
|
|
||||||
text: '다음',
|
|
||||||
onPressed:
|
|
||||||
_currentPage < ((totalCount - 1) ~/ _pageSize) + 1
|
|
||||||
? () => setState(() => _currentPage++)
|
|
||||||
: null,
|
|
||||||
variant: ShadcnButtonVariant.secondary,
|
|
||||||
size: ShadcnButtonSize.small,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -1108,11 +1091,11 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
/// 상태 표시 텍스트 반환
|
/// 상태 표시 텍스트 반환
|
||||||
String _getStatusDisplayText(String status) {
|
String _getStatusDisplayText(String status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case EquipmentStatus.in_:
|
case 'I': // EquipmentStatus.in_
|
||||||
return '입고';
|
return '입고';
|
||||||
case EquipmentStatus.out:
|
case 'O': // EquipmentStatus.out
|
||||||
return '출고';
|
return '출고';
|
||||||
case EquipmentStatus.rent:
|
case 'T': // EquipmentStatus.rent
|
||||||
return '대여';
|
return '대여';
|
||||||
default:
|
default:
|
||||||
return '알수없음';
|
return '알수없음';
|
||||||
@@ -1122,11 +1105,11 @@ class _EquipmentListRedesignState extends State<EquipmentListRedesign> {
|
|||||||
/// 상태에 따른 배지 변형 반환
|
/// 상태에 따른 배지 변형 반환
|
||||||
ShadcnBadgeVariant _getStatusBadgeVariant(String status) {
|
ShadcnBadgeVariant _getStatusBadgeVariant(String status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case EquipmentStatus.in_:
|
case 'I': // EquipmentStatus.in_
|
||||||
return ShadcnBadgeVariant.success;
|
return ShadcnBadgeVariant.success;
|
||||||
case EquipmentStatus.out:
|
case 'O': // EquipmentStatus.out
|
||||||
return ShadcnBadgeVariant.destructive;
|
return ShadcnBadgeVariant.destructive;
|
||||||
case EquipmentStatus.rent:
|
case 'T': // EquipmentStatus.rent
|
||||||
return ShadcnBadgeVariant.warning;
|
return ShadcnBadgeVariant.warning;
|
||||||
default:
|
default:
|
||||||
return ShadcnBadgeVariant.secondary;
|
return ShadcnBadgeVariant.secondary;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:superport/models/license_model.dart';
|
import 'package:superport/models/license_model.dart';
|
||||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||||
import 'package:superport/screens/license/controllers/license_list_controller.dart';
|
import 'package:superport/screens/license/controllers/license_list_controller.dart';
|
||||||
import 'package:superport/utils/constants.dart';
|
import 'package:superport/utils/constants.dart';
|
||||||
import 'package:superport/services/mock_data_service.dart';
|
import 'package:superport/services/mock_data_service.dart';
|
||||||
@@ -22,7 +23,8 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
final MockDataService _dataService = MockDataService();
|
final MockDataService _dataService = MockDataService();
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
final ScrollController _horizontalScrollController = ScrollController();
|
final ScrollController _horizontalScrollController = ScrollController();
|
||||||
final ScrollController _verticalScrollController = ScrollController();
|
int _currentPage = 1;
|
||||||
|
final int _pageSize = 10;
|
||||||
|
|
||||||
// 날짜 포맷터
|
// 날짜 포맷터
|
||||||
final DateFormat _dateFormat = DateFormat('yyyy-MM-dd');
|
final DateFormat _dateFormat = DateFormat('yyyy-MM-dd');
|
||||||
@@ -52,36 +54,29 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_controller.loadData();
|
_controller.loadData();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 무한 스크롤 리스너 추가
|
|
||||||
_verticalScrollController.addListener(_onScroll);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// 리스너 제거
|
// 리스너 제거
|
||||||
_verticalScrollController.removeListener(_onScroll);
|
|
||||||
_controller.removeListener(_handleControllerUpdate);
|
_controller.removeListener(_handleControllerUpdate);
|
||||||
|
|
||||||
// 컨트롤러 dispose
|
// 컨트롤러 dispose
|
||||||
_searchController.dispose();
|
_searchController.dispose();
|
||||||
_horizontalScrollController.dispose();
|
_horizontalScrollController.dispose();
|
||||||
_verticalScrollController.dispose();
|
|
||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 스크롤 이벤트 처리 (무한 스크롤)
|
/// 페이지네이션용 라이선스 가져오기
|
||||||
void _onScroll() {
|
List<License> _getPagedLicenses() {
|
||||||
if (!_verticalScrollController.hasClients) return;
|
final licenses = _controller.licenses;
|
||||||
|
final int startIndex = (_currentPage - 1) * _pageSize;
|
||||||
if (_verticalScrollController.position.pixels >=
|
final int endIndex = startIndex + _pageSize;
|
||||||
_verticalScrollController.position.maxScrollExtent * 0.8) {
|
return licenses.sublist(
|
||||||
// 스크롤이 80% 이상 내려갔을 때 다음 페이지 로드
|
startIndex,
|
||||||
if (!_controller.isLoading && _controller.hasMore) {
|
endIndex > licenses.length ? licenses.length : endIndex,
|
||||||
_controller.loadNextPage();
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 검색 실행
|
/// 검색 실행
|
||||||
@@ -302,26 +297,32 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
/// 통계 카드 위젯
|
/// 통계 카드 위젯
|
||||||
Widget _buildStatCard(String title, String value, IconData icon, Color color) {
|
Widget _buildStatCard(String title, String value, IconData icon, Color color) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.card,
|
color: ShadcnTheme.card,
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Container(
|
||||||
children: [
|
padding: const EdgeInsets.all(8),
|
||||||
Icon(icon, size: 20, color: color),
|
decoration: BoxDecoration(
|
||||||
const SizedBox(width: 8),
|
color: color.withValues(alpha: 0.1),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Icon(icon, size: 16, color: color),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
Text(title, style: ShadcnTheme.bodySmall),
|
Text(title, style: ShadcnTheme.bodySmall),
|
||||||
],
|
const Spacer(),
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: ShadcnTheme.headingH3.copyWith(color: color),
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -340,30 +341,52 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
// 검색 입력
|
// 검색 입력
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: ShadcnInput(
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ShadcnTheme.card,
|
||||||
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
placeholder: '제품명, 라이선스 키, 벤더명, 회사명 검색...',
|
onSubmitted: (_) => _onSearch(),
|
||||||
prefixIcon: const Icon(Icons.search),
|
decoration: InputDecoration(
|
||||||
|
hintText: '제품명, 라이선스 키, 벤더명, 회사명 검색...',
|
||||||
|
hintStyle: TextStyle(color: ShadcnTheme.mutedForeground.withValues(alpha: 0.8), fontSize: 14),
|
||||||
|
prefixIcon: Icon(Icons.search, color: ShadcnTheme.muted, size: 20),
|
||||||
|
border: InputBorder.none,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
),
|
||||||
|
style: ShadcnTheme.bodyMedium,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
// 검색 버튼
|
// 검색 버튼
|
||||||
ShadcnButton(
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: ShadcnButton(
|
||||||
text: '검색',
|
text: '검색',
|
||||||
onPressed: _onSearch,
|
onPressed: _onSearch,
|
||||||
variant: ShadcnButtonVariant.primary,
|
variant: ShadcnButtonVariant.primary,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
icon: const Icon(Icons.search, size: 16),
|
icon: const Icon(Icons.search, size: 16),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|
||||||
// 상태 필터 드롭다운
|
// 상태 필터 드롭다운
|
||||||
Container(
|
Container(
|
||||||
|
height: 40,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
color: ShadcnTheme.card,
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
),
|
),
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton<LicenseStatusFilter>(
|
child: DropdownButton<LicenseStatusFilter>(
|
||||||
value: _controller.statusFilter,
|
value: _controller.statusFilter,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
@@ -371,7 +394,8 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
_controller.changeStatusFilter(value);
|
_controller.changeStatusFilter(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
underline: const SizedBox.shrink(),
|
style: TextStyle(fontSize: 14, color: ShadcnTheme.foreground),
|
||||||
|
icon: const Icon(Icons.arrow_drop_down, size: 20),
|
||||||
items: const [
|
items: const [
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
value: LicenseStatusFilter.all,
|
value: LicenseStatusFilter.all,
|
||||||
@@ -396,6 +420,7 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -544,31 +569,38 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final pagedLicenses = _getPagedLicenses();
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
child: SingleChildScrollView(
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// 테이블 컨테이너 (가로 스크롤 지원)
|
||||||
|
SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
controller: _horizontalScrollController,
|
controller: _horizontalScrollController,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
minWidth: MediaQuery.of(context).size.width - 48,
|
minWidth: MediaQuery.of(context).size.width - 48, // padding 고려
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
),
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 1360, // 모든 컬럼 너비의 합
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// 테이블 헤더
|
// 테이블 헤더
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing4,
|
horizontal: ShadcnTheme.spacing4,
|
||||||
vertical: ShadcnTheme.spacing3,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -585,81 +617,77 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
// 번호
|
// 번호
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 60,
|
width: 60,
|
||||||
child: Text('번호', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('번호', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 제품명
|
// 제품명
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 200,
|
width: 200,
|
||||||
child: Text('제품명', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('제품명', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 라이선스 키
|
// 라이선스 키
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 150,
|
width: 150,
|
||||||
child: Text('라이선스 키', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('라이선스 키', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 벤더
|
// 벤더
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
child: Text('벤더', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('벤더', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 회사명
|
// 회사명
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 150,
|
width: 150,
|
||||||
child: Text('회사명', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('회사명', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 할당 사용자
|
// 할당 사용자
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
child: Text('할당 사용자', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('할당 사용자', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 상태
|
// 상태
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 80,
|
width: 80,
|
||||||
child: Text('상태', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('상태', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 구매일
|
// 구매일
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
child: Text('구매일', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('구매일', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 만료일
|
// 만료일
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
child: Text('만료일', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('만료일', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 남은 일수
|
// 남은 일수
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 80,
|
width: 80,
|
||||||
child: Text('남은 일수', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('남은 일수', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
// 관리
|
// 관리
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
child: Text('관리', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text('관리', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 테이블 데이터
|
// 테이블 데이터
|
||||||
SizedBox(
|
...pagedLicenses.asMap().entries.map((entry) {
|
||||||
height: 400,
|
final displayIndex = entry.key;
|
||||||
width: 1360, // 모든 컬럼 너비의 합
|
final license = entry.value;
|
||||||
child: ListView.builder(
|
final index = (_currentPage - 1) * _pageSize + displayIndex;
|
||||||
controller: _verticalScrollController,
|
|
||||||
itemCount: licenses.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final license = licenses[index];
|
|
||||||
final daysRemaining = _controller.getDaysUntilExpiry(license);
|
final daysRemaining = _controller.getDaysUntilExpiry(license);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing4,
|
horizontal: ShadcnTheme.spacing4,
|
||||||
vertical: ShadcnTheme.spacing3,
|
vertical: 4,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -685,7 +713,7 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
width: 200,
|
width: 200,
|
||||||
child: Text(
|
child: Text(
|
||||||
license.productName ?? '-',
|
license.productName ?? '-',
|
||||||
style: ShadcnTheme.bodyMedium,
|
style: ShadcnTheme.bodySmall,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -770,67 +798,61 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
Flexible(
|
||||||
|
child: IconButton(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minWidth: 32,
|
minWidth: 30,
|
||||||
minHeight: 32,
|
minHeight: 30,
|
||||||
),
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.edit,
|
|
||||||
size: 16,
|
|
||||||
color: ShadcnTheme.primary,
|
|
||||||
),
|
),
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
icon: const Icon(Icons.edit_outlined, size: 16),
|
||||||
onPressed: license.id != null
|
onPressed: license.id != null
|
||||||
? () => _navigateToEdit(license.id!)
|
? () => _navigateToEdit(license.id!)
|
||||||
: null,
|
: null,
|
||||||
tooltip: '수정',
|
tooltip: '수정',
|
||||||
),
|
),
|
||||||
IconButton(
|
),
|
||||||
|
Flexible(
|
||||||
|
child: IconButton(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minWidth: 32,
|
minWidth: 30,
|
||||||
minHeight: 32,
|
minHeight: 30,
|
||||||
),
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.delete,
|
|
||||||
size: 16,
|
|
||||||
color: ShadcnTheme.destructive,
|
|
||||||
),
|
),
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
icon: const Icon(Icons.delete_outline, size: 16),
|
||||||
onPressed: license.id != null
|
onPressed: license.id != null
|
||||||
? () => _showDeleteDialog(license.id!)
|
? () => _showDeleteDialog(license.id!)
|
||||||
: null,
|
: null,
|
||||||
tooltip: '삭제',
|
tooltip: '삭제',
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}).toList(),
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 더 보기 버튼
|
|
||||||
if (_controller.hasMore)
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Center(
|
|
||||||
child: _controller.isLoading
|
|
||||||
? const CircularProgressIndicator()
|
|
||||||
: ShadcnButton(
|
|
||||||
text: '더 보기',
|
|
||||||
onPressed: () => _controller.loadNextPage(),
|
|
||||||
variant: ShadcnButtonVariant.secondary,
|
|
||||||
icon: const Icon(Icons.expand_more, size: 16),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 페이지네이션 컴포넌트 (항상 표시)
|
||||||
|
if (licenses.length > _pageSize)
|
||||||
|
Pagination(
|
||||||
|
totalCount: licenses.length,
|
||||||
|
currentPage: _currentPage,
|
||||||
|
pageSize: _pageSize,
|
||||||
|
onPageChanged: (page) {
|
||||||
|
setState(() {
|
||||||
|
_currentPage = page;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ class _LoginViewRedesignState extends State<LoginViewRedesign>
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.muted,
|
color: ShadcnTheme.muted,
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ class _OverviewScreenRedesignState extends State<OverviewScreenRedesign> {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:superport/models/user_model.dart';
|
import 'package:superport/models/user_model.dart';
|
||||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||||
|
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||||
import 'package:superport/screens/user/controllers/user_list_controller.dart';
|
import 'package:superport/screens/user/controllers/user_list_controller.dart';
|
||||||
import 'package:superport/utils/constants.dart';
|
import 'package:superport/utils/constants.dart';
|
||||||
import 'package:superport/services/mock_data_service.dart';
|
import 'package:superport/services/mock_data_service.dart';
|
||||||
@@ -19,8 +20,9 @@ class UserListRedesign extends StatefulWidget {
|
|||||||
|
|
||||||
class _UserListRedesignState extends State<UserListRedesign> {
|
class _UserListRedesignState extends State<UserListRedesign> {
|
||||||
final MockDataService _dataService = MockDataService();
|
final MockDataService _dataService = MockDataService();
|
||||||
final ScrollController _scrollController = ScrollController();
|
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
int _currentPage = 1;
|
||||||
|
final int _pageSize = 10;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -31,9 +33,6 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
context.read<UserListController>().loadUsers();
|
context.read<UserListController>().loadUsers();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 무한 스크롤 설정
|
|
||||||
_scrollController.addListener(_onScroll);
|
|
||||||
|
|
||||||
// 검색 디바운싱
|
// 검색 디바운싱
|
||||||
_searchController.addListener(() {
|
_searchController.addListener(() {
|
||||||
_onSearchChanged(_searchController.text);
|
_onSearchChanged(_searchController.text);
|
||||||
@@ -42,23 +41,19 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_scrollController.dispose();
|
|
||||||
_searchController.dispose();
|
_searchController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 스크롤 이벤트 처리
|
|
||||||
void _onScroll() {
|
|
||||||
if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent - 200) {
|
|
||||||
context.read<UserListController>().loadMore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 검색어 변경 처리 (디바운싱)
|
/// 검색어 변경 처리 (디바운싱)
|
||||||
Timer? _debounce;
|
Timer? _debounce;
|
||||||
void _onSearchChanged(String query) {
|
void _onSearchChanged(String query) {
|
||||||
if (_debounce?.isActive ?? false) _debounce!.cancel();
|
if (_debounce?.isActive ?? false) _debounce!.cancel();
|
||||||
_debounce = Timer(const Duration(milliseconds: 300), () {
|
_debounce = Timer(const Duration(milliseconds: 300), () {
|
||||||
|
setState(() {
|
||||||
|
_currentPage = 1;
|
||||||
|
});
|
||||||
context.read<UserListController>().setSearchQuery(query);
|
context.read<UserListController>().setSearchQuery(query);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -230,8 +225,16 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 페이지네이션을 위한 데이터 처리
|
||||||
|
final int totalUsers = controller.users.length;
|
||||||
|
final int startIndex = (_currentPage - 1) * _pageSize;
|
||||||
|
final int endIndex = startIndex + _pageSize;
|
||||||
|
final List<User> pagedUsers = controller.users.sublist(
|
||||||
|
startIndex,
|
||||||
|
endIndex > totalUsers ? totalUsers : endIndex,
|
||||||
|
);
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
controller: _scrollController,
|
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -241,7 +244,7 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
side: BorderSide(color: ShadcnTheme.border),
|
side: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
||||||
@@ -381,7 +384,7 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -396,7 +399,7 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -429,15 +432,15 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
...controller.users.asMap().entries.map((entry) {
|
...pagedUsers.asMap().entries.map((entry) {
|
||||||
final int index = entry.key;
|
final int index = startIndex + entry.key;
|
||||||
final User user = entry.value;
|
final User user = entry.value;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
color: index % 2 == 0 ? null : ShadcnTheme.muted.withValues(alpha: 0.1),
|
color: index % 2 == 0 ? null : ShadcnTheme.muted.withValues(alpha: 0.1),
|
||||||
),
|
),
|
||||||
@@ -594,25 +597,17 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 무한 스크롤 로딩 인디케이터
|
// 페이지네이션 컴포넌트
|
||||||
if (controller.isLoadingMore)
|
if (totalUsers > _pageSize)
|
||||||
Container(
|
Pagination(
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
totalCount: totalUsers,
|
||||||
child: const Center(
|
currentPage: _currentPage,
|
||||||
child: CircularProgressIndicator(),
|
pageSize: _pageSize,
|
||||||
),
|
onPageChanged: (page) {
|
||||||
),
|
setState(() {
|
||||||
|
_currentPage = page;
|
||||||
// 더 이상 데이터가 없을 때
|
});
|
||||||
if (!controller.hasMoreData && controller.users.isNotEmpty)
|
},
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'모든 사용자를 불러왔습니다',
|
|
||||||
style: ShadcnTheme.bodyMuted,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ class _WarehouseLocationListRedesignState
|
|||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: ShadcnTheme.border),
|
border: Border.all(color: Colors.black),
|
||||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -184,12 +184,12 @@ class _WarehouseLocationListRedesignState
|
|||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: ShadcnTheme.spacing4,
|
horizontal: ShadcnTheme.spacing4,
|
||||||
vertical: ShadcnTheme.spacing3,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -250,10 +250,13 @@ class _WarehouseLocationListRedesignState
|
|||||||
final WarehouseLocation location = entry.value;
|
final WarehouseLocation location = entry.value;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: ShadcnTheme.spacing4,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: ShadcnTheme.border),
|
bottom: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -326,11 +329,8 @@ class _WarehouseLocationListRedesignState
|
|||||||
size: 16,
|
size: 16,
|
||||||
color: ShadcnTheme.destructive,
|
color: ShadcnTheme.destructive,
|
||||||
),
|
),
|
||||||
onPressed:
|
onPressed: () =>
|
||||||
location.id != null
|
_showDeleteDialog(location.id),
|
||||||
? () =>
|
|
||||||
_showDeleteDialog(location.id!)
|
|
||||||
: null,
|
|
||||||
tooltip: '삭제',
|
tooltip: '삭제',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -344,8 +344,7 @@ class _WarehouseLocationListRedesignState
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 페이지네이션
|
// 페이지네이션 (항상 표시)
|
||||||
if (totalCount > _pageSize) ...[
|
|
||||||
const SizedBox(height: ShadcnTheme.spacing6),
|
const SizedBox(height: ShadcnTheme.spacing6),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -365,14 +364,16 @@ class _WarehouseLocationListRedesignState
|
|||||||
),
|
),
|
||||||
const SizedBox(width: ShadcnTheme.spacing2),
|
const SizedBox(width: ShadcnTheme.spacing2),
|
||||||
Text(
|
Text(
|
||||||
'$_currentPage / ${(totalCount / _pageSize).ceil()}',
|
totalCount > 0
|
||||||
|
? '$_currentPage / ${(totalCount / _pageSize).ceil()}'
|
||||||
|
: '1 / 1',
|
||||||
style: ShadcnTheme.bodyMuted,
|
style: ShadcnTheme.bodyMuted,
|
||||||
),
|
),
|
||||||
const SizedBox(width: ShadcnTheme.spacing2),
|
const SizedBox(width: ShadcnTheme.spacing2),
|
||||||
ShadcnButton(
|
ShadcnButton(
|
||||||
text: '다음',
|
text: '다음',
|
||||||
onPressed:
|
onPressed:
|
||||||
_currentPage < (totalCount / _pageSize).ceil()
|
_currentPage < (totalCount / _pageSize).ceil() && totalCount > _pageSize
|
||||||
? () {
|
? () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentPage++;
|
_currentPage++;
|
||||||
@@ -385,7 +386,6 @@ class _WarehouseLocationListRedesignState
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user