학생/교사/관리자 대시보드를 하나의 공통 화면으로 통합
StudentDashboard, TeacherDashboard, AdminDashboard(진입 라우팅)를 MainDashboard 하나로 합치고, 역할(role)에 따라 배너 색상/문구와 보이는 타일만 달라지게 함. 그리드 레이아웃/카드 디자인은 이제 한 곳에서만 관리되어, 앞으로 UI를 고치면 모든 역할에 자동 적용됨. - 2061(개발자) 계정에 기존에 빠져있던 "스마트기기 반출 대장" 타일 추가 - role=='admin' 실 계정도 이제 학생 계정 관리/출석 확인 등 교사 기능에 접근 가능 (관리자는 교사 권한을 포함하는 것으로 정리) - 작은 DB 초기화 전용 화면(admin_dashboard.dart)은 "서버 DB 제어" 타일의 목적지로만 유지, 로그인 직후 랜딩 화면 역할은 제거 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+23
-38
@@ -3,9 +3,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../config.dart' show schoolName;
|
||||
import '../function/login_controller.dart';
|
||||
import 'student_dashboard.dart';
|
||||
import 'teacher_dashboard.dart';
|
||||
import 'admin_dashboard.dart';
|
||||
import 'main_dashboard.dart';
|
||||
import 'teacher_register_screen.dart';
|
||||
|
||||
// -------------------------------------------------------------
|
||||
@@ -50,9 +48,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => StudentDashboard(
|
||||
studentId: result.studentId!,
|
||||
studentName: result.name!,
|
||||
builder: (context) => MainDashboard(
|
||||
userId: result.studentId!,
|
||||
userName: result.name!,
|
||||
role: 'student',
|
||||
isDeviceMatched: true,
|
||||
),
|
||||
),
|
||||
@@ -154,9 +153,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
|
||||
if (success) {
|
||||
Navigator.pop(dialogContext);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(message)),
|
||||
);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(message)));
|
||||
_navigateBasedOnRole(
|
||||
role,
|
||||
studentId,
|
||||
@@ -164,9 +163,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
isDeviceMatched,
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(message)),
|
||||
);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(message)));
|
||||
}
|
||||
},
|
||||
child: const Text('변경하고 시작하기'),
|
||||
@@ -186,31 +185,17 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
String name,
|
||||
bool isDeviceMatched,
|
||||
) {
|
||||
if (role == 'teacher') {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
TeacherDashboard(teacherId: studentId, teacherName: name),
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MainDashboard(
|
||||
userId: studentId,
|
||||
userName: name,
|
||||
role: role,
|
||||
isDeviceMatched: isDeviceMatched,
|
||||
),
|
||||
);
|
||||
} else if (role == 'admin') {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const AdminDashboard()),
|
||||
);
|
||||
} else {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => StudentDashboard(
|
||||
studentId: studentId,
|
||||
studentName: name,
|
||||
isDeviceMatched: isDeviceMatched,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showErrorDialog(String message) {
|
||||
@@ -403,7 +388,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
onPressed: () => _showLegacyPasswordDialog(
|
||||
'선생님',
|
||||
'1234',
|
||||
const TeacherDashboard(),
|
||||
const MainDashboard(role: 'teacher'),
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
@@ -419,7 +404,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
onPressed: () => _showLegacyPasswordDialog(
|
||||
'시스템 관리자',
|
||||
'4936',
|
||||
const AdminDashboard(),
|
||||
const MainDashboard(role: 'admin'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user