묻고 답해요
130만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
df.corr(numeric_only=True)
df.corr(numeric_only=True) 실행하면 사진과 같이 나옵니다. 문제가 뭘까요?
-
미해결김영한의 실전 자바 - 중급 1편
concat함수와 +의 차이
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.복습을 하다 궁금한점이 생겼는데 위 코드에서 concat을 쓰고 반환값을 받지 않은거랑 밑에 +로 작성한 코드는 같은 코드가 아닌가요? 위코드는 반환값을 받지 않아도 되고 밑에 코드는 반환값을 받지않아서 컴파일 오류가 나는데 무슨 차이인지 궁금합니다.
-
해결됨[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
listbox 마지막 앞 단어를 구하는 문제
마지막 앞 단어를 구하는 문제에서# listbox[7:8]# listbox[7:-1]# listbox[-2:-1]답을 이렇게 세가지로 알려주셨는데listbox[7]이것도 답이 될 수 있나요??
-
미해결Do it! Node.js 프로그래밍 입문
로컬 호스트 접속이 안됩니다
마지막 강의 듣고있는데요 어제까지만 해도 잘되던 로컬호스트 접속이 안됩니다 서버는 기동이 잘되는데 이렇게 접속하면 접속이 안됩니다.. cm 에서 포트 떠있는것도 보이는데 왜그럴까요
-
해결됨나도 파이썬 백엔드 개발자!: FastAPI
엔드포인트와 HTTP메서드! _ 강좌에서 질문 있습니다
안녕하세요 강사님 아래와 같은 질문 있습니다터미널에서 uvicorn main:app 입력으로 실행 후 clinet.py 를 어떻게 실행하면 될까요? 그리고 강의에서 캡쳐해주신 예제코드좀 업로드 해주실 수 있으실까요? 화면에 재생버튼때문에 코드 아랫부분이 잘 보이지 않습니다....
-
미해결
Unlock Your Accounting Potential with AAT Courses at Future Connect Training
In the ever-evolving world of finance and accounting, staying ahead with a robust educational background and updated skills is crucial. Whether you’re looking to jumpstart your career in accounting or aiming to enhance your expertise, enrolling in an Association of Accounting Technicians (AAT) course at Future Connect Training could be the game-changer you need. This blog post delves into why Future Connect Training is the perfect place to undertake your AAT studies, providing you with both theoretical knowledge and practical experience.What is AAT?The Association of Accounting Technicians (AAT) offers one of the most widely recognized accounting qualifications globally. AAT courses are renowned for their practicality and relevance to the real-world financial work environment. They are designed to provide foundational to advanced knowledge, equipping students with the skills necessary to succeed in various accounting roles.Why Choose AAT Courses at Future Connect Training?Future Connect Training stands out as a leading provider of AAT courses, thanks to its comprehensive curriculum, experienced faculty, and a strong focus on practical skills. Here’s why enrolling at Future Connect can be your best career decision:1. Comprehensive Course OfferingsFuture Connect Training offers a range of AAT courses that cater to different levels of learners — from beginners who are new to accounting to seasoned professionals looking to upgrade their skills. The curriculum is structured to build knowledge progressively, ensuring that each student can move up through the levels at a pace that suits them best.2. Experienced and Supportive InstructorsThe faculty at Future Connect Training comprises seasoned professionals who bring not only expertise but also real-world experience into the classroom. This blend of theoretical knowledge with practical insights prepares students for the complexities of real-world financial tasks and decision-making.3. Practical Learning ExperienceUnlike traditional learning environments that focus heavily on theory, Future Connect emphasizes practical experience. Students engage in hands-on tasks that simulate actual accounting work — from managing accounts to financial reporting — using the latest accounting software. This practical exposure is invaluable, as it ensures graduates are job-ready.4. Flexible Learning OptionsRecognizing the diverse needs of its students, Future Connect Training offers flexible learning options and best accountancy courses. Whether you prefer online classes, evening sessions, or weekend classes, there is a schedule to fit your needs. This flexibility allows students to balance their studies with personal and professional commitments effectively.5. Career Opportunities and Placement SupportCompleting an AAT course at Future Connect Training opens up numerous doors in the accounting field. The institution enjoys strong ties with various companies and accounting firms, facilitating internship and job opportunities for its graduates. Additionally, the career support services at Future Connect help students prepare for the job market with CV advice, interview preparation, and more.Real-World Success StoriesMany students of Future Connect Training have transitioned successfully into rewarding accounting careers. Take, for instance, Sarah, a former student who completed her AAT Level 2 and 3 courses at Future Connect. She is now a thriving junior accountant at a respected London financial firm. Sarah credits her career progression to the rigorous training and support she received during her studies.Looking Ahead: The Future of Accounting EducationThe demand for skilled accountants continues to grow, and with technological advancements shaping the industry, the role of accountants is becoming more dynamic and integral to business success. Future Connect Training stays ahead of these changes by continuously updating its courses and teaching methodologies to include the latest industry trends and technologies.ConclusionEnrolling in an AAT course at Future Connect Training offers more than just an education; it is a stepping stone to a thriving career in accounting. With expert instructors, practical training, and strong career support, Future Connect prepares you for immediate success in the accounting field. Whether you are starting out or looking to enhance your skills, Future Connect Training has the resources and expertise to help you achieve your professional goals.Embarking on your AAT journey at Future Connect Training not only equips you with valuable accounting skills but also connects you with a network of professionals and opportunities that can propel your career to new heights. If you're ready to take the next step in your accounting career, consider Future Connect Training — where your future in accounting begins today.
-
해결됨[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
원핫 인코딩 결과가 지속적으로 True False로 나옵니다.
안녕하십니까.작업형 2번 원핫 인코딩 부분을 수강하다가 궁금한 점이 생겨 질문 남깁니다.원핫 인코딩을 한 결과, 값이 0또는 1로 나오는 것이 아닌, True False로 결과값이 출력이 됩니다. 강의 3-6 Regression 파트에서cols = ['sex','smoker','region'] train = pd.get_dummies(train,columns = cols) test = pd.get_dummies(test, columns = cols) display(train.head(2)) display(test.head(2)) 위의 코드를 실행하면 범주형 변수들의 원핫 인코딩 결과가 False, True로 밖에 나오지 않습니다. 혹시 이렇게 두어도 머신러닝을 수행하는데 문제가 없는 것인지, 아니면 반드시 0과1로 바꾸는 작업이 필요한 지 궁금합니다.만약 0과 1로 무조건 바꿔야한다면, 코드에서 어떠한 실수를 했는지 의문이 들어 질문 남깁니다.감사합니다.
-
해결됨[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
문제 1번 질문입니다!
안녕하세요! 문제 1번 관련해서 질문이 있습니다. 3번째 질문에 <앞에서부터 70% 데이터를 구하는> 코드를df = df.head(int(len(df)*0.7))위와 같이 head 를 사용해서 풀었는데요. 슬라이싱으로 df = df[:int(len(df) * 0.7)] 하는 것이 더 정확하게 푸는 방법인 걸까요? 아니면 같은 개념이니 둘 다 사용해도 괜찮은 걸까요?
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
리다이렉트시...
1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]강의 내용 들으면서 예시 프로그램 만들어 봤습니다.MemberDTO 에는 회원 가입시 비밀번호 확인 하는 부분이 없습니다. 이때, 비밀번호랑 비밀번호 확인란이랑 같은 것이 입력되었는지 확인하고 싶어서 이렇게 ModelAttribute로 member랑 mbrPwdConfirm을 넘겨 받아서 member의 pwd와 mbrPwdConfirm의 값이 같은지 비교했습니다. 그후 로그인 화면으로 리다이렉트 했는데, 이때, 이렇게 위에 mbrPwdConfirm부분이 쿼리로 나타납니다. singIn 함수에서 mbrPwdConfirm 부분을 제거 하고, request.getParameter("mbrPwdConfirm")을 하면 되긴합니다. 왜 전자의 방식은 안되고 후자의 방식은 되는 지 궁금합니다. 또한, 리다이렉트시 이 부분을 없애고 싶은데, 그러면 modelAttribute 부분을 없애야 하는데... 그러면 signIn함수에서 값을 사용을 못합니다....
-
해결됨스프링 DB 1편 - 데이터 접근 핵심 원리
체크예외를 런타임예외로 변환하는 코드
[질문 내용]해당 영상에서 unCheckedAppTest 클래스 내에서 SQLException을 RuntimeException으로 변환하는 부분을 static class로 생성해서 사용하고 있습니다.<첫 번째 질문>이렇게 체크 예외를 런타임 예외로 바꿀 때 항상 static class로 생성해야 되는지 아니면 try { ~~ } catch(SQLException e) { throw RuntimeException(e); } 이렇게 사용해도 되는지 궁금합니다.<두 번째 질문>체크 예외를 런타임 예외로 바꾸는 부분을 static class로 생성할 때 무조건 해당 체크 예외가 발생하는 클래스에다 생성해야 하는지도 궁금합니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
value값이 null로 나오는 이유???
[질문 내용]여기에 질문 내용을 남겨주세요.value 값이 왜 null로 나오나요???????????
-
미해결[리뉴얼] React로 NodeBird SNS 만들기
해시태그 검색에서 throttle에 관해 질문있습니다.
해시태그 검색에서 throttle에 관해 질문있습니다.해시태그 검색을 하게 되면 throttle때문에 5초 이후에 검색이 되고 있습니다.스크롤할 때에는 유용하지만 하나를 클릭하고, 5초 이내에 클릭하게되면 url은 바뀌지만 게시글은 바뀌지 않고 ux에 좋지않아보입니다. const loadHashtagPostsThrottle = async (payload) => { const queryStr = setQuerystring(payload); const url = `/hashtag/${encodeURIComponent(payload.tag)}${queryStr ? "?" + queryStr : ""}`; const response = await axios.get(url); return response; }; export const loadHashtagPosts = createAsyncThunk("post/loadHashtagPosts", _.throttle(loadHashtagPostsThrottle, 5000)); 특저 유저의 게시글을 검색할때도 비슷한 현상이 나올거같은데 이럴땐 어떻게 하면 ux를 좋게 할 수 있을지 궁금합니다.
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
HandlerExceptionResolver 시작 질문있습니다.
잘못된 입력값이라고 나오는데 줄이 되게 길게 나옵니다.혹시 강의처럼 똑같이 나올려면 코드 어느부분을 추가해야하나요?전체코드입니다.:https://drive.google.com/file/d/1Bc9E7UaYn4H6j54XeFvdknSmHTWSgmvC/view?usp=drive_link
-
미해결스프링 DB 2편 - 데이터 접근 활용 기술
스프링 DB2 테스트 - 데이터 롤백 오류
findItems()에서 "itemA", "itemB"가 남아있다는 오류가 발생합니다. jdbc:h2:tcp://localhost/~/testcase 로 접속해서 select 해 보면 데이타가 없는데, =jdbc:h2:tcp://localhost/~/test 로 접속해서 select하면 "itemA", "itemB" 가 남아있습니다.(삭제하고 다시 실행해도....). TestDataInit을 실행하는거 같네요??@Bean @Profile("local") public TestDataInit testDataInit(ItemRepository itemRepository) { return new TestDataInit(itemRepository); }링크 :: https://drive.google.com/file/d/1HD2gxtYhL8B5fZ3KazZ148-4x66PPCuo/view?usp=sharing
-
해결됨김영한의 실전 자바 - 중급 1편
자바 String replace() 메서드 질문.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]안녕하세요.스트링 메서드() 들을 이용해서 문자를 바꿀 려고 하는데,어렵네요. 일단 바꾸기는 했는데 다른 방법으로 가능한지 알고 싶어서 여쭤봅니다.StringChangeMain1 에 있는 str의 글자를 이용해서두번째 'Java'를 'World'로 바꿀 려고 하는데..이런 코드 밖에 생각이 안나네요.혹 더 좋은 방법이 있을까요?답변 부탁 드립니다.
-
미해결
[ 한국관광공사 x 카카오 ] 관광데이터 활용 공모전 디자이너 1분 모십니다.
[ 디자이너 + 프론트엔드 모집 글 ]안녕하세요 관광공사 오픈API를 활용한 공모전을 시작하려고합니다 !주제 PoC, Mock Up, 개요 정도 작성되어있는 상태입니다.프론트엔드 한 분 디자이너 한 분을 모집합니다 !(개발 기간:5/21~10/1)공모전이라 보여지는 부분이 상당 비중을 차지할 것이라 생각되어 디자이너분이 피그마를 다룰 줄 아시는분이시면 좋겠습니다 !프론트엔드분은 프로젝트 경험이 있으신분이시면 좋을 것 같습니다. (리액트 or Next +TS)(현재인원: 프2+ 백2)궁금한 점이나 관심 있으신 분은 오픈 카카오톡으로 연락 부탁드립니다 ! https://open.kakao.com/o/sCNSYfqg
-
미해결스프링 DB 2편 - 데이터 접근 활용 기술
스프링DB 2 :: 테스트 - 데이터 베이스 연동 오류 (원하는 답변이 아닙니다)
Lombok의 @Data 가 @Getter, @Setter, @RequiredArgsConstructor, @ToString, @EqualsAndHashCode 를 만들어주는 애노테이션이라는 건 잘 압니다.제 질문은 왜 스프링DB 2 :: 테스트 - 데이터 베이스 연동 테스트의 save에서 오류가 발생 했었는데, @Getter, @Setter를 @Data 로 바꾼 행위만으로 오류가 발생하지 않게 된 이유를 알려달라는 겁니다. @Getter, @Setter 만 설정하는게 잘 못 된거라면 그 이유가 뭐냐는 걸 문의한겁니다. https://www.inflearn.com/questions/1258907/%EC%8A%A4%ED%94%84%EB%A7%81db-2-%ED%85%8C%EC%8A%A4%ED%8A%B8-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EB%B2%A0%EC%9D%B4%EC%8A%A4-%EC%97%B0%EB%8F%99-%EC%98%A4%EB%A5%98
-
미해결
Can You Get Better Essays with MyEssayWriter.ai?
Writing is at the heart of our academic journey, which allows us to show understanding, analysis and creativity on a range of topics. However, crafting a stellar essay isn't always a walk in the park. It involves a series of complex steps from brainstorming ideas to finishing the final draft. But don't worry, we'll introduce you to a game changer in this blog: MyEssayWriter.ai. Let's take a look at how this novel tool can change the experience of writing an essay. Understanding MyEssayWriter.aiMyEssayWriter.ai is not simply a writing tool you use to write, it's an advanced platform for empowering students in their educational endeavors. This AI-powered assistant is here to help you, whether you're struggling to find the right words or you're looking for guidance on how to structure your essay. What's more, it is a free ai essay writer no sign up required, allowing students to access its benefits without the hassle of registration.Seamless Topic GenerationChoosing a good topic is often the initial obstacle to writing essays. With MyEssayWriter.ai, bid farewell to those moments of staring blankly at a blank page. With your interests and academic requirements in mind, the platform uses advanced algorithms to generate a wide variety of relevant topics. No writer's block again, only endless possibilities for exploring! Tailored Research AssistanceThe basis for any persuasive writing is research. It can be difficult, however, to filter through so many sources. This process is simplified by MyEssayWriter.ai, which provides a tailored research assistance. Choose a topic, and you'll be saving valuable time and effort by watching the platform search the web for credible sources.It simplifies the research process by providing tailored assistance in finding credible sources based on specified topics. Additionally, it offers an AI thesis generator that helps users create concise and effective thesis statements, streamlining the essay writing process from research to thesis development. Structured OutliningEver found yourself lost in the midst of a disorganized essay? That's why MyEssayWriter.AI is making sure it doesn't happen. You can create a coherent structure for your essay in an easy way using its intuitive outlining function. All you have to do is add your major ideas and support elements, and the platform will structure them according to logic. It's as if you have a writing coach on your side! Intelligent Writing SuggestionsYou might be afraid of staring at the blinking cursor, but MyEssayWriter.AI makes it easy to write. The platform provides real time feedback on your writing, giving insight into grammar, style and coherence with the help of its creative writing suggestions. Let's get rid of typos and awkward phrases, hello, polished prose!It also offers a paraphraser that helps reword sentences and paragraphs while maintaining the original meaning, in addition to providing accurate feedback on grammar, style of writing and coherence. This feature makes it easier for students to create polished prose by ensuring that the content is not plagiarized and enhancing the writing process.According to Reddit, MyEssayWriter.ai is celebrated for its innovative paraphrasing tool. It offers students a seamless solution for generating original content while preserving clarity and coherence. The Must-Try AI Essay Writer Tools According to RedditBy "bigtimedaily.com"Personalized Revision AssistanceThe magic occurs when we revise rough drafts, refining them into polished jewels. MyEssayWriter.ai provides you with personalised editing assistance, helping you to follow every step of the revision process. The platform provides you with the tools to raise your writing to the next level, from identifying weak arguments to enhancing clarity.Citation HelpIt offers a citation creator that simplifies the process of formatting citations in various styles like APA, MLA, or Chicago. This feature saves time and ensures accuracy, allowing students to focus on writing their essays confidently.Plagiarism DetectionIn the academic world, MyEssayWriter.ai takes a very serious approach to plagiarism detection and originality is of paramount importance. In order to ensure that the work you have created is not copied, the platform scans your article for any signs of plagiarism using its advanced algorithms. I assure you that your academic integrity will not be jeopardized.Time Management ToolsIn this day and age, time management is of critical importance. In order to help you keep on track, MyEssayWriter.ai is providing valuable time management tools. Within the user interface of this platform, you can set deadlines, create reminders and keep an eye on your progress. Procrastination becomes a thing of the past with MyEssayWriter.ai.................... MyEssayWriter.ai is not merely a writing tool, it's the game changer for students who want to be successful in academics. This innovative platform simplifies the writing process as never before, from the creation of ideas to the completion of the final draft. If you're going to try for greatness, why settle for mediocre articles? With MyEssayWriter.ai, you can make the future of essay writing your own today!
-
미해결
스프링부트 단위테스트 어떻게 작성해야하는지 감이 안잡혀요.. 코드 리뷰 부탁립니다.
안녕하세요. 단위테스트라는 것을 처음 작성해보는데 어떻게 작성해야할지 감이 안잡히네요 ㅠㅠ일단 꾸역꾸역 작성을 해봤는데 이렇게 하는 게 맞는지 의문입니다. 너무 구체적으로 작성한 것은 아닌 지 고칠 부분이 있다면 피드백 해주시면 정말 감사하겠습니다.아래 코드는 아이디, 이메일 중복 체크 및 레디스에 저장 된 인증번호를 체크한 후 회원가입을 구현한 코드입니다. @Service @Transactional @RequiredArgsConstructor public class MemberServiceImpl implements MemberService{ private final MemberRepository memberRepository; private final PasswordEncoder passwordEncoder; private final RedisService redisService; @Override public Member signUp(MemberRequest memberRequest) { // 회원가입 조건 검증 verifySignUpCondition(memberRequest); Member member = memberRequest.toEntity(); member.setPassword(passwordEncoder.encode(memberRequest.getPassword())); member.setRole(Role.MEMBER); member.setSns(Sns.NONE); memberRepository.save(member); // 회원가입 성공 시 레디스에서 관련 데이터 삭제 redisService.deleteKey(memberRequest.getEmail()); return member; } private void verifySignUpCondition(MemberRequest memberRequest) { checkLoginIdDuplicate(memberRequest.getLoginId()); checkEmailDuplicate(memberRequest.getEmail()); redisService.verifyAuthNum(memberRequest.getEmail(), memberRequest.getAuthNum()); } private void checkLoginIdDuplicate(String loginId) { Optional<Member> findMember = memberRepository.findByLoginId(loginId); if(findMember.isPresent()) { throw new BusinessException(ErrorCode.LOGIN_ID_DUPLICATE); } } private void checkEmailDuplicate(String email) { Optional<Member> findMember = memberRepository.findByEmail(email); if(findMember.isPresent()) { throw new BusinessException(ErrorCode.EMAIL_DUPLICATE); } } }아래는 단위 테스트 코드입니다.@ExtendWith(MockitoExtension.class) class MemberServiceImplTest { @Mock private MemberRepository memberRepository; @Mock private PasswordEncoder passwordEncoder; @Mock private RedisService redisService; @InjectMocks private MemberServiceImpl memberService; @BeforeEach void setUp() { reset(memberRepository, passwordEncoder, redisService); } @Test @DisplayName("회원 가입 성공") void signUp_Success() { // given MemberRequest memberRequest = createMemberRequest(); String encodedPassword = "encodedPassword"; given(memberRepository.findByLoginId(memberRequest.getLoginId())).willReturn(Optional.empty()); given(memberRepository.findByEmail(memberRequest.getEmail())).willReturn(Optional.empty()); given(passwordEncoder.encode(memberRequest.getPassword())).willReturn(encodedPassword); willDoNothing().given(redisService).verifyAuthNum(memberRequest.getEmail(), memberRequest.getAuthNum()); willDoNothing().given(redisService).deleteKey(memberRequest.getEmail()); // when Member member = memberService.signUp(memberRequest); // then assertNotNull(member); assertEquals(member.getLoginId(), memberRequest.getLoginId()); assertEquals(member.getEmail(), memberRequest.getEmail()); assertEquals(member.getNickname(), memberRequest.getNickname()); assertEquals(member.getPassword(), encodedPassword); assertEquals(member.getRole(), Role.MEMBER); assertEquals(member.getSns(), Sns.NONE); verify(memberRepository, times(1)).save(any(Member.class)); verify(memberRepository, times(1)).findByLoginId(any()); verify(memberRepository, times(1)).findByEmail(any()); verify(passwordEncoder, times(1)).encode(any()); verify(redisService, times(1)).verifyAuthNum(any(), any()); verify(redisService, times(1)).deleteKey(any()); } }
-
미해결[2024 최신] [코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
에러가 생기네요 - 미세먼지앱 섹션57-19 부터 입니다.
에러가 생기네요 - 미세먼지앱 섹션57-19 부터 인데에러가 생기네요 - 미세먼지앱 섹션57-19 부터 인데, 구판 섹션26-19 입니다.수시로 에러 생기고 가끔 수십번에 1번은 데이터가 들어오는데 그것도 조금 지나면 에러 메세지가 나오네요.첨부파일 참조아마 오타 일건데 암만 강의하구 비교해도 오타를 찾지를 못하겠습니다.포기하구 강의따라가도 20, 21 에서도 계속 에러 나와서 강의 포기하구 있다가 연락드립니다.코드는 첨부 합니다./// component/main_app_bar.dart /// import 'package:flutter/material.dart'; import 'package:section26_fine_dust/constant/color.dart'; import 'package:section26_fine_dust/model/stat_model.dart'; import 'package:section26_fine_dust/model/status_model.dart'; class MainAppBar extends StatelessWidget { final StatusModel status; final StatModel stat; MainAppBar({ required this.status, required this.stat, super.key, }); @override Widget build(BuildContext context) { final ts = TextStyle( color: Colors.white, fontSize: 30.0, ); return SliverAppBar( backgroundColor: status.primaryColor, expandedHeight: 500, flexibleSpace: FlexibleSpaceBar( background: SafeArea( child: Container( margin: EdgeInsets.only(top: kToolbarHeight), child: Column( children: [ Text( '서을', style: ts.copyWith( fontSize: 40.0, fontWeight: FontWeight.w700, ), ), // const SizedBox(height: 20.0), Text( getTimeFromDateTime(dateTime: stat.dataTime), style: ts.copyWith( fontSize: 20.0, ), ), const SizedBox(height: 20.0), Image.asset( status.imagePath, width: MediaQuery.of(context).size.width / 2, ), const SizedBox(height: 20.0), Text( status.label, style: ts.copyWith( fontSize: 40.0, fontWeight: FontWeight.w700, ), ), const SizedBox(height: 8.0), Text( status.comment, style: ts.copyWith( fontSize: 20.0, fontWeight: FontWeight.w700, ), ), ], ), ), ), ), ); } String getTimeFromDateTime({required DateTime dateTime}) { return '${dateTime.year} ${dateTime.month} ${dateTime.day} ${dateTime.hour} ${dateTime.minute}'; } String getTimeFormat(int number) { return number.toString().padLeft(2, '0'); } } /// screen/home_screen.dart /// import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:section26_fine_dust/component/card_title.dart'; import 'package:section26_fine_dust/component/category_card.dart'; import 'package:section26_fine_dust/component/hourly_card.dart'; import 'package:section26_fine_dust/component/main_app_bar.dart'; import 'package:section26_fine_dust/component/main_card.dart'; import 'package:section26_fine_dust/component/main_drawer.dart'; import 'package:section26_fine_dust/component/main_state.dart'; import 'package:section26_fine_dust/constant/color.dart'; import 'package:section26_fine_dust/constant/status_level.dart'; import 'package:section26_fine_dust/model/stat_model.dart'; import 'package:section26_fine_dust/repository/stat_repository.dart'; import '../constant/data.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { Future<List<StatModel>> fetchData() async { final statModels = await StatRepository.fetchData(); print(statModels); return statModels; } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: primaryColor, drawer: MainDrawer(), body: FutureBuilder<List<StatModel>>( future: fetchData(), builder: (context, snapshot) { if (snapshot.hasError) { // 에러가 있을때 return Center( child: Text('에러가 있습니다.'), ); } if (!snapshot.hasData) { // 로딩 상태 return Center( child: CircularProgressIndicator(), ); } List<StatModel> stats = snapshot.data!; StatModel recentStat = stats[0]; // 1 - 5, 6 - 10, 11 - 15 // 7 final status = statusLevel .where( (element) => element.minFineDust < recentStat.seoul, ) .last; return CustomScrollView( slivers: [ MainAppBar( stat: recentStat, status: status, ), SliverToBoxAdapter( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ CategoryCard(), const SizedBox(height: 16.0), HourlyCard(), ], ), ), ], ); }, ), ); } }