import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sccsa/controller/order/order\_details\_controller.dart';
import 'package:sccsa/controller/order/save\_controller.dart';
import 'package:sccsa/core/constants.dart';
import 'package:sccsa/view/page/order/comment\_page.dart';
import 'package:sccsa/view/widget/snackbar\_widget.dart';

class OrderDetailsPage extends StatefulWidget {
 final String orderId;

 const OrderDetailsPage({Key? key, required this.orderId}) : super(key: key);

 @override
 State createState() => \_OrderDetailsPageState();
}

class \_OrderDetailsPageState extends State {
 final OrderDetailsController \_orderDetailsController = OrderDetailsController();
 late bool isSaved = false;

 @override
 void initState() {
 super.initState();
 \_orderDetailsController.getOrderDetails(orderId: widget.orderId);
 }

 @override
 Widget build(BuildContext context) {
 return Scaffold(
 backgroundColor: AppColors.customBackGroundColor,
 appBar: AppBar(
 // title: const Text(
 // AppText.sccsa,
 // style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
 // ),
 backgroundColor: AppColors.customBackGroundColor,
 foregroundColor: Colors.black,
 elevation: 0,
 bottomOpacity: 0.0,
 leading: IconButton(
 icon: const Icon(Icons.arrow\_back\_ios),
 iconSize: 25.0,
 onPressed: () {
 Navigator.pop(context);
 },
 ),
 ),
 floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
 floatingActionButton: Obx(
 () {
 if (\_orderDetailsController.status == pageState.loaded) {
 isSaved = \_orderDetailsController.orderDetailsAction.saved;
 return Padding(
 padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 12),
 child: Row(
 crossAxisAlignment: CrossAxisAlignment.end,
 children: [
 FloatingActionButton.extended(
 heroTag: "makeanoffer",
 elevation: 0,
 onPressed: () {
 },
 backgroundColor: AppColors.customLightBlueish,
 label: const Text(
 AppText.makeAnOffer,
 style: TextStyle(
 fontWeight: FontWeight.w500,
 fontSize: 16,
 ),
 ),
 ),
 const Spacer(),
 Wrap(
 direction: Axis.vertical,
 crossAxisAlignment: WrapCrossAlignment.end,
 children: [
 Container(
 margin: EdgeInsets.all(10),
 child: FloatingActionButton(
 heroTag: "comments",
 elevation: 0,
 onPressed: () {
 Navigator.push(
 context,
 MaterialPageRoute(
 builder: (context) => CommentSection(orderId: widget.orderId),
 ),
 );
 },
 backgroundColor: AppColors.customLightBlueish,
 child: const Icon(
 Icons.comment,
 size: 38,
 color: AppColors.customBackGroundColor,
 ),
 ),
 ),
 Container(
 margin: EdgeInsets.all(10),
 child: !isSaved
 ? FloatingActionButton(
 heroTag: "saveorder",
 elevation: 0,
 onPressed: () => \_saveOrderAction(\_orderDetailsController.orderDetailsAction.id),
 backgroundColor: AppColors.customLightBlueish,
 child: const Icon(
 Icons.bookmark\_outline,
 size: 38,
 color: AppColors.customBackGroundColor,
 ),
 )
 : FloatingActionButton(
 heroTag: "unsaveorder",
 elevation: 0,
 onPressed: () => \_unsaveOrderAction(\_orderDetailsController.orderDetailsAction.id),
 backgroundColor: AppColors.customLightBlueish,
 child: const Icon(
 Icons.bookmark,
 size: 38,
 color: AppColors.customBackGroundColor,
 ),
 ),
 ),
 Container(
 margin: EdgeInsets.all(10),
 child: FloatingActionButton(
 heroTag: "moreorderoptions",
 elevation: 0,
 onPressed: () => \_saveOrderAction(\_orderDetailsController.orderDetailsAction.id),
 backgroundColor: AppColors.customLightBlueish,
 child: const Icon(
 Icons.more\_horiz\_outlined,
 size: 38,
 color: AppColors.customBackGroundColor,
 ),
 ),
 ),
 ],
 ),
 ],
 ),
 );
 } else {
 return Container(
 color: Colors.transparent,
 );
 }
 },
 ),
 body: SingleChildScrollView(
 child: Column(
 children: [
 ],
 ),
 ),
 );
 }

 void \_saveOrderAction(String orderId) {
 saveOrderController(
 orderId: orderId,
 error: (String error) {
 Navigator.of(context).pop();
 showSnackBarWidget(
 context: context,
 backgroundColor: Colors.red,
 text: error,
 );
 },
 action: () {
 setState(() {
 isSaved = true;
 });
 },
 );
 }

 void \_unsaveOrderAction(String orderId) {
 unsaveOrderController(
 orderId: orderId,
 error: (String error) {
 Navigator.of(context).pop();
 showSnackBarWidget(
 context: context,
 backgroundColor: Colors.red,
 text: error,
 );
 },
 action: () {
 setState(() {
 isSaved = false;
 });
 },
 );
 }
}

isSaved is not getting updated
'package:flutter/material.dart'를 가져옵니다;import 'package:get/get.dart';import 'package:sccsa/controller/order/order\_details\_controller.dart';import 'package:sccsa/controller/order/save\_controller.dart';'package:sccsa/core/constants.dart' 가져오기;'package:sccsa/view/page/order/comment\_page.dart' import;'package:sccsa/view/widget/snackbar\_widget.dart' import;OrderDetailsPage 클래스 StatefulWidget 확장 { 최종 String orderId; const OrderDetailsPage({키? 키, 필수 this.orderId}) : super(키: 키); @override State createState() => \_OrderDetailsPageState();}클래스 \_OrderDetailsPageState extends State { 최종 주문 상세 페이지 컨트롤러 \_orderDetailsController = 주문 상세 페이지 컨트롤러(); 후기 부울 isSaved = false; @override void initState() { super.initState(); \_orderDetailsController.getOrderDetails(orderId: widget.orderId); } @override 위젯 빌드(빌드 컨텍스트 컨텍스트) { return Scaffold( backgroundColor: AppColors.customBackGroundColor, appBar: AppBar( // title: const Text( // AppText.sccsa, // style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), // ), backgroundColor: AppColors.customBackGroundColor, foregroundColor: Colors.black, elevation: 0, bottomOpacity: 0.0, leading: IconButton( icon: const Icon(Icons.arrow\_back\_ios), iconSize: 25.0, onPressed: () { Navigator.pop(context); }, ), ), 플로팅 액션 버튼 위치: FloatingActionButtonLocation.centerDocked, floatingActionButton: Obx( () { if (\_orderDetailsController.status == pageState.loaded) { isSaved = \_orderDetailsController.orderDetailsAction.saved; 반환 패딩( padding: const EdgeInsets.symmetric(가로: 10, 세로: 12), child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ FloatingActionButton.extended( heroTag: "makeanoffer", elevation: 0, onPressed: () { }, backgroundColor: AppColors.customLightBlueish, label: const Text( AppText.makeAnOffer, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 16, ), ), ), const Spacer(), Wrap( 방향: Axis.vertical, crossAxisAlignment: WrapCrossAlignment.end, children: [ Container( margin: EdgeInsets.all(10), child: FloatingActionButton( heroTag: "comments", elevation: 0, onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => CommentSection(orderId: widget.orderId), ), ); }, backgroundColor: AppColors.customLightBlueish, child: const Icon( Icons.comment, size: 38, 색상: AppColors.customBackGroundColor, ), ), ), Container( margin: EdgeInsets.all(10), child: !isSaved ? FloatingActionButton( heroTag: "saveorder", elevation: 0, onPressed: () => \_saveOrderAction(\_orderDetailsController.orderDetailsAction.id), backgroundColor: AppColors.customLightBlueish, child: const Icon( Icons.bookmark\_outline, size: 38, 색상: AppColors.customBackGroundColor, ), ) : 플로팅 액션 버튼( heroTag: "unsaveorder", elevation: 0, onPressed: () => \_unsaveOrderAction(\_orderDetailsController.orderDetailsAction.id), backgroundColor: AppColors.customLightBlueish, child: const Icon( Icons.bookmark, size: 38, 색상: AppColors.customBackGroundColor, ), ), ), Container( margin: EdgeInsets.all(10), child: FloatingActionButton( heroTag: "moreorder옵션", elevation: 0, onPressed: () => \_saveOrderAction(\_orderDetailsController.orderDetailsAction.id), backgroundColor: AppColors.customLightBlueish, child: const Icon( Icons.more\_horiz\_outlined, size: 38, 색상: AppColors.customBackGroundColor, ), ), ), ], ), ], ), ); } else { 반환 컨테이너( 색상: Colors.투명, ); } }, ), body: SingleChildScrollView( child: Column( children: [ ], ), ), ); } void \_saveOrderAction(String orderId) { saveOrderController( orderId: orderId, error: (String error) { Navigator.of(context).pop(); showSnackBarWidget( context: context, backgroundColor: Colors.red, text: error, ); }, action: () { setState(() { isSaved = true; }); }, ); } void \_unsaveOrderAction(String orderId) { unsaveOrderController( orderId: orderId, error: (String error) { Navigator.of(context).pop(); showSnackBarWidget( context: context, backgroundColor: Colors.red, text: error, ); }, action: () { setState(() { isSaved = false; }); }, ); }}isSaved가 업데이트되지 않습니다.