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:
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:superport/models/user_model.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.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/utils/constants.dart';
|
||||
import 'package:superport/services/mock_data_service.dart';
|
||||
@@ -19,8 +20,9 @@ class UserListRedesign extends StatefulWidget {
|
||||
|
||||
class _UserListRedesignState extends State<UserListRedesign> {
|
||||
final MockDataService _dataService = MockDataService();
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
int _currentPage = 1;
|
||||
final int _pageSize = 10;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -31,9 +33,6 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
context.read<UserListController>().loadUsers();
|
||||
});
|
||||
|
||||
// 무한 스크롤 설정
|
||||
_scrollController.addListener(_onScroll);
|
||||
|
||||
// 검색 디바운싱
|
||||
_searchController.addListener(() {
|
||||
_onSearchChanged(_searchController.text);
|
||||
@@ -42,23 +41,19 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
_searchController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// 스크롤 이벤트 처리
|
||||
void _onScroll() {
|
||||
if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent - 200) {
|
||||
context.read<UserListController>().loadMore();
|
||||
}
|
||||
}
|
||||
|
||||
/// 검색어 변경 처리 (디바운싱)
|
||||
Timer? _debounce;
|
||||
void _onSearchChanged(String query) {
|
||||
if (_debounce?.isActive ?? false) _debounce!.cancel();
|
||||
_debounce = Timer(const Duration(milliseconds: 300), () {
|
||||
setState(() {
|
||||
_currentPage = 1;
|
||||
});
|
||||
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(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -241,7 +244,7 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
side: BorderSide(color: ShadcnTheme.border),
|
||||
side: BorderSide(color: Colors.black),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
||||
@@ -381,7 +384,7 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
@@ -396,7 +399,7 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: ShadcnTheme.border),
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -429,15 +432,15 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
),
|
||||
)
|
||||
else
|
||||
...controller.users.asMap().entries.map((entry) {
|
||||
final int index = entry.key;
|
||||
...pagedUsers.asMap().entries.map((entry) {
|
||||
final int index = startIndex + entry.key;
|
||||
final User user = entry.value;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: ShadcnTheme.border),
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
color: index % 2 == 0 ? null : ShadcnTheme.muted.withValues(alpha: 0.1),
|
||||
),
|
||||
@@ -594,25 +597,17 @@ class _UserListRedesignState extends State<UserListRedesign> {
|
||||
),
|
||||
),
|
||||
|
||||
// 무한 스크롤 로딩 인디케이터
|
||||
if (controller.isLoadingMore)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
|
||||
// 더 이상 데이터가 없을 때
|
||||
if (!controller.hasMoreData && controller.users.isNotEmpty)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing4),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'모든 사용자를 불러왔습니다',
|
||||
style: ShadcnTheme.bodyMuted,
|
||||
),
|
||||
),
|
||||
// 페이지네이션 컴포넌트
|
||||
if (totalUsers > _pageSize)
|
||||
Pagination(
|
||||
totalCount: totalUsers,
|
||||
currentPage: _currentPage,
|
||||
pageSize: _pageSize,
|
||||
onPageChanged: (page) {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user