Skip to content

Commit cc9d06d

Browse files
committed
Fix SafeArea on iOS
1 parent 7cbc23c commit cc9d06d

10 files changed

Lines changed: 75 additions & 90 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class AcclimationScreen extends StatelessWidget {
5757
),
5858
],
5959
),
60-
body: SafeArea(child: _buildSettingsList(context)),
60+
body: _buildSettingsList(context),
6161
);
6262
}
6363
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DimmingScreen extends StatelessWidget {
5151
const LyfiBusyIndicatorSliver(),
5252
const LyfiStatusBannersSliver(),
5353
],
54-
body: const SafeArea(top: false, child: DimmingView()),
54+
body: DimmingView(),
5555
),
5656
const _ConnectionGuardOverlay(),
5757
],

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ class EasySetupScreen extends StatelessWidget {
5656
),
5757
],
5858
),
59-
body: SafeArea(
60-
child: Container(color: Theme.of(context).colorScheme.surface, child: child),
61-
),
59+
body: Container(color: Theme.of(context).colorScheme.surface, child: child),
6260
);
6361
},
6462
child: buildBody(context),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class _LyfiDeviceDetailsScreen extends StatelessWidget {
149149
const LyfiBusyIndicatorSliver(),
150150
const LyfiStatusBannersSliver(),
151151
],
152-
body: const SafeArea(top: false, child: _DashboardRouteVisibilityGate()),
152+
body: _DashboardRouteVisibilityGate(),
153153
),
154154
),
155155
);

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

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,40 @@ class MoonScreen extends StatelessWidget {
5656
),
5757
],
5858
),
59-
body: SafeArea(
60-
child: FutureBuilder(
61-
future: vm.initFuture,
62-
builder: (context, snapshot) {
63-
if (snapshot.connectionState == ConnectionState.waiting) {
64-
return Center(child: CircularProgressIndicator());
65-
} else if (snapshot.hasError) {
66-
return Center(child: Text('Error: ${snapshot.error}'));
67-
} else {
68-
return Column(
69-
mainAxisSize: MainAxisSize.max,
70-
children: [
71-
Container(
72-
color: Theme.of(context).scaffoldBackgroundColor,
73-
padding: const EdgeInsets.all(0),
74-
child: AspectRatio(
75-
aspectRatio: 1.5,
76-
child: Consumer<MoonViewModel>(builder: (context, vm, _) => buildGraph(context, vm)),
77-
),
59+
body: FutureBuilder(
60+
future: vm.initFuture,
61+
builder: (context, snapshot) {
62+
if (snapshot.connectionState == ConnectionState.waiting) {
63+
return Center(child: CircularProgressIndicator());
64+
} else if (snapshot.hasError) {
65+
return Center(child: Text('Error: ${snapshot.error}'));
66+
} else {
67+
return Column(
68+
mainAxisSize: MainAxisSize.max,
69+
children: [
70+
Container(
71+
color: Theme.of(context).scaffoldBackgroundColor,
72+
padding: const EdgeInsets.all(0),
73+
child: AspectRatio(
74+
aspectRatio: 1.5,
75+
child: Consumer<MoonViewModel>(builder: (context, vm, _) => buildGraph(context, vm)),
7876
),
79-
const SizedBox(height: 24),
80-
Expanded(
81-
child: Consumer<MoonViewModel>(
82-
builder: (context, vm, _) => ScreenTopRoundedContainer(
83-
color: Theme.of(context).colorScheme.surfaceContainerHighest,
84-
child: SingleChildScrollView(
85-
child: BrightnessSliderList(vm.editor, disabled: !vm.enabled || !vm.canEdit),
86-
),
77+
),
78+
const SizedBox(height: 24),
79+
Expanded(
80+
child: Consumer<MoonViewModel>(
81+
builder: (context, vm, _) => ScreenTopRoundedContainer(
82+
color: Theme.of(context).colorScheme.surfaceContainerHighest,
83+
child: SingleChildScrollView(
84+
child: BrightnessSliderList(vm.editor, disabled: !vm.enabled || !vm.canEdit),
8785
),
8886
),
8987
),
90-
],
91-
);
92-
}
93-
},
94-
),
88+
),
89+
],
90+
);
91+
}
92+
},
9593
),
9694
);
9795
},

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

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SettingsScreen extends StatelessWidget {
2727
value: vm,
2828
builder: (context, child) => Scaffold(
2929
appBar: AppBar(title: Text(context.translate('Settings')), elevation: 1),
30-
body: SafeArea(child: _buildSettingsList(context)),
30+
body: _buildSettingsList(context),
3131
),
3232
);
3333
}
@@ -84,18 +84,11 @@ class SettingsScreen extends StatelessWidget {
8484
tiles: [
8585
SettingsTile.navigation(
8686
title: Text(context.translate('Name')),
87-
trailing: Text(lvm.name),
87+
value: Text(lvm.name),
8888
onPressed: (bc) => _showNameDialog(bc, vm),
8989
),
90-
SettingsTile(
91-
title: Text(context.translate('Manufacturer & Model')),
92-
descriptionInlineIos: true,
93-
description: Row(
94-
spacing: 8,
95-
mainAxisAlignment: MainAxisAlignment.start,
96-
children: [Text(lvm.borneoInfo.manufName), Text(lvm.borneoInfo.modelName)],
97-
),
98-
),
90+
SettingsTile(title: Text(context.translate('Manufacturer')), trailing: Text(lvm.borneoInfo.modelName)),
91+
SettingsTile(title: Text(context.translate('Model')), trailing: Text(lvm.borneoInfo.manufName)),
9992
SettingsTile(
10093
title: Text(context.translate('Serial Number')),
10194
trailing: Text(lvm.borneoInfo.serno.substring(0, 12)),
@@ -119,6 +112,7 @@ class SettingsScreen extends StatelessWidget {
119112
),
120113
],
121114
),
115+
122116
SettingsSection(
123117
title: Text(context.translate('DEVICE STATUS')),
124118
tiles: [
@@ -137,7 +131,7 @@ class SettingsScreen extends StatelessWidget {
137131
),
138132
SettingsTile.navigation(
139133
title: Text(context.translate('Power status at startup')),
140-
trailing: Text(_formatPowerBehavior(context, lvm.powerBehavior)),
134+
value: Text(_formatPowerBehavior(context, lvm.powerBehavior)),
141135
enabled: lvm.canUpdatePowerBehavior,
142136
onPressed: (bc) => _showPowerBehaviorPicker(bc, vm),
143137
),
@@ -158,7 +152,7 @@ class SettingsScreen extends StatelessWidget {
158152
title: Text(context.translate('Device Location')),
159153
description: Text(context.translate('Geo location')),
160154
descriptionInlineIos: true,
161-
trailing: lvm.location != null
155+
value: lvm.location != null
162156
? Text("(${lvm.location!.lat.toStringAsFixed(0)}, ${lvm.location!.lng.toStringAsFixed(0)})")
163157
: Text(context.translate('Unknown')),
164158
enabled: lvm.canUpdateGeoLocation,
@@ -170,13 +164,13 @@ class SettingsScreen extends StatelessWidget {
170164
),
171165
SettingsTile.navigation(
172166
title: Text(context.translate('Correction curve')),
173-
trailing: Text(_formatCorrectionMethod(context, lvm.correctionMethod)),
167+
value: Text(_formatCorrectionMethod(context, lvm.correctionMethod)),
174168
enabled: lvm.canUpdateCorrectionMethod,
175169
onPressed: (bc) => _showCorrectionMethodPicker(bc, vm),
176170
),
177171
SettingsTile.navigation(
178172
title: Text(context.translate('Temporary light duration')),
179-
trailing: Text(_formatDuration(context, lvm.temporaryDuration)),
173+
value: Text(_formatDuration(context, lvm.temporaryDuration)),
180174
enabled: lvm.canUpdateTemporaryDuration,
181175
onPressed: (bc) => _showTemporaryDurationPicker(bc, vm),
182176
),
@@ -199,13 +193,13 @@ class SettingsScreen extends StatelessWidget {
199193
tiles: [
200194
SettingsTile.navigation(
201195
title: Text(context.translate('Fan mode')),
202-
trailing: Text(_formatFanMode(context, lvm.fanMode)),
196+
value: Text(_formatFanMode(context, lvm.fanMode)),
203197
enabled: lvm.canUpdateFanMode,
204198
onPressed: (bc) => _showFanModePicker(bc, vm),
205199
),
206200
SettingsTile.navigation(
207201
title: Text(context.translate('Manual fan power')),
208-
trailing: Text('${lvm.manualFanPower}%'),
202+
value: Text('${lvm.manualFanPower}%'),
209203
enabled: lvm.canUpdateManualFanPower,
210204
onPressed: lvm.canUpdateManualFanPower
211205
? (bc) => _showManualFanPowerDialog(bc, vm, lvm.manualFanPower)

client/lib/devices/borneo/lyfi/views/widgets/manual_running_chart.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ class ManualRunningChart extends StatelessWidget {
7474
assert(vm.isOnline);
7575
return MultiValueListenableBuilder<int>(
7676
valueNotifiers: vm.channels,
77-
builder: (context, values, _) => Padding(
78-
padding: EdgeInsets.fromLTRB(24, 16, 24, 0),
77+
builder: (context, values, _) => Expanded(
7978
child: LyfiColorChart(
8079
BarChartData(
8180
barGroups: buildGroupDataItems(context),

client/lib/features/devices/views/device_group_selection_sheet.dart

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,36 @@ class DeviceGroupSelectionSheet extends StatelessWidget {
4747
}),
4848
)
4949
.toList();
50-
return SafeArea(
51-
child: Column(
52-
crossAxisAlignment: CrossAxisAlignment.stretch,
53-
mainAxisSize: MainAxisSize.min,
54-
children: [
50+
return Column(
51+
crossAxisAlignment: CrossAxisAlignment.stretch,
52+
mainAxisSize: MainAxisSize.min,
53+
children: [
54+
Container(
55+
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
56+
child: Text(title, textAlign: TextAlign.center),
57+
),
58+
if (subtitle != null)
5559
Container(
56-
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
57-
child: Text(title, textAlign: TextAlign.center),
58-
),
59-
if (subtitle != null)
60-
Container(
61-
padding: EdgeInsets.fromLTRB(16, 8, 16, 0),
62-
child: Text(
63-
subtitle!,
64-
textAlign: TextAlign.start,
65-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Theme.of(context).hintColor),
66-
),
67-
),
68-
const SizedBox(height: 8),
69-
Flexible(
70-
child: ListView.separated(
71-
padding: const EdgeInsets.all(0),
72-
shrinkWrap: true,
73-
physics: const ClampingScrollPhysics(),
74-
itemBuilder: (BuildContext context, int index) => tiles[index],
75-
separatorBuilder: (BuildContext context, int index) => const Divider(indent: 16, height: 8, thickness: 1),
76-
itemCount: tiles.length,
60+
padding: EdgeInsets.fromLTRB(16, 8, 16, 0),
61+
child: Text(
62+
subtitle!,
63+
textAlign: TextAlign.start,
64+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Theme.of(context).hintColor),
7765
),
7866
),
79-
const SizedBox(height: 16),
80-
],
81-
),
67+
const SizedBox(height: 8),
68+
Flexible(
69+
child: ListView.separated(
70+
padding: const EdgeInsets.all(0),
71+
shrinkWrap: true,
72+
physics: const ClampingScrollPhysics(),
73+
itemBuilder: (BuildContext context, int index) => tiles[index],
74+
separatorBuilder: (BuildContext context, int index) => const Divider(indent: 16, height: 8, thickness: 1),
75+
itemCount: tiles.length,
76+
),
77+
),
78+
const SizedBox(height: 16),
79+
],
8280
);
8381
}
8482
}

client/lib/features/settings/views/app_settings_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AppSettingsScreen extends StatelessWidget {
4949
} else {
5050
return Scaffold(
5151
appBar: AppBar(title: Text(context.translate('App Settings')), elevation: 1),
52-
body: SafeArea(child: buildItems(context)),
52+
body: buildItems(context),
5353
);
5454
}
5555
},

client/lib/shared/widgets/generic_settings_screen.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ class GenericSettingsScreen extends StatelessWidget {
1212
Widget build(BuildContext context) {
1313
return Scaffold(
1414
appBar: AppBar(title: Text(title), actions: appBarActions, elevation: 1),
15-
body: SafeArea(
16-
child: ListView.builder(itemCount: children.length, itemBuilder: (context, index) => children[index]),
17-
),
15+
body: ListView.builder(itemCount: children.length, itemBuilder: (context, index) => children[index]),
1816
);
1917
}
2018
}

0 commit comments

Comments
 (0)