File tree Expand file tree Collapse file tree 3 files changed +37
-23
lines changed
Expand file tree Collapse file tree 3 files changed +37
-23
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ class AlarmControlController extends GetxController {
4848 late double initialVolume;
4949 late Timer guardianTimer;
5050 RxInt guardianCoundown = 120. obs;
51+ RxBool isPreviewMode = false .obs;
5152
5253
5354
@@ -173,7 +174,16 @@ class AlarmControlController extends GetxController {
173174 super .onInit ();
174175 startListeningToFlip ();
175176
176- currentlyRingingAlarm.value = Get .arguments;
177+ // Extract alarm and preview flag from arguments
178+ final args = Get .arguments;
179+ if (args is Map ) {
180+ currentlyRingingAlarm.value = args['alarm' ];
181+ isPreviewMode.value = args['preview' ] ?? false ;
182+ } else {
183+ currentlyRingingAlarm.value = args;
184+ isPreviewMode.value = false ;
185+ }
186+
177187 print ('hwyooo ${currentlyRingingAlarm .value .isGuardian }' );
178188 IsarDb ()
179189 .insertLog ('Alarm ringing ${currentlyRingingAlarm .value .alarmTime }' );
Original file line number Diff line number Diff line change @@ -224,29 +224,31 @@ class AlarmControlView extends GetView<AlarmControlController> {
224224 ),
225225 ),
226226 ),
227- Positioned (
228- bottom: 0 ,
229- left: 0 ,
230- right: 0 ,
231- child: Container (
232- width: double .infinity,
233- height: 60 ,
234- color: Colors .red,
235- child: TextButton (
236- onPressed: () {
237- Utils .hapticFeedback ();
238- Get .offNamed ('/bottom-navigation-bar' );
239- },
240- child: Text (
241- 'Exit Preview' .tr,
242- style: Theme .of (context).textTheme.bodyLarge! .copyWith (
243- color: Colors .white,
244- fontWeight: FontWeight .bold,
245- ),
227+ // Exit Preview button - only show in preview mode
228+ if (controller.isPreviewMode.value)
229+ Positioned (
230+ bottom: 0 ,
231+ left: 0 ,
232+ right: 0 ,
233+ child: Container (
234+ width: double .infinity,
235+ height: 60 ,
236+ color: Colors .red,
237+ child: TextButton (
238+ onPressed: () {
239+ Utils .hapticFeedback ();
240+ Get .offNamed ('/bottom-navigation-bar' );
241+ },
242+ child: Text (
243+ 'Exit Preview' .tr,
244+ style: Theme .of (context).textTheme.bodyLarge! .copyWith (
245+ color: Colors .white,
246+ fontWeight: FontWeight .bold,
247+ ),
248+ ),
246249 ),
247250 ),
248251 ),
249- ),
250252 ],
251253 ),
252254 ),
Original file line number Diff line number Diff line change @@ -973,8 +973,10 @@ class HomeView extends GetView<HomeController> {
973973 onSelected: (value) async {
974974 Utils .hapticFeedback ();
975975 if (value == 0 ) {
976- Get .back ();
977- Get .offNamed ('/alarm-ring' , arguments: alarm);
976+ Get .toNamed ('/alarm-ring' , arguments: {
977+ 'alarm' : alarm,
978+ 'preview' : true
979+ });
978980 } else if (value == 1 ) {
979981 debugPrint (alarm.isSharedAlarmEnabled.toString ());
980982
You can’t perform that action at this time.
0 commit comments