From a75ba845e4bbcdbd5fe8401cc02cafc6a7fac72c Mon Sep 17 00:00:00 2001 From: girinb Date: Tue, 15 Jul 2025 01:45:19 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=98=EB=8B=A8=20=EB=AC=B4=ED=95=9C=20?= =?UTF-8?q?=EC=A1=B0=EB=8B=9D=20=EC=B6=94=EA=B0=80.,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home_page.dart | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/home_page.dart b/lib/home_page.dart index 219c17b..e76a14f 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -95,6 +95,7 @@ class _HomePageState extends State { void initState() { super.initState(); _caseStudyPlans = _fetchCaseStudyPlans(); + _newCoursesFuture = _fetchNewCourses(); // Initialize new courses future _fetchTimezone(); _clockStream = Stream.periodic(const Duration(seconds: 1), (_) { @@ -353,7 +354,7 @@ class _HomePageState extends State { final plans = snapshot.data!; return ListView.builder( scrollDirection: Axis.horizontal, // 가로 스크롤로 변경 - padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0), + padding: const EdgeInsets.only(left: 10.0, right: 5.0, top: 8.0, bottom: 5.0), itemCount: plans.length, itemBuilder: (context, index) { final plan = plans[index]; @@ -395,7 +396,7 @@ class _HomePageState extends State { final courses = snapshot.data!; return ListView.builder( scrollDirection: Axis.horizontal, - padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0), + padding: const EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), itemCount: courses.length, itemBuilder: (context, index) { final course = courses[index]; @@ -410,6 +411,47 @@ class _HomePageState extends State { // --- ▼▼▼ 추천 클래스 섹션 호출 ▼▼▼ --- _buildRecommendSection(), // --- ▲▲▲ 추천 클래스 섹션 호출 끝 ▲▲▲ --- + const Padding( + padding: EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 8.0), + child: Text('Trending On New Study', style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + SizedBox( + height: 200, // 가로 리스트의 높이를 줄입니다. + child: FutureBuilder>( + future: _caseStudyPlans, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Padding( + padding: const EdgeInsets.all(16.0), + child: Text('Error loading upcoming classes: ${snapshot.error}', textAlign: TextAlign.center), + )); + } else if (!snapshot.hasData || snapshot.data!.isEmpty) { + return const Center(child: Text('No upcoming classes available.')); + } else { + final plans = snapshot.data!; + return ListView.builder( + scrollDirection: Axis.horizontal, // 가로 스크롤로 변경 + padding: const EdgeInsets.only(left: 10.0, right: 5.0, top: 8.0, bottom: 5.0), + itemCount: plans.length, + itemBuilder: (context, index) { + final plan = plans[index]; + return Align( + alignment: Alignment.topCenter, // 항목을 상단 중앙에 정렬 + child: UpcomingClassCard( + plan: plan, + onTap: () { + widget.onNavigateToPlanTab(1); + }, + ), + ); + }, + ); + } + }, + ), + ), ], ), );