본문 바로가기

Flutter12

당근 마켓 만들어 보기 https://github.com/insertvalue2/class_carrot_market.git GitHub - insertvalue2/class_carrot_marketContribute to insertvalue2/class_carrot_market development by creating an account on GitHub.github.com 폴더 및 파일 만들기pubspec.ymal 파일 설정 기본 코드 입력앱 테마 설정main.dart 파일 완성 dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcon.. 2024. 11. 14.
MVVM 패턴과 상태 관리 Monolithic (모노리스) 구조의 특징하나의 코드 파일에 UI, 비즈니스 로직, 프레젠테이션 로직을 모두 넣는 형식을 흔히 Monolithic Architecture또는 간단히 Monolith라고 부릅니다. 먼저 MVVM 패턴 없이 간단한 구조로 코드를 작성해보자. 모든 로직과 상태 관리를 하나의 파일에 통합하여, UI와 데이터 처리가 한 클래스에서 이루어지는 방식으로 코드를 작성할 수 있다. 이 방식은 MVVM과 같은 디자인 패턴이 없어도 간단한 앱에서는 빠르게 개발할 수 있는 장점이 있다.  TODOimport 'package:flutter/material.dart';void main() => runApp(TodoApp());class TodoApp extends StatelessWidget {.. 2024. 11. 13.
Dio 통신 연습 https://pub.dev/packages/dio/install dio install | Dart packageA powerful HTTP networking package, supports Interceptors, Aborting and canceling a request, Custom adapters, Transformers, etc.pub.devdependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 dio: ^5... 2024. 11. 13.
플러터 기본 다지기 - 5 BottomSheet 위젯화면 아래쪽에서 올라오는 다이얼로그showBottomSheet() 및 showModalBottomSheet()의 builder 속성에 지정한 위젯을 화면 아래쪽에서 올라오도록 보여줌showModalBottomSheet()는 사용자가 Bottom Sheet 외부를 터치하면 Bottom Sheet가 자동으로 닫히지만, showBottomSheet()는 사용자가 Bottom Sheet 외부를 터치해도 Bottom Sheet가 닫히지 않음다이얼로그를 닫기 위해서는 닫히게 하려면, Navigator.of(context).pop()을 호출하면 됨import 'package:flutter/material.dart'; void main() { runApp(BottomSheetApp()); .. 2024. 11. 12.
플러터 기본 다지기 -4 import 'package:flutter/material.dart';void main() { runApp(const MyApp());}class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('그리드뷰 위젯 연습'), ), body: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCoun.. 2024. 11. 12.
플러터 기본기 다지기 - 3 Form 위젯TextField는 단순히 하나의 텍스트 입력을 다루는데 반해서, Form은 그 자체로 입력 필드를 가지고 있지 않지만, FormField 위젯들을 그룹화하여 관리하며, 복잡한 유효성 검사와 보다 쉽게 할 수 있는 위젯다른 위젯과 달리 Form 위젯은 자체적인 화면을 제공하지는 않으며, 사용자가 입력한 데이터의 유효성 검증, 데이터 관리 관련 기능을 제공함Form 위젯 내에서 TextFormField 위젯을 사용하여 각 데이터 입력을 받는 것이 일반적임Form 위젯 작성 방법은 다음과 같음Form 위젯을 위한 GlobalKey를 만들어야 함. GlobalKey는 FormState 전체에 액세스하는 데 사용되며, 이 객체는 폼 데이터의 유효성을 검사하고 저장하는 데 사용됨final _formK.. 2024. 11. 11.