check this code in flutter 
import 'package:flutter/material.dart';
import 'package:shared\_preferences/shared\_preferences.dart';

import 'check\_survey.dart';

class SurveyPage extends StatefulWidget {
 const SurveyPage({Key? key}) : super(key: key);

 @override
 \_SurveyPageState createState() => \_SurveyPageState();
}

class \_SurveyPageState extends State {
 int? \_surveyReminder;
 int? \_overallExperienceRating;
 int? \_foodQualityRating;
 int? \_deliveryTimeRating;
 int? \_orderAccuracyRating;
 int? \_appExperienceRating;
 int? \_likelihoodToRecommendRating;
 String \_additionalComments = "";

 final List \_surveyQuestions = [
 "Overall Experience",
 "Food Quality",
 "Delivery Time",
 "Order Accuracy",
 "App Experience",
 "Likelihood to Recommend",
 "Additional Comments (Optional)",
 ];

 final List \_ratingIcons = [
 Icons.sentiment\_very\_dissatisfied,
 Icons.sentiment\_dissatisfied,
 Icons.sentiment\_neutral,
 Icons.sentiment\_satisfied,
 Icons.sentiment\_very\_satisfied,
 ];

 @override
 void initState() {
 super.initState();
 checkSurveyReminder();
 }

 void checkSurveyReminder() async {
 SharedPreferences prefs = await SharedPreferences.getInstance();
 int? reminderTime = prefs.getInt("survey\_reminder");
 if (reminderTime != null) {
 DateTime reminderDate = DateTime.fromMillisecondsSinceEpoch(reminderTime);
 DateTime now = DateTime.now();
 if (now.difference(reminderDate) < Duration(days: 1)) {
 setState(() {
 \_surveyReminder = reminderTime;
 });
 } else {
 prefs.remove("survey\_reminder");
 }
 } else {
 /\* showDialog(
 context: context,
 builder: (BuildContext context) {
 return SurveyPopup();
 },
 ); \*/
 }
 }

 void setSurveyReminder() async {
 SharedPreferences prefs = await SharedPreferences.getInstance();
 prefs.setInt("survey\_reminder", DateTime.now().millisecondsSinceEpoch);
 Navigator.pop(context);
 }

 void submitSurvey() {
 // TODO: Submit the survey data to the server
 Navigator.pop(context);
 }

 @override
 Widget build(BuildContext context) {
 return WillPopScope(
 onWillPop: () async {
 if (\_surveyReminder != null) {
 setSurveyReminder();
 }
 return true;
 },
 child: Scaffold(
 appBar: AppBar(
 title: Text("Survey"),
 ),
 body: Padding(
 padding: const EdgeInsets.all(16.0),
 child: Column(
 crossAxisAlignment: CrossAxisAlignment.start,
 children: [
 Text(
 "Please rate your experience",
 style: TextStyle(fontSize: 20),
 ),
 SizedBox(height: 16),
 ...\_surveyQuestions.map((question) {
 /\* switch (question) {
 case "Overall Experience":
 rating = \_overallExperienceRating;
 break;
 case "Food Quality":
 rating = \_foodQualityRating;
 break;
 case "Delivery Time":
 rating = \_deliveryTimeRating;
 break;
 case "Order Accuracy":
 rating = \_orderAccuracyRating;
 break;
 case "App Experience":
 rating = \_appExperienceRating;
 break;
 case "Likelihood to Recommend":
 rating = \_likelihoodToRecommendRating;
 break;
 case "Additional Comments (Optional)": \*/

 int? rating;

 rating = question == 'Overall Experience'
 ? \_overallExperienceRating
 : \_foodQualityRating;
 Text(
 "",
 style: TextStyle(color: Colors.black),
 );

 List ratingIcons = List.generate(
 \_ratingIcons.length,
 (index) => Icon(
 \_ratingIcons[index],
 color: rating == index ? Colors.yellow[700] : Colors.grey,
 size: 40,
 ),
 );

 /\* switch (question) {
 case "Overall Experience":
 rating = \_overallExperienceRating;
 break;
 case "Food Quality":
 rating = \_foodQualityRating;
 break;
 case "Delivery Time":
 rating = \_deliveryTimeRating;
 break;
 case "Order Accuracy":
 rating = \_orderAccuracyRating;
 break;
 case "App Experience":
 rating = \_appExperienceRating;
 break;
 case "Likelihood to Recommend":
 rating = \_likelihoodToRecommendRating;
 break;
 case "Additional Comments (Optional)": \*/
 /\* return Column(
 crossAxisAlignment: CrossAxisAlignment.start,
 children: [
 Text(question, style: TextStyle(fontSize: 18)),
 SizedBox(height: 8),
 TextField(
 onChanged: (value) {
 \_additionalComments = value;
 },
 decoration: InputDecoration(
 border: OutlineInputBorder(),
 hintText: "Enter your comments here",
 ),
 maxLines: null,
 ),
 SizedBox(height: 16),
 ],
 );
 default: \*/
 return Column(
 crossAxisAlignment: CrossAxisAlignment.start,
 children: [
 Text(question, style: TextStyle(fontSize: 18)),
 SizedBox(height: 8),
 Row(
 mainAxisAlignment: MainAxisAlignment.spaceBetween,
 children: [
 ...ratingIcons,
 ],
 ),
 SizedBox(height: 16),
 ],
 );
 // }
 }).toList(),
 Row(
 mainAxisAlignment: MainAxisAlignment.spaceAround,
 children: [
 ElevatedButton(
 onPressed: () {
 if (\_surveyReminder != null) {
 setSurveyReminder();
 }
 Navigator.pop(context);
 },
 child: Text("Exit"),
 ),
 ElevatedButton(
 onPressed: () {
 if (\_overallExperienceRating == null ||
 \_foodQualityRating == null ||
 \_deliveryTimeRating == null ||
 \_orderAccuracyRating == null ||
 \_appExperienceRating == null ||
 \_likelihoodToRecommendRating == null) {
 showDialog(
 context: context,
 builder: (context) {
 return AlertDialog(
 title: Text("Survey Incomplete"),
 content:
 Text("Please complete all survey questions."),
 actions: [
 ElevatedButton(
 onPressed: () {
 Navigator.pop(context);
 },
 child: Text("OK"),
 ),
 ],
 );
 },
 );
 return;
 }
 submitSurvey();
 },
 child: Text("Submit"),
 ),
 ],
 ),
 ],
 ),
 ),
 ),
 );
 }
}
플루터에서 이 코드를 확인하세요. 'package:flutter/material.dart'를 가져옵니다;import 'package:shared\_preferences/shared\_preferences.dart';'check\_survey.dart'를 가져옵니다;클래스 SurveyPage extends StatefulWidget { const SurveyPage({키? 키}) : super(키: 키); @override \_SurveyPageState createState() => \_SurveyPageState();}State를 확장하는 \_SurveyPageState 클래스 { int? \설문 리마인더 int? \_overallExperienceRating; int? \_foodQualityRating; int? \_deliveryTimeRating; int? \_주문정확도Rating; int? \_appExperienceRating; int? \_likelihoodToRecommendRating; String \_additionalComments = ""; 최종 List \_surveyQuestions = [ "전반적인 경험", "음식 품질", "배달 시간", "주문 정확도", "앱 경험", "추천 가능성", "추가 코멘트(선택 사항)", ]; 최종 List \_ratingIcons = [ Icons.sentiment\_very\_dissatisfied, Icons.sentiment\_dissatisfied, Icons.sentiment\_neutral, Icons.sentiment\_satisfied, Icons.sentiment\_very\_satisfied, ]; 오버라이드 void initState() { super.initState(); checkSurveyReminder(); } void checkSurveyReminder() async { 공유 환경 설정 prefs = await SharedPreferences.getInstance(); int? reminderTime = prefs.getInt("survey\_reminder"); if (reminderTime != null) { DateTime reminderDate = DateTime.fromMillisecondsSinceEpoch(reminderTime); DateTime now = DateTime.now(); if (now.difference(reminderDate) < Duration(days: 1)) { setState(() { \설문조사 알림 = 알림 시간; }); } else { prefs.remove("survey\_reminder"); } } else { /\* showDialog( 컨텍스트: 컨텍스트, 빌더: (빌드컨텍스트 컨텍스트) { 반환 SurveyPopup(); }, ); \*/ } } void setSurveyReminder() async { SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setInt("survey\_reminder", DateTime.now().millisecondsSinceEpoch); 내비게이터.팝(컨텍스트); } void submitSurvey() { // 할 일: 설문조사 데이터를 서버에 제출합니다. Navigator.pop(context); } @override 위젯 빌드(빌드컨텍스트 컨텍스트) { return WillPopScope( onWillPop: () async { if (\_surveyReminder != null) { setSurveyReminder(); } return true; }, child: Scaffold( appBar: AppBar( title: Text("설문조사"), ), body: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "귀하의 경험을 평가해주세요", style: TextStyle(fontSize: 20), ), SizedBox(높이: 16), ...\_surveyQuestions.map((question) { /\* switch (question) { case "전반적인 경험": rating = \_overallExperienceRating; break; case "음식 품질": rating = \_foodQualityRating; break; case "배달 시간": rating = \_deliveryTimeRating; break; 케이스 "주문 정확도": rating = \_orderAccuracyRating; break; 케이스 "앱 경험": rating = \_appExperienceRating; break; 케이스 "추천 가능성": rating = \_likelihoodToRecommendRating; break; case "추가 코멘트 (선택 사항)": \*/ int? rating; rating = 질문 == '전반적인 경험' ? \_overallExperienceRating : \_foodQualityRating; 텍스트( "", 스타일: TextStyle(색상: Colors.black), ); 등급 아이콘 목록 = List.generate( \_ratingIcons.length, (index) => Icon( \_ratingIcons[index], color: rating == index ? Colors.yellow[700] : Colors.grey, size: 40, ), ); /\* 스위치 (질문) { case "전반적인 경험": rating = \_overallExperienceRating; break; case "음식 품질": rating = \_foodQualityRating; break; case "배달 시간": rating = \_deliveryTimeRating; break; 케이스 "주문 정확도": rating = \_orderAccuracyRating; break; 케이스 "앱 경험": rating = \_appExperienceRating; break; 케이스 "추천 가능성": rating = \_likelihoodToRecommendRating; break; case "추가 코멘트 (선택 사항)": \*/ /\* return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(question, style: TextStyle(fontSize: 18)), SizedBox(높이: 8), TextField( onChanged: (value) { \_additionalComments = value; }, 장식: InputDecoration( border: OutlineInputBorder(), hintText: "여기에 의견을 입력하세요", ), maxLines: null, ), SizedBox(높이: 16), ], ); 기본값입니다: \*/ 반환 Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(question, style: TextStyle(fontSize: 18)), SizedBox(높이: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ ...ratingIcons, ], ), SizedBox(높이: 16), ], ); // } }).toList(), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ElevatedButton( onPressed: () { if (\_surveyReminder != null) { setSurveyReminder(); } Navigator.pop(context); }, child: Text("Exit"), ), ElevatedButton( onPressed: () { if (\_overallExperienceRating == null || \_foodQualityRating == null || \_deliveryTimeRating == null || \_orderAccuracyRating == null || \_appExperienceRating == null || \_likelihoodToRecommendRating == null) { showDialog( 컨텍스트: 컨텍스트, 빌더: (컨텍스트) { 반환 AlertDialog( title: T