커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
에러 확인부탁드립니다
앱개발 종합반 - 플러터 v8
3주차
북마크
민*규
댓글
1
추천
0
조회수
13
조회수
13
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.





스파르타 즉문즉답스파르타 즉문즉답




작성한 코드 및 에러 메세지

import 'package:flutter/cupertino.dart';

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(

      debugShowCheckedModeBanner: false,

      home: HomePage(),

    );

  }

}


// 홈 페이지

class HomePage extends StatelessWidget {

  const HomePage({super.key});


  @override

  Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(

        title: Text("mymemo"),

      ),

      body: Center(child: Text("메모를 작성해주세요")),

      floatingActionButton: FloatingActionButton(

        child: Icon(Icons.add),

        onPressed: () {

          // + 버튼 클릭시 메모 생성 및 수정 페이지로 이동

          Navigator.push(

            context,

            MaterialPageRoute(builder: (_) => DetailPage()),

          );

        },

      ),

    );

  }

}


// 메모 생성 및 수정 페이지

class DetailPage extends StatelessWidget {

  DetailPage({super.key});


  TextEditingController contentController = TextEditingController();


  @override

  Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(

        actions: [

          IconButton(

            onPressed: () {

              // 삭제 버튼 클릭시

            },

            icon: Icon(Icons.delete),

          )

        ],

      ),

      body: Padding(

        padding: const EdgeInsets.all(16),

        child: TextField(

          controller: contentController,

          decoration: InputDecoration(

            hintText: "메모를 입력하세요",

            border: InputBorder.none,

          ),

          autofocus: true,

          maxLines: null,

          expands: true,

          keyboardType: TextInputType.multiline,

          onChanged: (value) {

            // 텍스트필드 안의 값이 변할 때

          },

        ),

      ),

   # This file configures the analyzer, which statically analyzes Dart code to

# check for errors, warnings, and lints.

#

# The issues identified by the analyzer are surfaced in the UI of Dart-enabled

# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be

# invoked from the command line by running `flutter analyze`.


# The following line activates a set of recommended lints for Flutter apps,

# packages, and plugins designed to encourage good coding practices.

include: package:flutter_lints/flutter.yaml


linter:

  # The lint rules applied to this project can be customized in the

  # section below to disable rules from the `package:flutter_lints/flutter.yaml`

  # included above or to enable additional rules. A list of all available lints

  # and their documentation is published at

  # https://dart-lang.github.io/linter/lints/index.html.

  #

  # Instead of disabling a lint rule for the entire project in the

  # section below, it can also be suppressed for a single line of code

  # or a specific dart file by using the `// ignore: name_of_lint` and

  # `// ignore_for_file: name_of_lint` syntax on the line or in the file

  # producing the lint.

  rules:

 

    prefer_const_constructors: false

    prefer_const_literals_to_create_immutables: false

    # avoid_print: false  # Uncomment to disable the `avoid_print` rule

    # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule


# Additional information about this file can be found at

# https://dart.dev/guides/language/analysis-options

);

  }

}




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴