first commit
This commit is contained in:
51
lib/widgets/header.dart
Normal file
51
lib/widgets/header.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Header extends StatelessWidget {
|
||||
// ✨ 메인 화면(main.dart)으로부터 동적 타이틀과 토글 함수를 전달받도록 변수 설정
|
||||
final String title;
|
||||
final bool isSidebarOpen;
|
||||
final VoidCallback onToggleSidebar;
|
||||
|
||||
const Header({
|
||||
super.key,
|
||||
required this.title, // ✨ 필수 파라미터로 등록
|
||||
required this.isSidebarOpen,
|
||||
required this.onToggleSidebar,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
color: const Color(0xFF13161A),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
// 사이드바 토글 메뉴 버튼
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
isSidebarOpen ? Icons.menu_open : Icons.menu,
|
||||
color: const Color(0xFFB4E49C),
|
||||
),
|
||||
onPressed: onToggleSidebar,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// ✨ 고정된 텍스트 대신 전달받은 title 변수를 출력합니다!
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Icon(Icons.help_outline, size: 16, color: Colors.white38),
|
||||
],
|
||||
),
|
||||
const Icon(Icons.notifications_none, color: Colors.white70, size: 24),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user