Skip to content

Commit 09b87ee

Browse files
committed
Fix iOS UI
1 parent d4fb64b commit 09b87ee

File tree

9 files changed

+202
-176
lines changed

9 files changed

+202
-176
lines changed

client/.vscode/launch.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99
"request": "launch",
1010
"type": "dart",
1111
"program": "${workspaceFolder}/lib/main.dart",
12-
"flutterMode": "debug"
12+
"flutterMode": "debug",
13+
"args": [
14+
"--no-pub"
15+
]
1316
},
1417
{
1518
"name": "app (profile mode)",
1619
"request": "launch",
1720
"type": "dart",
1821
"program": "${workspaceFolder}/lib/main.dart",
19-
"flutterMode": "profile"
22+
"flutterMode": "profile",
23+
"args": [
24+
"--no-pub"
25+
]
2026
},
2127
{
2228
"name": "app (release mode)",

client/lib/devices/borneo/lyfi/views/dimming_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class EditorHost extends StatelessWidget {
156156
);
157157
break;
158158
case EditorStatus.ready:
159-
child = SafeArea(top: false, left: false, right: false, child: _buildEditor(state));
159+
child = _buildEditor(state);
160160
break;
161161
case EditorStatus.idle:
162162
child = const SizedBox.shrink(key: ValueKey('editor-idle'));

client/lib/devices/borneo/lyfi/views/easy_setup_screen.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,14 @@ class EasySetupScreen extends StatelessWidget {
232232
return ScreenTopRoundedContainer(
233233
padding: EdgeInsets.fromLTRB(0, 24, 0, 0),
234234
color: Theme.of(context).colorScheme.surfaceContainer,
235-
child: SingleChildScrollView(
236-
child: BrightnessSliderList(tempEditor, disabled: !canEdit, padding: EdgeInsets.fromLTRB(0, 24, 0, 16)),
235+
child: SafeArea(
236+
child: SingleChildScrollView(
237+
child: BrightnessSliderList(
238+
tempEditor,
239+
disabled: !canEdit,
240+
padding: EdgeInsets.fromLTRB(0, 24, 0, 16),
241+
),
242+
),
237243
),
238244
);
239245
},

client/lib/devices/borneo/lyfi/views/editor/manual_editor_view.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,15 @@ class ManualEditorView extends StatelessWidget {
124124
Widget build(BuildContext context) {
125125
return ChangeNotifierProvider.value(
126126
value: viewModel,
127-
builder: (context, child) => Expanded(
128-
child: Column(
129-
spacing: 24,
130-
children: [
131-
Padding(
132-
padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
133-
child: SizedBox(height: 150, child: buildGraph(context)),
134-
),
135-
Expanded(child: buildSliders(context)),
136-
],
137-
),
127+
builder: (context, child) => Column(
128+
spacing: 24,
129+
children: [
130+
SizedBox(
131+
height: 150,
132+
child: Padding(padding: const EdgeInsets.fromLTRB(16, 16, 16, 0), child: buildGraph(context)),
133+
),
134+
Expanded(child: buildSliders(context)),
135+
],
138136
),
139137
);
140138
}

client/lib/devices/borneo/lyfi/views/editor/schedule_editor_view.dart

Lines changed: 98 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'package:borneo_app/devices/borneo/lyfi/view_models/constants.dart';
22
import 'package:borneo_app/devices/borneo/lyfi/views/easy_setup_screen.dart';
33
import 'package:borneo_app/core/infrastructure/duration.dart';
44
import 'package:borneo_app/core/infrastructure/time_of_day.dart';
5-
import 'package:borneo_app/shared/widgets/screen_top_rounded_container.dart';
65
import 'package:borneo_common/duration_ext.dart';
76
import 'package:fl_chart/fl_chart.dart';
87
import '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,

client/lib/devices/borneo/lyfi/views/editor/sun_editor_view.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ class SunEditorView extends StatelessWidget {
1818
if (vm.isInitialized) {
1919
return Selector<SunEditorViewModel, bool>(
2020
selector: (_, editor) => editor.canChangeColor,
21-
builder: (_, canChangeColor, _) => SingleChildScrollView(
22-
child: BrightnessSliderList(context.read<SunEditorViewModel>(), disabled: !canChangeColor),
21+
builder: (_, canChangeColor, _) => SafeArea(
22+
top: false,
23+
child: SingleChildScrollView(
24+
child: BrightnessSliderList(context.read<SunEditorViewModel>(), disabled: !canChangeColor),
25+
),
2326
),
2427
);
2528
} else {
26-
return Container();
29+
return const SizedBox.shrink();
2730
}
2831
},
2932
);
@@ -57,8 +60,8 @@ class SunEditorView extends StatelessWidget {
5760
Container(
5861
color: Theme.of(context).scaffoldBackgroundColor,
5962
padding: const EdgeInsets.all(0),
60-
child: AspectRatio(
61-
aspectRatio: 2.75,
63+
child: SizedBox(
64+
height: 150,
6265
child: Consumer<SunEditorViewModel>(builder: (conterxt, vm, _) => buildGraph(context)),
6366
),
6467
),

client/lib/devices/borneo/lyfi/views/moon_screen.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ class MoonScreen extends StatelessWidget {
8585
child: Consumer<MoonViewModel>(
8686
builder: (context, vm, _) => ScreenTopRoundedContainer(
8787
color: Theme.of(context).colorScheme.surfaceContainer,
88-
padding: EdgeInsets.fromLTRB(0, 24, 0, 24),
89-
child: SingleChildScrollView(
90-
child: BrightnessSliderList(vm.editor, disabled: !vm.enabled || !vm.canEdit),
88+
padding: EdgeInsets.fromLTRB(0, 24, 0, 0),
89+
child: SafeArea(
90+
child: SingleChildScrollView(
91+
child: BrightnessSliderList(vm.editor, disabled: !vm.enabled || !vm.canEdit),
92+
),
9193
),
9294
),
9395
),

0 commit comments

Comments
 (0)