Skip to content

feat: custom button#55

Open
KangGio wants to merge 5 commits into
mainfrom
FLG-47
Open

feat: custom button#55
KangGio wants to merge 5 commits into
mainfrom
FLG-47

Conversation

@KangGio
Copy link
Copy Markdown

@KangGio KangGio commented Jul 17, 2025

Summary by CodeRabbit

  • New Features
    • 커스텀 버튼의 다양한 변형(서피스, 아웃라인)과 활성/비활성 상태를 라이트 및 다크 테마에서 시각적으로 확인할 수 있는 새로운 데모 앱이 추가되었습니다.

@KangGio KangGio requested a review from a team as a code owner July 17, 2025 04:55
@linear
Copy link
Copy Markdown

linear Bot commented Jul 17, 2025

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fliggle-fe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 8:24am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 17, 2025

Walkthrough

이 변경사항에서는 Flutter 애플리케이션이 새롭게 도입되어, 커스텀 버튼의 다양한 변형(variant)과 라이트/다크 테마를 시연합니다. 주요 색상 상수가 정의되며, MyApp 위젯은 Material 3 디자인과 라이트/다크 컬러 스킴을 적용하는 MaterialApp을 설정합니다. 홈 화면인 ButtonDemoPage는 네 개의 CustomButton 위젯(각각 surface/outline 변형과 활성/비활성 상태)을 포함한 컬럼을 표시합니다. CustomButton 위젯은 변형 타입과 비활성화 여부에 따라 배경색, 텍스트색, 테두리색 등을 동적으로 결정하여 버튼을 렌더링합니다.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3b19c8 and 302005d.

📒 Files selected for processing (1)
  • lib/custom button.dart (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: hoony6134
PR: route-five/fliggle-fe#30
File: lib/view/core/components/custom_text_field.dart:18-24
Timestamp: 2025-07-16T07:00:56.103Z
Learning: The user hoony6134 plans to componentize the CustomTextField styles in the future to address code duplication, rather than applying immediate refactoring suggestions.
Learnt from: hoony6134
PR: route-five/fliggle-fe#45
File: lib/app/view/auth/register/step_4.dart:12-12
Timestamp: 2025-07-16T08:47:49.421Z
Learning: The user hoony6134 prefers to handle hardcoded color values like `Colors.white` in `lib/app/view/auth/register/step_4.dart` as part of a separate issue focusing on the color theme system, rather than making immediate changes in individual PRs.
lib/custom button.dart (3)
Learnt from: hoony6134
PR: route-five/fliggle-fe#45
File: lib/app/view/auth/register/step_4.dart:12-12
Timestamp: 2025-07-16T08:47:49.421Z
Learning: The user hoony6134 prefers to handle hardcoded color values like `Colors.white` in `lib/app/view/auth/register/step_4.dart` as part of a separate issue focusing on the color theme system, rather than making immediate changes in individual PRs.
Learnt from: hoony6134
PR: route-five/fliggle-fe#30
File: lib/view/core/components/custom_text_field.dart:26-32
Timestamp: 2025-07-16T07:01:22.253Z
Learning: The user hoony6134 is currently working on a color theme system and plans to extract hardcoded style values later as part of this broader theming work.
Learnt from: hoony6134
PR: route-five/fliggle-fe#30
File: lib/view/core/components/custom_text_field.dart:18-24
Timestamp: 2025-07-16T07:00:56.103Z
Learning: The user hoony6134 plans to componentize the CustomTextField styles in the future to address code duplication, rather than applying immediate refactoring suggestions.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 17, 2025
@hoony6134 hoony6134 changed the title button feat: custom button Jul 17, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
lib/custom button.dart (3)

70-70: 타입 안전성을 위해 enum 사용을 고려해보세요.

variant 매개변수가 String 타입으로 되어 있어 런타임 에러 가능성이 있습니다.

다음과 같이 enum을 사용하는 것을 고려해보세요:

+enum ButtonVariant { surface, outline }
+
 class CustomButton extends StatelessWidget {
-  final String variant;
+  final ButtonVariant variant;
   final bool disabled;

그리고 사용하는 부분에서:

-  final bool isOutline = variant == 'outline';
+  final bool isOutline = variant == ButtonVariant.outline;

89-89: onPressed 콜백을 더 의미있게 만들어보세요.

현재 빈 콜백 () {}는 실제 사용에서 유용하지 않습니다.

다음과 같이 외부에서 콜백을 받도록 수정하는 것을 고려해보세요:

 class CustomButton extends StatelessWidget {
   final String variant;
   final bool disabled;
+  final VoidCallback? onPressed;

   const CustomButton({
     super.key,
     required this.variant,
     required this.disabled,
+    this.onPressed,
   });

그리고 버튼에서:

-        onPressed: disabled ? null : () {},
+        onPressed: disabled ? null : onPressed,

119-119: 버튼 텍스트를 매개변수화하는 것을 고려해보세요.

하드코딩된 'Button' 텍스트는 재사용성을 제한합니다.

다음과 같이 텍스트를 매개변수로 받도록 수정하는 것을 고려해보세요:

 class CustomButton extends StatelessWidget {
   final String variant;
   final bool disabled;
+  final String text;

   const CustomButton({
     super.key,
     required this.variant,
     required this.disabled,
+    this.text = 'Button',
   });

그리고 버튼에서:

-        child: const Text('Button', style: TextStyle(fontSize: 12)),
+        child: Text(text, style: const TextStyle(fontSize: 12)),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb17626 and 4d5d8a1.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • lib/custom button.dart (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
lib/custom button.dart (1)
Learnt from: hoony6134
PR: route-five/fliggle-fe#45
File: lib/app/view/auth/register/step_4.dart:12-12
Timestamp: 2025-07-16T08:47:49.421Z
Learning: The user hoony6134 prefers to handle hardcoded color values like `Colors.white` in `lib/app/view/auth/register/step_4.dart` as part of a separate issue focusing on the color theme system, rather than making immediate changes in individual PRs.
🔇 Additional comments (4)
lib/custom button.dart (4)

1-5: 표준적인 Flutter 앱 구조입니다.

임포트와 메인 함수가 올바르게 구현되어 있습니다.


7-13: 색상 상수들이 잘 정의되어 있습니다.

라이트/다크 테마를 위한 색상 상수들이 일관된 네이밍 패턴으로 정의되어 있습니다. 향후 테마 시스템으로 통합될 수 있을 것 같습니다.


15-42: 잘 구성된 앱 설정입니다.

Material 3 디자인과 시스템 테마 모드를 사용하며, 라이트/다크 테마 모두 올바르게 구성되어 있습니다.


44-67: 데모 페이지가 명확하게 구성되어 있습니다.

다양한 버튼 변형과 상태를 보여주는 구조가 잘 정리되어 있습니다.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 17, 2025
Copy link
Copy Markdown
Contributor

@hoony6134 hoony6134 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요청한 수정 사항 반영해 주세요. 또한, 파일 이름을 명명법에 맞게 수정해 주시고, 위치 또한 이동해주세요. app/core/components/custom_button.dart로 수정해야 합니다.

Comment thread lib/custom button.dart
Comment on lines +7 to +13
const Color lightPrimaryColor = Color(0xFF6C98FF);
const Color lightSecondaryColor = Color(0xFF87A9F7);

const Color darkPrimaryColor = Color(0xFF497BEE);
const Color darkSecondaryColor = Color(0xFF6C98FF);

const Color disabledColor = Color(0xFF808080);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이미 app/view/core/design에 색상들이 정의된 파일을 생성해 두었습니다. 그 파일을 이용해 주시고, app/view/register/step_4.dart 파일과 app/view/core/components/custom_text_field.dart에서 사용한 방식을 참고해 주세요.

Comment thread lib/custom button.dart
Comment on lines +3 to +5
void main() {
runApp(const MyApp());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preview화면을 요청한 것이 아닌, 컴포넌트만 정의된 파일을 의미했습니다. 작동 확인할 수 있는 화면은 제거해 주시고 본 파일에는 컴포넌트 관련 코드만 남겨주세요.

Comment thread lib/custom button.dart
Comment on lines +23 to +38
theme: ThemeData(
useMaterial3: true,
brightness: Brightness.light,
colorScheme: ColorScheme.light(
primary: lightPrimaryColor,
secondary: lightSecondaryColor,
),
),
darkTheme: ThemeData(
useMaterial3: true,
brightness: Brightness.dark,
colorScheme: ColorScheme.dark(
primary: darkPrimaryColor,
secondary: darkSecondaryColor,
),
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theme, darkTheme 모두 app/view/core/design/fliggle_theme_data.dart에 관련 스타일이 정의되어 있습니다. 만약 추가적인 스타일이 필요하다면 app/view/core/design 폴더 내에 있는 요소를 변경하거나, 추가해 주세요.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

또한, 위에서 언급드린 것처럼 app은 건들지 말아주세요. app.dart에 수정 사항이 필요하다면 app/app.dart의 내용을 수정해 주세요.

Comment thread lib/custom button.dart
Comment on lines +82 to +83
final colorScheme = Theme.of(context).colorScheme;
final Color primary = colorScheme.primary;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이것 또한 별도로 구현해 놓은 FliggleThemeDataFliggleColors를 이용해 주세요.

Comment thread lib/custom button.dart
Comment on lines +44 to +67
class ButtonDemoPage extends StatelessWidget {
const ButtonDemoPage({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Button Variants")),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: const [
CustomButton(variant: 'surface', disabled: false),
SizedBox(height: 10),
CustomButton(variant: 'surface', disabled: true),
SizedBox(height: 10),
CustomButton(variant: 'outline', disabled: false),
SizedBox(height: 10),
CustomButton(variant: 'outline', disabled: true),
],
),
),
);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

데모는 지워주세요

Comment thread lib/custom button.dart
Comment on lines +85 to +121
return SizedBox(
width: 120,
height: 34,
child: ElevatedButton(
onPressed: disabled ? null : () {},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith<Color>((states) {
if (states.contains(WidgetState.disabled)) {
return isOutline ? Colors.white : disabledColor;
}
return isOutline ? Colors.white : primary;
}),
foregroundColor: WidgetStateProperty.resolveWith<Color>((states) {
if (states.contains(WidgetState.disabled)) {
return isOutline ? disabledColor : Colors.white;
}
return isOutline ? primary : Colors.white;
}),
side: WidgetStateProperty.resolveWith<BorderSide>((states) {
if (!isOutline) return BorderSide.none;
return BorderSide(
color: states.contains(WidgetState.disabled)
? disabledColor
: primary,
);
}),
padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
),
elevation: WidgetStateProperty.all(0),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
),
child: const Text('Button', style: TextStyle(fontSize: 12)),
),
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

실행 화면 스크린샷 올려주세요

@hoony6134
Copy link
Copy Markdown
Contributor

@hoony6134 hoony6134 requested review from a team and rhseung July 17, 2025 05:50
Comment thread lib/custom button.dart
width: 120,
height: 34,
child: ElevatedButton(
onPressed: disabled ? null : () {},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onTap을 property로 넘길 수 있게 해주세요

Comment thread lib/custom button.dart
),
elevation: WidgetStateProperty.all(0),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),

피그마와 동일하게 맞춰주세요

Comment thread lib/custom button.dart
Comment on lines +89 to +96
onPressed: disabled ? null : () {},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith<Color>((states) {
if (states.contains(WidgetState.disabled)) {
return isOutline ? Colors.white : disabledColor;
}
return isOutline ? Colors.white : primary;
}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위젯의 disabled 값과 WidgetState.disabled가 혼용되는 것 같아요 코드 전체에서

Comment thread lib/custom button.dart
);
}),
padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

피그마와 동일하게

Comment thread lib/custom button.dart
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
),
child: const Text('Button', style: TextStyle(fontSize: 12)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text를 property로 넘길 수 있게 해주세요

Comment thread lib/custom button.dart
Comment on lines +86 to +87
width: 120,
height: 34,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text에 따라 위젯의 크기가 동적으로 변할 수 있습니다. SizedBox를 제거해주세요

@hoony6134
Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 17, 2025

✅ Actions performed

Full review triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants