Skip to content
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

๐Ÿšง ๋กœ๊ทธ์•„์›ƒ ์‹œ ํŠธํ‹ฐ ํ™ˆ ํƒญ์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ๋กœ์ง ์ถ”๊ฐ€ ๋ฐ ํšŒ์› ๊ฐ€์ž… ์ „์ฒด ๋™์˜ ๋ฒ„ํŠผ ์—๋Ÿฌ ์ˆ˜์ • #9

Merged
merged 5 commits into from
Feb 17, 2024

Conversation

changhwan77
Copy link
Collaborator

@changhwan77 changhwan77 commented Feb 16, 2024

Title

๐Ÿšง ๋กœ๊ทธ์•„์›ƒ ์‹œ ํŠธํ‹ฐ ํ™ˆ ํƒญ์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ๋กœ์ง ์ถ”๊ฐ€

What type of PR is this?

  • ๐Ÿ• Feature ( ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ์ถ”๊ฐ€ )
  • ๐Ÿ› Bug Fix ( ๋ฒ„๊ทธ ์ˆ˜์ • )
  • ๐Ÿ“ Documentation Update ( ๊ฐœ๋ฐœ์ž ๊ด€๋ จ ๋ฌธ์„œ ์—…๋ฐ์ดํŠธ )
  • ๐ŸŽจ Style ( ์ฝ”๋“œ ํฌ๋งทํŒ…, ์„ธ๋ฏธ์ฝœ๋ก  ๋ˆ„๋ฝ, ์ฝ”๋“œ ๋ณ€๊ฒฝ์ด ์—†๋Š” ๊ฒฝ์šฐ )
  • ๐Ÿง‘โ€๐Ÿ’ป Code Refactor ( ์ฝ”๋“œ ๋ฆฌํŽ™ํ† ๋ง )
  • ๐Ÿ”ฅ Performance Improvements ( ์„ฑ๋Šฅ ํ–ฅ์ƒ )
  • โœ… Test ( ํ…Œ์ŠคํŠธ ์ฝ”๋“œ, ๋ฆฌํŽ™ํ† ๋ง ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ถ”๊ฐ€ )
  • ๐Ÿค– Build ( ๋นŒ๋“œ )
  • ๐Ÿ” CI
  • ๐Ÿ“ฆ Chore (Release) (๋นŒ๋“œ ์—…๋ฌด ์ˆ˜์ •, ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ € ์ˆ˜์ • )
  • โฉ Revert ( ์ปค๋ฐ‹์„ ๋‚ ๋ฆฐ ๊ฒฝ์šฐ )

Description

  1. ์œ ์ €๊ฐ€ ๋งˆ์ดํŽ˜์ด์ง€ ํƒญ์—์„œ ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ์„ ํด๋ฆญ ์‹œ ํŠธํ‹ฐ ํ™ˆ ํƒญ์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ๋กœ์ง ์ถ”๊ฐ€
  • As-is: ๋งˆ์ดํŽ˜์ด์ง€ ํƒญ์—์„œ ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด๋„ ๋งˆ์ดํŽ˜์ด์ง€์— ์œ ์ €๊ฐ€ ๋‚จ์•„์žˆ์—ˆ์Œ.
  • To-Be: ์œ„ ๋ฌธ์ œ ํ•ด๊ฒฐ
  1. ํšŒ์›๊ฐ€์ž… > ๊ฐœ์ธ ์œ ์ € > ์ „์ฒด ๋™์˜ ๋ฒ„ํŠผ ๊ด€๋ จ ์˜ค๋ฅ˜ ์ˆ˜์ •
  • As-is: ์ „์ฒด ๋™์˜๋ฅผ ํด๋ฆญ ํ›„ ์ „์ฒด ๋™์˜ ๋ฒ„ํŠผ ์ด์™ธ์— ๋‹ค๋ฅธ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ๋ชจ๋“  ๋ฒ„ํŠผ์˜ ์ฒดํฌ๊ฐ€ ์‚ฌ๋ผ์ง
  • To-Be: ์œ„ ๋ฌธ์ œ ํ•ด๊ฒฐ + ์ „์ฒด ๋™์˜ ๋ฒ„ํŠผ ์ด์™ธ์— ๋‹ค๋ฅธ ๋ฒ„ํŠผ์ด ๋ชจ๋“  ํด๋ฆญ ๋˜์–ด๋„ ์ „์ฒด ๋™์˜ ๋ฒ„ํŠผ์˜ ์ฒดํฌ ํ‘œ์‹œ๊ฐ€ ์•ˆ๋˜๋„๋ก ๋ณ€๊ฒฝ
  1. ํŠธํ‹ฐ ํ™ˆ ๋ฉ”์ธ ๋ฐฐ๋„ˆ ์ถ”๊ฐ€ ๋ฐ ์Šคํฌ๋กค ์‹œ ์ˆจ๊ฒจ์ง€๋„๋ก ๊ธฐ๋Šฅ ์ถ”๊ฐ€
  • As-is: ListView์— ๋ฉ”์ธ ๋ฐฐ๋„ˆ์™€ GridView๋ฅผ ์‚ฌ์šฉํ•  ์‹œ ๋ฐฐ๋„ˆ๊ฐ€ ์Šคํฌ๋กค์ด ์•ˆ๋˜๊ณ  GridView๊ฐ€ ๋†’์ด๋ฅผ ๋ฌดํ•œ์œผ๋กœ ๊ฐ€์ง€๋ ค๊ณ  ํ•ด Layout crush ๋ฐœ์ƒ.
  • To-Be: CustomScrollView ์‚ฌ์šฉํ•˜์—ฌ ์œ„ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐ

Related Issue number and link

  • Jira :
  • Issue :

Mobile & Desktop Screenshots/Recordings

default.mp4

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

To Reviewers

build ๋ฉ”์„œ๋“œ์—์„œ ํ† ํฐ ์ธ์ฆ ๋“ฑ์„ ์ฒดํฌํ•ด๋„ ๋˜๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค..!

@changhwan77 changhwan77 changed the title ๐Ÿšง ๋กœ๊ทธ์•„์›ƒ ์‹œ ํŠธํ‹ฐ ํ™ˆ ํƒญ์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ๋กœ์ง ์ถ”๊ฐ€ ๐Ÿšง ๋กœ๊ทธ์•„์›ƒ ์‹œ ํŠธํ‹ฐ ํ™ˆ ํƒญ์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ๋กœ์ง ์ถ”๊ฐ€ ๋ฐ ํšŒ์› ๊ฐ€์ž… ์ „์ฒด ๋™์˜ ๋ฒ„ํŠผ ์—๋Ÿฌ ์ˆ˜์ • Feb 16, 2024
late int _selectedIndex = _tabs.indexOf(widget.tab);
@override
Widget build(BuildContext context) {
int selectedIndex = ref.watch(navigationSelectedIndexProvider);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋งˆ์ดํŽ˜์ด์ง€ ํƒญ์—์„œ ๋กœ๊ทธ์•„์›ƒ ์‹œ selectedIndex๋ฅผ ๋„˜๊ฒจ์ฃผ์–ด์•ผ ํ™ˆ ํƒญ์œผ๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์œ„์ ฏ ๊ฐ„ ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋ฅผ ๊ณต์œ ํ•˜๊ธฐ ์œ„ํ•ด ์ƒํƒœ ๊ด€๋ฆฌ ์†”๋ฃจ์…˜์„ ์‚ฌ์šฉํ–ˆ์–ด์š”.

setState(() {
// ์œ ์ €๊ฐ€ ํด๋ฆญํ•œ index๋ฅผ navigationSelectedIndexProvider์˜ state์— ํ• ๋‹น
ref.read(navigationSelectedIndexProvider.notifier).state = index;
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

onTap ์—์„œ ์œ ์ €๊ฐ€ ํด๋ฆญํ•œ index๋ฅผ ๋ฐ›์•„ navigationSelectedIndexProvider๊ฐ€ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ๋Š” selectedIndex ๊ฐ’์„ ์—…๋ฐ์ดํŠธ ํ•ด์ฃผ๋ฉด์„œ setStateํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ด ํ™”๋ฉด์„ ๋‹ค์‹œ ๊ทธ๋ ค์š” -> ์œ ์ €๊ฐ€ ํด๋ฆญํ•œ ํƒญ์˜ ํ™”๋ฉด์œผ๋กœ ์ด๋™

'profile',
];

final tab = ref.watch(tabsProvider);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

router.dart์—์„œ MainNavigationScreen์œผ๋กœ ๋„˜๊ธฐ๋Š” tab ๊ฐ’์„ tabsProvider๋กœ ๊ด€๋ฆฌํ•ด์š”.


final tab = ref.watch(tabsProvider);

int selectedIndex = tabs.indexOf(tab);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๊ทธ๋ ‡๊ฒŒ ๋ฐ›์€ tab ๊ฐ’์„ tabs ๋ผ๋Š” ๋ฆฌ์ŠคํŠธ๋ฅผ ์ˆœํšŒํ•˜๋ฉด์„œ ๊ฐ™์€ ๊ฐ’์„ ์ฐพ์œผ๋ฉด ๋ฆฌ์ŠคํŠธ์—์„œ ํ•ด๋‹น ๊ฐ’์ด ์œ„์น˜ํ•œ ๊ณณ(index)๋ฅผ selectedIndex๋กœ ์•ฑ ์‹คํ–‰ ํ›„ ์ดˆ๊ธฐ ๊ฐ’์„ ํ• ๋‹นํ•ด์š”.

@@ -0,0 +1,3 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';

final tabsProvider = StateProvider<String>((ref) => 'tuti');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์•ฑ ์‹คํ–‰ ์‹œ ํ™”๋ฉด ์ง„์ž…์ ์€ tuti ํ™”๋ฉด์ด๊ธฐ ๋•Œ๋ฌธ์— ์ดˆ๊ธฐ ๊ฐ’์„ tuti๋กœ ์„ค์ •ํ•ด์คฌ์–ด์š”.

style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(fontWeight: FontWeight.w600),
controller: _nameController,
onEditingComplete: () {
if (_name.isNotEmpty) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TextField์˜ ํฐํŠธ๊ฐ€ ๋„ˆ๋ฌด ์ปค์„œ textTheme์˜ bodyMedium์œผ๋กœ ํ†ต์ผ

});
ref
.read(navigationSelectedIndexProvider.notifier)
.state = 1;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์œ ์ €๊ฐ€ ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ์„ ํด๋ฆญ ์‹œ ํ† ํฐ์„ ์ œ๊ฑฐํ•˜๊ณ  navigationSelectedIndexProvider์˜ ์ƒํƒœ๋ฅผ 1(tuti ํƒญ index)๋กœ ๋ณ€๊ฒฝํ–ˆ์–ด์š”

-> mainNavigationScreen์˜ build ๋‚ด watch๋กœ ์ฒญ์ทจ์ค‘์ธ navigationSelectedIndexProvider๊ฐ€ ๋ณ€๊ฒฝ์„ ๊ฐ์ง€ํ•˜๊ณ  reBuildํ•˜์—ฌ ํŠธํ‹ฐ ํƒญ์œผ๋กœ ์ด๋™ํ•˜๊ฒŒ ์ˆ˜์ •ํ–ˆ์–ด์š”.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ํŠธํ‹ฐ ํ™ˆ ํ™”๋ฉด ๋ฉ”์ธ ๋ฐฐ๋„ˆ ์ถ”๊ฐ€ ๋ฐ ํด๋ฆญ ์‹œ ํผ์Šค๋„ ๋ธŒ๋žœ๋”ฉ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ•˜๋„๋ก ์„ค์ •

flexibleSpace: const FlexibleSpaceBar(
background: TuTiBanner(),
),
),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

95 ~ 100๋ฒˆ์งธ ์ฝ”๋“œ ์„ค๋ช…

์œ ์ €๊ฐ€ ์Šคํฌ๋กค ์‹œ ๋ฉ”์ธ ๋ฐฐ๋„ˆ๋ฅผ ์ˆจ๊ธฐ๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด CustomScrollView ์‚ฌ์šฉํ–ˆ์–ด์š”.

SliverAppBar์˜ pinned(์Šคํฌ๋กค ํ•ด๋„ ์ƒ๋‹จ์— ๊ณ ์ •), floating(์œ ์ €๊ฐ€ ์Šคํฌ๋กค์„ ์œ„๋กœ ์˜ฌ๋ฆด ์‹œ ๋ฐ”๋กœ ๋ฉ”์ธ ๋ฐฐ๋„ˆ๊ฐ€ ํŠ€์–ด๋‚˜์˜ด) ์„ false๋กœ ์„ค์ •ํ–ˆ์–ด์š”.

return MainNavigationScreen(tab: tab);
String tab = state.params['tab'] ?? 'tuti';
ref.read(tabsProvider.notifier).state = tab;
return const MainNavigationScreen();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. ์œ ์ €๊ฐ€ ์„ ํƒํ•œ tab๊ฐ’์„ ๋™์ ์œผ๋กœ ๋ณ€์ˆ˜ tab์— ํ• ๋‹น
  2. tabsProvider์˜ state์— ๋ณ€์ˆ˜ tab์ด ๊ฐ€์ง„ ๊ฐ’ ํ• ๋‹น

1,2๋กœ ์ธํ•ด MainNavigationScreen์—์„œ ์ธ์ž๋ฅผ ๋ฐ›์ง€ ์•Š์•„๋„ ๋˜๊ธฐ ๋•Œ๋ฌธ์— tab ํ”„๋กœํผํ‹ฐ ์ œ๊ฑฐ.

@changhwan77 changhwan77 merged commit 2868c77 into master Feb 17, 2024
1 check failed
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.

1 participant