사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.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/utils/user_utils.dart';
|
||||
|
||||
/// shadcn/ui 스타일로 재설계된 사용자 관리 화면
|
||||
class UserList extends StatefulWidget {
|
||||
@@ -55,11 +54,6 @@ class _UserListState extends State<UserList> {
|
||||
});
|
||||
}
|
||||
|
||||
/// 회사명 반환 함수
|
||||
String _getCompanyName(int companyId) {
|
||||
// TODO: CompanyService를 통해 회사 정보 가져오기
|
||||
return '회사 $companyId'; // 임시 처리
|
||||
}
|
||||
|
||||
/// 상태별 색상 반환
|
||||
Color _getStatusColor(bool isActive) {
|
||||
@@ -112,26 +106,29 @@ class _UserListState extends State<UserList> {
|
||||
|
||||
/// 사용자 삭제 다이얼로그
|
||||
void _showDeleteDialog(int userId, String userName) {
|
||||
showDialog(
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
builder: (context) => ShadDialog(
|
||||
title: const Text('사용자 삭제'),
|
||||
content: Text('"$userName" 사용자를 정말로 삭제하시겠습니까?'),
|
||||
description: Text('"$userName" 사용자를 정말로 삭제하시겠습니까?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
ShadButton.outline(
|
||||
child: const Text('취소'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
ShadButton.destructive(
|
||||
child: const Text('삭제'),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
await _controller.deleteUser(userId);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('사용자가 삭제되었습니다')),
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast(
|
||||
title: const Text('삭제 완료'),
|
||||
description: const Text('사용자가 삭제되었습니다'),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('삭제', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -143,23 +140,23 @@ class _UserListState extends State<UserList> {
|
||||
final newStatus = !user.isActive;
|
||||
final statusText = newStatus ? '활성화' : '비활성화';
|
||||
|
||||
showDialog(
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('사용자 상태 변경'),
|
||||
content: Text('"${user.name}" 사용자를 $statusText 하시겠습니까?'),
|
||||
builder: (context) => ShadDialog(
|
||||
title: const Text('사용자 상태 변경'),
|
||||
description: Text('"${user.name}" 사용자를 $statusText 하시겠습니까?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
ShadButton.outline(
|
||||
child: const Text('취소'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
ShadButton(
|
||||
child: Text(statusText),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
await _controller.changeUserStatus(user, newStatus);
|
||||
},
|
||||
child: Text(statusText),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -173,7 +170,7 @@ class _UserListState extends State<UserList> {
|
||||
builder: (context, child) {
|
||||
if (_controller.isLoading && _controller.users.isEmpty) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
child: ShadProgress(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -226,28 +223,9 @@ class _UserListState extends State<UserList> {
|
||||
child: Column(
|
||||
children: [
|
||||
// 검색 바
|
||||
TextField(
|
||||
ShadInputFormField(
|
||||
controller: _searchController,
|
||||
decoration: InputDecoration(
|
||||
hintText: '이름, 이메일, 사용자명으로 검색...',
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
suffixIcon: _searchController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
_controller.setSearchQuery('');
|
||||
},
|
||||
)
|
||||
: null,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: ShadcnTheme.spacing3,
|
||||
),
|
||||
),
|
||||
placeholder: const Text('이름, 이메일, 사용자명으로 검색...'),
|
||||
),
|
||||
const SizedBox(height: ShadcnTheme.spacing3),
|
||||
// 필터 버튼들
|
||||
@@ -309,12 +287,13 @@ class _UserListState extends State<UserList> {
|
||||
// 관리자용 비활성 포함 체크박스
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
ShadCheckbox(
|
||||
value: _controller.includeInactive,
|
||||
onChanged: (_) => setState(() {
|
||||
_controller.toggleIncludeInactive();
|
||||
}),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text('비활성 포함'),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user