Skip to content

Commit 3326702

Browse files
committed
set-status: Fix content rendering in landscape mode
Before this, the content would be obscured by any insets on the sides, e.g. by a camera notch when in landscape mode. Now it avoids the insets. Fixes: #1769
1 parent d4df8f9 commit 3326702

File tree

1 file changed

+80
-83
lines changed

1 file changed

+80
-83
lines changed

lib/widgets/set_status.dart

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -182,88 +182,85 @@ class _SetStatusPageState extends State<SetStatusPage> {
182182
}),
183183
],
184184
),
185-
body: Column(children: [
186-
Padding(
187-
padding: const EdgeInsetsDirectional.only(
188-
// In Figma design, this is 16px, but we compensate for that in
189-
// the icon button below.
190-
start: 8,
191-
top: 8,
192-
// In Figma design, this is 10px, but to be consistent with other
193-
// page content, we use 8px.
194-
end: 8,
195-
// In Figma design, this is 4px, be we compensate for that in
196-
// [SingleChildScrollView.padding] below.
197-
bottom: 0),
198-
child: Row(
199-
crossAxisAlignment: CrossAxisAlignment.start,
200-
children: [
201-
IconButton(
202-
onPressed: chooseStatusEmoji,
203-
style: IconButton.styleFrom(
204-
splashFactory: NoSplash.splashFactory,
205-
foregroundColor: designVariables.icon,
206-
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
207-
padding: EdgeInsets.symmetric(
208-
vertical: 8,
209-
// In Figma design, there is no horizontal padding, but we
210-
// provide it in order to create a proper tap target size.
211-
horizontal: 8)),
212-
icon: Row(spacing: 4, children: [
213-
ValueListenableBuilder(
214-
valueListenable: statusChange,
215-
builder: (_, change, _) {
216-
final emoji = change.emoji.or(oldStatus.emoji);
217-
return emoji == null
218-
? const Icon(ZulipIcons.smile, size: 24)
219-
: UserStatusEmoji(emoji: emoji, size: 24, neverAnimate: false);
220-
}),
221-
Icon(ZulipIcons.chevron_down, size: 16),
222-
]),
223-
),
224-
Expanded(child: TextField(
225-
controller: statusTextController,
226-
minLines: 1,
227-
maxLines: 2,
228-
// The limit on the size of the status text is 60 characters.
229-
// See: https://zulip.com/api/update-status#parameter-status_text
230-
maxLength: 60,
231-
cursorColor: designVariables.textInput,
232-
textCapitalization: TextCapitalization.sentences,
233-
style: TextStyle(fontSize: 19, height: 24 / 19),
234-
decoration: InputDecoration(
235-
// TODO: display a counter as suggested in CZO discussion:
236-
// https://chat.zulip.org/#narrow/channel/530-mobile-design/topic/Set.20user.20status/near/2224549
237-
counterText: '',
238-
hintText: localizations.statusTextHint,
239-
hintStyle: TextStyle(color: designVariables.labelSearchPrompt),
240-
isDense: true,
241-
contentPadding: EdgeInsets.symmetric(
242-
vertical: 8,
243-
// Subtracting 4 pixels to account for the internal
244-
// 4-pixel horizontal padding.
245-
horizontal: 10 - 4,
246-
),
247-
filled: true,
248-
fillColor: designVariables.bgSearchInput,
249-
border: OutlineInputBorder(
250-
borderRadius: BorderRadius.circular(10),
251-
borderSide: BorderSide.none,
252-
)))),
253-
]),
254-
),
255-
Expanded(child: InsetShadowBox(
256-
top: 6, bottom: 6,
257-
color: designVariables.mainBackground,
258-
child: SingleChildScrollView(
259-
padding: EdgeInsets.symmetric(vertical: 6),
260-
child: Column(children: [
261-
for (final status in suggestions)
262-
StatusSuggestionsListEntry(
263-
status: status,
264-
onTap: () => chooseStatusSuggestion(status)),
265-
])))),
266-
]),
185+
body: SafeArea(
186+
bottom: false,
187+
minimum: EdgeInsets.symmetric(horizontal: 8),
188+
child: Column(children: [
189+
Padding(
190+
padding: const EdgeInsetsDirectional.only(
191+
top: 8,
192+
// In Figma design, this is 4px, be we compensate for that in
193+
// [SingleChildScrollView.padding] below.
194+
bottom: 0),
195+
child: Row(
196+
crossAxisAlignment: CrossAxisAlignment.start,
197+
children: [
198+
IconButton(
199+
onPressed: chooseStatusEmoji,
200+
style: IconButton.styleFrom(
201+
splashFactory: NoSplash.splashFactory,
202+
foregroundColor: designVariables.icon,
203+
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
204+
padding: EdgeInsets.symmetric(
205+
vertical: 8,
206+
// In Figma design, there is no horizontal padding, but we
207+
// provide it in order to create a proper tap target size.
208+
horizontal: 8)),
209+
icon: Row(spacing: 4, children: [
210+
ValueListenableBuilder(
211+
valueListenable: statusChange,
212+
builder: (_, change, _) {
213+
final emoji = change.emoji.or(oldStatus.emoji);
214+
return emoji == null
215+
? const Icon(ZulipIcons.smile, size: 24)
216+
: UserStatusEmoji(emoji: emoji, size: 24, neverAnimate: false);
217+
}),
218+
Icon(ZulipIcons.chevron_down, size: 16),
219+
]),
220+
),
221+
Expanded(child: TextField(
222+
controller: statusTextController,
223+
minLines: 1,
224+
maxLines: 2,
225+
// The limit on the size of the status text is 60 characters.
226+
// See: https://zulip.com/api/update-status#parameter-status_text
227+
maxLength: 60,
228+
cursorColor: designVariables.textInput,
229+
textCapitalization: TextCapitalization.sentences,
230+
style: TextStyle(fontSize: 19, height: 24 / 19),
231+
decoration: InputDecoration(
232+
// TODO: display a counter as suggested in CZO discussion:
233+
// https://chat.zulip.org/#narrow/channel/530-mobile-design/topic/Set.20user.20status/near/2224549
234+
counterText: '',
235+
hintText: localizations.statusTextHint,
236+
hintStyle: TextStyle(color: designVariables.labelSearchPrompt),
237+
isDense: true,
238+
contentPadding: EdgeInsets.symmetric(
239+
vertical: 8,
240+
// Subtracting 4 pixels to account for the internal
241+
// 4-pixel horizontal padding.
242+
horizontal: 10 - 4,
243+
),
244+
filled: true,
245+
fillColor: designVariables.bgSearchInput,
246+
border: OutlineInputBorder(
247+
borderRadius: BorderRadius.circular(10),
248+
borderSide: BorderSide.none,
249+
)))),
250+
]),
251+
),
252+
Expanded(child: InsetShadowBox(
253+
top: 6, bottom: 6,
254+
color: designVariables.mainBackground,
255+
child: SingleChildScrollView(
256+
padding: EdgeInsets.symmetric(vertical: 6),
257+
child: Column(children: [
258+
for (final status in suggestions)
259+
StatusSuggestionsListEntry(
260+
status: status,
261+
onTap: () => chooseStatusSuggestion(status)),
262+
])))),
263+
])),
267264
);
268265
}
269266
}
@@ -319,7 +316,7 @@ class StatusSuggestionsListEntry extends StatelessWidget {
319316
behavior: HitTestBehavior.opaque,
320317
onTap: onTap,
321318
child: Padding(
322-
padding: EdgeInsets.symmetric(vertical: 7, horizontal: 16),
319+
padding: EdgeInsets.symmetric(vertical: 7, horizontal: 8),
323320
child: Row(
324321
spacing: 8,
325322
children: [

0 commit comments

Comments
 (0)