커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
3-9. 알람등록 기능 개발 강의 따라하던 도중 오류가 발생됩니다
[왕초보] 플러터(Flutter)로 시작하는 앱개발 종합반
3주차
북마크
이*경
댓글
8
추천
0
조회수
21
조회수
21
답변 완료

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

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


알람 추가 페이지 컨트롤러 연결 진행 하는 도중 코드스니펫 복사해서 넣고 AlarmController에 전구 모양 클릭해서 import 해줘도 오류가 계속 뜹니다.

화면 캡쳐 본 보시면 선생님이랑 저랑 달라요.

몇번 따라해도 해결이 안됩니다. 도와주세요



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




import 'package:alarm_app_sample/alarm_controller.dart';

import 'package:flutter/material.dart';

import 'package:flutter/services.dart';

import 'package:get/get.dart';


class AlarmWritePage extends StatelessWidget {

 const AlarmWritePage({super.key});


 @override

 Widget build(BuildContext context) {

  return Scaffold(

   appBar: AppBar(

    leading: GestureDetector(

     onTap: Get.back,

     behavior: HitTestBehavior.translucent,

     child: Center(

      child: Text(

       '취소',

       style: TextStyle(color: Color(0xffff9f0a), fontSize: 20),

      ),

     ),

    ),

    backgroundColor: Colors.transparent,

    title: Text('알람 추가', style: TextStyle(color: Colors.white)),

    actions: [

     GestureDetector(

      onTap: () {},

      child: Padding(

       padding: const EdgeInsets.only(right: 15),

       child: Text(

        '저장',

        style: TextStyle(color: Color(0xffff9f0a), fontSize: 20),

       ),

      ),

     ),

    ],

   ),

   GetBuilder<AlarmController>(

    builder: (controller) {

     return Text(

      controller.hour < 12 ? '오전' : '오후',

      style: TextStyle(

       fontWeight: FontWeight.w100,

       fontSize: 28,

       color: Color(0xffababac),

      ),

     );

    },

   ),

  );

 }

}


class RangeTextInputFormatter extends TextInputFormatter {

 final int min;

 final int max;


 RangeTextInputFormatter(this.min, this.max);


 @override

 TextEditingValue formatEditUpdate(

  TextEditingValue oldValue,

  TextEditingValue newValue,

 ) {

  if (newValue.text.isEmpty) {

   return newValue;

  }


  final int? value = int.tryParse(newValue.text);

  if (value == null || value < min || value > max) {

   return oldValue;

  }

  return newValue;

 }

}




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