Skip to content

Commit

Permalink
MERGE :: [#537] 루틴이 없을 때 페이지 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ljyo2o9 authored Jun 25, 2024
2 parents 1dced2c + 7a18a4d commit 5415e68
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:maeum_ga_gym_flutter/config/maeumgagym_color.dart';
import 'package:maeum_ga_gym_flutter/core/component/image/images.dart';
import 'package:maeum_ga_gym_flutter/core/component/image_widget.dart';
import 'package:maeum_ga_gym_flutter/core/component/text/pretendard/ptd_text_widget.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/presentation/widget/routine_default_title_widget.dart';

class SelfCareMyRoutineEmptyScreen extends StatelessWidget {
const SelfCareMyRoutineEmptyScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const RoutineDefaultTitleContainer(
title: "내 루틴",
subTitle: "나만의 루틴을 구성하여\n규칙적인 운동을 해보세요.",
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
color: MaeumgagymColor.gray50,
borderRadius: BorderRadius.circular(24),
),
child: const ImageWidget(
image: Images.iconsNotDesignSysRoutineIcon,
imageWidth: 75,
),
),
),
const SizedBox(height: 24),
PtdTextWidget.titleMedium("아직 루틴이 없어요", MaeumgagymColor.gray600),
const SizedBox(height: 12),
PtdTextWidget.bodyMedium("루틴을 추가하여 규칙적으로 운동해 보세요.", MaeumgagymColor.gray500),
],
),
const SizedBox(height: 96),
],
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:maeum_ga_gym_flutter/core/component/image/images.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/presentation/provider/routine_my_routine_my_routine_provider.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/view/my_routine/self_care_my_routine_add_screen.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/view/my_routine/self_care_my_routine_detail_screen.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/view/my_routine/self_care_my_routine_empty_screen.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/widget/my_routine/self_care_my_routine_button.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/widget/my_routine/self_care_my_routine_item_widget.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/widget/self_care_default_app_bar.dart';
Expand Down Expand Up @@ -68,51 +69,58 @@ class _SelfCareMyRoutineMainScreenState
iconPath: Images.arrowLeft,
),
body: SafeArea(
child: SingleChildScrollView(
controller: scrollController,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const RoutineDefaultTitleContainer(
title: "내 루틴",
subTitle: "나만의 루틴을 구성하여\n규칙적인 운동을 해보세요.",
),
const SizedBox(height: 32),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
child: Builder(
builder: (context) {
if (myRoutineState.routineList.isEmpty) {
return const SelfCareMyRoutineEmptyScreen();
}
return SingleChildScrollView(
controller: scrollController,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const RoutineDefaultTitleContainer(
title: "내 루틴",
subTitle: "나만의 루틴을 구성하여\n규칙적인 운동을 해보세요.",
),
const SizedBox(height: 32),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),

/// Notifier에 입력된 Model 개수만큼
itemCount: myRoutineState.routineList.length,
itemBuilder: (context, index) {
/// 공통된 변수
return Padding(
padding: EdgeInsets.only(
bottom: index == myRoutineState.routineList.length - 1
? 0
: 12),
child: GestureDetector(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SelfCareMyRoutineDetailScreen(
/// Notifier에 입력된 Model 개수만큼
itemCount: myRoutineState.routineList.length,
itemBuilder: (context, index) {
/// 공통된 변수
return Padding(
padding: EdgeInsets.only(
bottom: index == myRoutineState.routineList.length - 1
? 0
: 12),
child: GestureDetector(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SelfCareMyRoutineDetailScreen(
listIndex: index,
),
),
),
child: SelfCareMyRoutineItemWidget(
listIndex: index,
),
),
),
child: SelfCareMyRoutineItemWidget(
listIndex: index,
),
),
);
},
);
},
),
const SizedBox(height: 98),
],
),
const SizedBox(height: 98),
],
),
),
),
);
}
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,61 +76,63 @@ class _SelfCarePurposeMainScreenState
iconPath: Images.arrowLeft,
),
body: SafeArea(
child: Builder(
builder: (context) {
if(myPurposeState.purposeList.isEmpty){
return const SelfCarePurposeEmptyScreen();
}

return SingleChildScrollView(
controller: scrollController,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const RoutineDefaultTitleContainer(
title: "목표",
subTitle: "나만의 목표를 세워보세요.",
),
const SizedBox(height: 32),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: myPurposeState.purposeList.length, // 임의로 넣은 아이템 갯수
itemBuilder: (context, index) {
return Column(
children: [
GestureDetector(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SelfCarePurposeDetailScreen(purposeId: myPurposeState.purposeList[index].id!),
),
),
child: SelfCarePurposeItemWidget(
purposeId: myPurposeState.purposeList[index].id!,
title: myPurposeState.purposeList[index].title
.toString(),
subTitle: myPurposeState
.purposeList[index].startDate
.toString(),
child: Builder(builder: (context) {
if (myPurposeState.purposeList.isEmpty) {
return const SelfCarePurposeEmptyScreen();
}
return SingleChildScrollView(
controller: scrollController,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const RoutineDefaultTitleContainer(
title: "목표",
subTitle: "나만의 목표를 세워보세요.",
),
const SizedBox(height: 32),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: myPurposeState.purposeList.length,
// 임의로 넣은 아이템 갯수
itemBuilder: (context, index) {
return Column(
children: [
GestureDetector(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
SelfCarePurposeDetailScreen(
purposeId: myPurposeState
.purposeList[index].id!),
),
),
SizedBox(
height: index == myPurposeState.purposeList.length - 1 ?
0 : 12
child: SelfCarePurposeItemWidget(
purposeId: myPurposeState.purposeList[index].id!,
title: myPurposeState.purposeList[index].title
.toString(),
subTitle: myPurposeState
.purposeList[index].startDate
.toString(),
),
],
);
},
),
const SizedBox(height: 98),
],
),
),
SizedBox(
height:
index == myPurposeState.purposeList.length - 1
? 0
: 12),
],
);
},
),
const SizedBox(height: 98),
],
),
);
}
),
),
);
}),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: GestureDetector(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

publish_to: 'none'

version: 0.9.47+112
version: 0.9.48+113

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down

0 comments on commit 5415e68

Please sign in to comment.