Skip to content

245 모달 컴포넌트 제작 #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9227d0f
chore: change name from schedule start into schedule start screen
SeoHyeonSim Apr 2, 2025
a3b19d0
feat: create modal component and apply in schedule start screen
SeoHyeonSim Apr 2, 2025
19f9fa5
feat: add usecase for modal component
SeoHyeonSim Apr 2, 2025
0494fff
fix: get image asset from assets characters folder
SeoHyeonSim Apr 2, 2025
38e3522
refactor: modify modal component for alterdialog
SeoHyeonSim Apr 2, 2025
45a5060
chore: add character variable svg files
SeoHyeonSim Apr 2, 2025
5cc86c3
chore: fix minor error
SeoHyeonSim Apr 2, 2025
c6e3857
refactor: change modal component according to alert dialog style
SeoHyeonSim Apr 9, 2025
047ffb2
refactor: add modal button component and change image names
SeoHyeonSim Apr 9, 2025
2a54378
chore: remove unnecessary blank lines in launch configuration
jjoonleo Apr 29, 2025
aeef3cb
refactor: enhance dialog theme with custom styles and remove unused t…
jjoonleo Apr 29, 2025
7bbdaa9
feat: implement CustomAlertDialog component and remove ModalComponent
jjoonleo May 1, 2025
04029c3
refactor: remove unnecessary padding from background container in Wid…
jjoonleo May 1, 2025
cce037c
refactor: replace ModalComponent with CustomAlertDialog in ScheduleSt…
jjoonleo May 1, 2025
d9818ec
feat: add CustomAlertDialog component and remove ModalComponent
jjoonleo May 1, 2025
98e0b77
Merge pull request #256 from DevKor-github/245-모달-컴포넌트-제작-refactor
SeoHyeonSim May 2, 2025
1a80e05
refactor: delete unnecessary imports and texts in custom alert dialog
SeoHyeonSim May 3, 2025
5eec840
refactor: fix custom alert dialog according to design
SeoHyeonSim May 3, 2025
2317b4e
feat: add modal error button
SeoHyeonSim May 3, 2025
cf4144a
refactor: change widgetbook usecase according to design
SeoHyeonSim May 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions assets/characters/character_late_earth.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions assets/characters/character_success_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions assets/characters/character_success_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
149 changes: 93 additions & 56 deletions lib/presentation/alarm/screens/schedule_start_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,114 @@ import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';

import 'package:on_time_front/domain/entities/schedule_entity.dart';

import 'package:on_time_front/presentation/shared/components/button.dart';
import 'package:on_time_front/presentation/shared/components/modal_component.dart';

class ScheduleStart extends StatelessWidget {
class ScheduleStartScreen extends StatefulWidget {
final ScheduleEntity schedule;

const ScheduleStart({
const ScheduleStartScreen({
super.key,
required this.schedule,
});

@override
State<ScheduleStartScreen> createState() => _ScheduleStartScreenState();
}

class _ScheduleStartScreenState extends State<ScheduleStartScreen> {
void _showModal(BuildContext context) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return ModalComponent(
leftPressed: () {
context.go('/home');
},
rightPressed: () => Navigator.of(context).pop(),
modalTitleText: '정말 나가시겠어요?',
modalDetailText: '이 화면을 나가면\n함께 약속을 준비할 수 없게 돼요.',
leftButtonText: '나갈래요',
leftButtonColor: Theme.of(context).colorScheme.surfaceContainerLow,
leftButtonTextColor: Theme.of(context).colorScheme.outline,
rightButtonText: '있을래요',
rightButtonColor: Theme.of(context).colorScheme.primary,
rightButtonTextColor: Theme.of(context).colorScheme.onPrimary,
);
},
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
),
body: Column(
body: Stack(
children: [
Padding(
padding: const EdgeInsets.only(top: 90),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
schedule.scheduleName,
style: const TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Color(0xff5C79FB),
),
),
const SizedBox(height: 8),
Text(
schedule.place.placeName,
style: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 60),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
widget.schedule.scheduleName,
style: const TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Color(0xff5C79FB),
),
),
const SizedBox(height: 8),
Text(
widget.schedule.place.placeName,
style: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 15),
Text(
'지금 준비 시작 안하면 늦어요!',
style: const TextStyle(
fontSize: 15,
),
textAlign: TextAlign.center,
),
Padding(
padding: const EdgeInsets.only(top: 50),
child: SvgPicture.asset(
'characters/character.svg',
package: 'assets',
width: 204,
height: 269,
),
),
],
),
const SizedBox(height: 15),
Text(
'지금 준비 시작 안하면 늦어요!',
style: const TextStyle(
fontSize: 15,
),
textAlign: TextAlign.center,
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: SvgPicture.asset(
'characters/character.svg',
package: 'assets',
width: 204,
height: 269,
),
)
],
),
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Button(
text: '준비 시작',
onPressed: () async {
context.go('/alarmScreen', extra: widget.schedule);
},
),
),
],
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Button(
text: '준비 시작',
onPressed: () async {
context.go('/alarmScreen', extra: schedule);
},
Positioned(
top: 10,
right: 10,
child: IconButton(
icon: const Icon(Icons.close),
onPressed: () => _showModal(context),
),
),
],
Expand Down
12 changes: 12 additions & 0 deletions lib/presentation/moving/screens/moving_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';

class MovingScreen extends StatelessWidget {
const MovingScreen({super.key});

@override
Widget build(BuildContext context) {
return Container(
child: Text('this is moving screen'),
);
}
}
127 changes: 127 additions & 0 deletions lib/presentation/shared/components/modal_component.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import 'dart:ui';
import 'package:flutter/material.dart';

class ModalComponent extends StatelessWidget {
final VoidCallback leftPressed;
final VoidCallback rightPressed;
final String modalTitleText;
final String modalDetailText;
final String leftButtonText;
final String rightButtonText;
final Color leftButtonColor;
final Color leftButtonTextColor;
final Color rightButtonColor;
final Color rightButtonTextColor;

const ModalComponent({
super.key,
required this.leftPressed,
required this.rightPressed,
required this.modalTitleText,
required this.modalDetailText,
required this.leftButtonText,
required this.rightButtonText,
required this.leftButtonColor,
required this.leftButtonTextColor,
required this.rightButtonColor,
required this.rightButtonTextColor,
});

@override
Widget build(BuildContext context) {
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 0, sigmaY: 0),
child: AlertDialog(
backgroundColor: Colors.white,
contentPadding: const EdgeInsets.all(20),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
content: SizedBox(
width: 276,
height: 145,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title & Description Section
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
modalTitleText,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10),
Text(
modalDetailText,
style: const TextStyle(
fontSize: 13,
),
),
],
),
// Buttons Section
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_Button(
onPressed: leftPressed,
text: leftButtonText,
backgroundColor: leftButtonColor,
textColor: leftButtonTextColor,
),
const SizedBox(width: 8),
_Button(
onPressed: rightPressed,
text: rightButtonText,
backgroundColor: rightButtonColor,
textColor: rightButtonTextColor,
),
],
),
],
),
),
),
);
}
}

class _Button extends StatelessWidget {
final VoidCallback onPressed;
final String text;
final Color backgroundColor;
final Color textColor;

const _Button({
required this.onPressed,
required this.text,
required this.backgroundColor,
required this.textColor,
});

@override
Widget build(BuildContext context) {
return SizedBox(
width: 114,
height: 43,
child: TextButton(
style: TextButton.styleFrom(
backgroundColor: backgroundColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
onPressed: onPressed,
child: Text(
text,
style: TextStyle(color: textColor, fontSize: 18),
),
),
);
}
}
7 changes: 6 additions & 1 deletion lib/presentation/shared/router/go_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:on_time_front/presentation/app/bloc/app_bloc.dart';
import 'package:on_time_front/presentation/calendar/screens/calendar_screen.dart';
import 'package:on_time_front/presentation/home/screens/home_screen.dart';
import 'package:on_time_front/presentation/login/screens/sign_in_main_screen.dart';
import 'package:on_time_front/presentation/moving/screens/moving_screen.dart';
import 'package:on_time_front/presentation/onboarding/screens/onboarding_screen.dart';
import 'package:on_time_front/presentation/onboarding/screens/onboarding_start_screen.dart';
import 'package:on_time_front/presentation/schedule_create/schedule_spare_and_preparing_time/preparation_form/screens/preparation_edit_form.dart';
Expand Down Expand Up @@ -93,7 +94,7 @@ GoRouter goRouterConfig(AppBloc bloc) {
path: '/scheduleStart',
name: 'scheduleStart',
builder: (context, state) {
return ScheduleStart(schedule: state.extra as ScheduleEntity);
return ScheduleStartScreen(schedule: state.extra as ScheduleEntity);
},
),
GoRoute(
Expand All @@ -116,6 +117,10 @@ GoRouter goRouterConfig(AppBloc bloc) {
);
},
),
GoRoute(
path: '/moving',
builder: (context, state) => MovingScreen(),
),
],
);
}
Loading