@@ -2,7 +2,6 @@ import 'package:borneo_app/devices/borneo/lyfi/view_models/constants.dart';
22import 'package:borneo_app/devices/borneo/lyfi/views/easy_setup_screen.dart' ;
33import 'package:borneo_app/core/infrastructure/duration.dart' ;
44import 'package:borneo_app/core/infrastructure/time_of_day.dart' ;
5- import 'package:borneo_app/shared/widgets/screen_top_rounded_container.dart' ;
65import 'package:borneo_common/duration_ext.dart' ;
76import 'package:fl_chart/fl_chart.dart' ;
87import 'package:flutter/material.dart' ;
@@ -85,14 +84,13 @@ class ScheduleEditorView extends StatelessWidget {
8584 value: viewModel,
8685 builder: (context, child) {
8786 return Column (
88- spacing: 16 ,
8987 children: [
9088 // The chart
91- Container (
92- color : Theme . of (context).scaffoldBackgroundColor ,
93- padding : EdgeInsets . fromLTRB ( 8 , 24 , 8 , 0 ),
94- child : AspectRatio (
95- aspectRatio : 2.75 ,
89+ SizedBox (
90+ height : 150 ,
91+ child : Container (
92+ color : Theme . of (context).scaffoldBackgroundColor,
93+ padding : EdgeInsets . fromLTRB ( 8 , 24 , 8 , 0 ) ,
9694 child: Consumer <ScheduleEditorViewModel >(
9795 builder: (context, vm, child) {
9896 const minSpanSeconds = 3 * 3600.0 ;
@@ -140,6 +138,7 @@ class ScheduleEditorView extends StatelessWidget {
140138 ),
141139 ),
142140
141+ const SizedBox (height: 16 ),
143142 // Controls
144143 Expanded (
145144 child: Selector <ScheduleEditorViewModel , bool >(
@@ -156,87 +155,99 @@ class ScheduleEditorView extends StatelessWidget {
156155
157156 // Bottom buttons
158157 Consumer <ScheduleEditorViewModel >(
159- builder: (context, vm, child) => ScreenTopRoundedContainer (
160- color: Theme .of (context).colorScheme.surfaceContainer,
161- padding: const EdgeInsets .fromLTRB (8 , 24 , 8 , 8 ),
162- child: Row (
163- mainAxisAlignment: MainAxisAlignment .spaceEvenly,
164- children: [
165- // Easy Setup
166- _BottomActionButton (
167- icon: Icons .auto_fix_high_outlined,
168- label: context.translate ('Easy' ),
169- color: Theme .of (context).colorScheme.primary,
170- onPressed: () async {
171- await vm.easySetupEnter ();
172- if (context.mounted) {
173- final route = MaterialPageRoute (builder: (context) => EasySetupScreen (vm));
174- final applied = await Navigator .push (context, route);
175- if (applied == true ) {
176- await vm.easySetupFinish ();
177- // stay on the Dimming screen (do not pop the parent route)
178- }
179- }
180- },
181- ),
182- // Add
183- _BottomActionButton (
184- icon: Icons .add_outlined,
185- label: context.translate ('Add' ),
186- color: vm.canAddInstant ? Theme .of (context).colorScheme.primary : Theme .of (context).disabledColor,
187- onPressed: vm.canAddInstant
188- ? () async {
189- final initialTime =
190- (vm.currentEntry? .instant ?? Duration (hours: 6 , minutes: 30 )) +
191- ScheduleEditorViewModel .defaultInstantSpan;
192- final safeInitialTime = Duration (
193- hours: initialTime.inHours % 24 ,
194- minutes: initialTime.inMinutes % 60 ,
195- );
196- final selectedTime = await showNewInstantDialog (context, safeInitialTime.toTimeOfDay ());
197- if (selectedTime != null ) {
198- vm.addInstant (selectedTime);
158+ builder: (context, vm, child) => SafeArea (
159+ top: false ,
160+ child: Card (
161+ margin: EdgeInsets .fromLTRB (16 , 0 , 16 , 0 ),
162+ elevation: 1 ,
163+ color: Theme .of (context).colorScheme.surfaceContainer,
164+ child: Padding (
165+ padding: EdgeInsetsGeometry .fromLTRB (8 , 16 , 8 , 16 ),
166+ child: Row (
167+ mainAxisAlignment: MainAxisAlignment .spaceEvenly,
168+ children: [
169+ // Easy Setup
170+ _BottomActionButton (
171+ icon: Icons .auto_fix_high_outlined,
172+ label: context.translate ('Easy' ),
173+ color: Theme .of (context).colorScheme.primary,
174+ onPressed: () async {
175+ await vm.easySetupEnter ();
176+ if (context.mounted) {
177+ final route = MaterialPageRoute (builder: (context) => EasySetupScreen (vm));
178+ final applied = await Navigator .push (context, route);
179+ if (applied == true ) {
180+ await vm.easySetupFinish ();
181+ // stay on the Dimming screen (do not pop the parent route)
199182 }
200183 }
201- : null ,
202- ),
203- // Remove
204- _BottomActionButton (
205- icon: Icons .remove,
206- label: context.translate ('Remove' ),
207- color: vm.canRemoveCurrentInstant
208- ? Theme .of (context).colorScheme.secondary
209- : Theme .of (context).disabledColor,
210- onPressed: vm.canRemoveCurrentInstant ? vm.removeCurrentInstant : null ,
184+ },
185+ ),
186+ // Add
187+ _BottomActionButton (
188+ icon: Icons .add_outlined,
189+ label: context.translate ('Add' ),
190+ color: vm.canAddInstant
191+ ? Theme .of (context).colorScheme.primary
192+ : Theme .of (context).disabledColor,
193+ onPressed: vm.canAddInstant
194+ ? () async {
195+ final initialTime =
196+ (vm.currentEntry? .instant ?? Duration (hours: 6 , minutes: 30 )) +
197+ ScheduleEditorViewModel .defaultInstantSpan;
198+ final safeInitialTime = Duration (
199+ hours: initialTime.inHours % 24 ,
200+ minutes: initialTime.inMinutes % 60 ,
201+ );
202+ final selectedTime = await showNewInstantDialog (
203+ context,
204+ safeInitialTime.toTimeOfDay (),
205+ );
206+ if (selectedTime != null ) {
207+ vm.addInstant (selectedTime);
208+ }
209+ }
210+ : null ,
211+ ),
212+ // Remove
213+ _BottomActionButton (
214+ icon: Icons .remove,
215+ label: context.translate ('Remove' ),
216+ color: vm.canRemoveCurrentInstant
217+ ? Theme .of (context).colorScheme.secondary
218+ : Theme .of (context).disabledColor,
219+ onPressed: vm.canRemoveCurrentInstant ? vm.removeCurrentInstant : null ,
220+ ),
221+ // Clear
222+ _BottomActionButton (
223+ icon: Icons .clear,
224+ label: context.translate ('Clear' ),
225+ color: vm.canClearInstants
226+ ? Theme .of (context).colorScheme.error
227+ : Theme .of (context).disabledColor,
228+ onPressed: vm.canClearInstants ? () => _confirmClearEntries (context, vm) : null ,
229+ ),
230+ // Prev
231+ _BottomActionButton (
232+ icon: Icons .skip_previous_outlined,
233+ label: context.translate ('Prev' ),
234+ color: vm.canPrevInstant
235+ ? Theme .of (context).colorScheme.primary
236+ : Theme .of (context).disabledColor,
237+ onPressed: vm.canPrevInstant ? vm.prevInstant : null ,
238+ ),
239+ // Next
240+ _BottomActionButton (
241+ icon: Icons .skip_next_outlined,
242+ label: context.translate ('Next' ),
243+ color: vm.canNextInstant
244+ ? Theme .of (context).colorScheme.primary
245+ : Theme .of (context).disabledColor,
246+ onPressed: vm.canNextInstant ? vm.nextInstant : null ,
247+ ),
248+ ],
211249 ),
212- // Clear
213- _BottomActionButton (
214- icon: Icons .clear,
215- label: context.translate ('Clear' ),
216- color: vm.canClearInstants
217- ? Theme .of (context).colorScheme.error
218- : Theme .of (context).disabledColor,
219- onPressed: vm.canClearInstants ? () => _confirmClearEntries (context, vm) : null ,
220- ),
221- // Prev
222- _BottomActionButton (
223- icon: Icons .skip_previous_outlined,
224- label: context.translate ('Prev' ),
225- color: vm.canPrevInstant
226- ? Theme .of (context).colorScheme.primary
227- : Theme .of (context).disabledColor,
228- onPressed: vm.canPrevInstant ? vm.prevInstant : null ,
229- ),
230- // Next
231- _BottomActionButton (
232- icon: Icons .skip_next_outlined,
233- label: context.translate ('Next' ),
234- color: vm.canNextInstant
235- ? Theme .of (context).colorScheme.primary
236- : Theme .of (context).disabledColor,
237- onPressed: vm.canNextInstant ? vm.nextInstant : null ,
238- ),
239- ],
250+ ),
240251 ),
241252 ),
242253 ),
@@ -309,6 +320,7 @@ class _BottomActionButton extends StatelessWidget {
309320 final Color sysDisabled = theme.colorScheme.onSurface.withValues (alpha: 0.38 );
310321 final Color borderColor = isEnabled ? color : sysDisabled;
311322 final Color iconColor = isEnabled ? color : sysDisabled;
323+ final Color iconBgColor = isEnabled ? theme.colorScheme.surfaceBright : Colors .transparent;
312324 final Color labelColor = isEnabled ? Theme .of (context).colorScheme.onSurface : sysDisabled;
313325 final TextStyle ? labelStyle = theme.textTheme.labelSmall? .copyWith (color: labelColor);
314326 return Expanded (
@@ -326,7 +338,7 @@ class _BottomActionButton extends StatelessWidget {
326338 shape: RoundedRectangleBorder (borderRadius: BorderRadius .circular (8 )),
327339 side: BorderSide (color: borderColor, width: 1.5 ),
328340 foregroundColor: iconColor,
329- backgroundColor: Colors .transparent ,
341+ backgroundColor: iconBgColor ,
330342 padding: EdgeInsets .zero,
331343 shadowColor: Colors .transparent,
332344 disabledForegroundColor: sysDisabled,
0 commit comments