Skip to content

Commit a721ace

Browse files
committed
set-status: Fix content rendering in landscape mode
Fixes: #1769
1 parent 101071a commit a721ace

File tree

1 file changed

+72
-77
lines changed

1 file changed

+72
-77
lines changed

lib/widgets/set_status.dart

Lines changed: 72 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import '../basic.dart';
88
import '../generated/l10n/zulip_localizations.dart';
99
import '../log.dart';
1010
import 'app_bar.dart';
11-
import 'color.dart';
1211
import 'emoji_reaction.dart';
1312
import 'icons.dart';
1413
import 'inset_shadow.dart';
@@ -183,73 +182,76 @@ class _SetStatusPageState extends State<SetStatusPage> {
183182
}),
184183
],
185184
),
186-
body: Column(children: [
187-
Padding(
188-
padding: const EdgeInsetsDirectional.only(
189-
// In Figma design, this is 16px, but we compensate for that in
190-
// the icon button below.
191-
start: 8,
192-
top: 8, end: 10,
193-
// In Figma design, this is 4px, be we compensate for that in
194-
// [SingleChildScrollView.padding] below.
195-
bottom: 0),
196-
child: Row(
197-
crossAxisAlignment: CrossAxisAlignment.start,
198-
children: [
199-
IconButton(
200-
onPressed: chooseStatusEmoji,
201-
style: IconButton.styleFrom(
202-
splashFactory: NoSplash.splashFactory,
203-
foregroundColor: designVariables.icon,
204-
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
205-
padding: EdgeInsets.symmetric(
206-
vertical: 8,
207-
// In Figma design, there is no horizontal padding, but we
208-
// provide it in order to create a proper tap target size.
209-
horizontal: 8)),
210-
icon: Row(spacing: 4, children: [
211-
ValueListenableBuilder(
212-
valueListenable: statusChange,
213-
builder: (_, change, _) {
214-
final emoji = change.emoji.or(oldStatus.emoji);
215-
return emoji == null
216-
? const Icon(ZulipIcons.smile, size: 24)
217-
: UserStatusEmoji(emoji: emoji, size: 24, neverAnimate: false);
218-
}),
219-
Icon(ZulipIcons.chevron_down, size: 16),
220-
]),
221-
),
222-
Expanded(child: TextField(
223-
controller: statusTextController,
224-
minLines: 1,
225-
maxLines: 2,
226-
// The limit on the size of the status text is 60 characters.
227-
// See: https://zulip.com/api/update-status#parameter-status_text
228-
maxLength: 60,
229-
cursorColor: designVariables.textInput,
230-
textCapitalization: TextCapitalization.sentences,
231-
style: TextStyle(fontSize: 19, height: 24 / 19),
232-
decoration: InputDecoration(
233-
// TODO: display a counter as suggested in CZO discussion:
234-
// https://chat.zulip.org/#narrow/channel/530-mobile-design/topic/Set.20user.20status/near/2224549
235-
counterText: '',
236-
hintText: localizations.statusTextHint,
237-
hintStyle: TextStyle(color: designVariables.labelSearchPrompt),
238-
isDense: true,
239-
contentPadding: EdgeInsets.symmetric(
240-
vertical: 8,
241-
// Subtracting 4 pixels to account for the internal
242-
// 4-pixel horizontal padding.
243-
horizontal: 10 - 4,
244-
),
245-
filled: true,
246-
fillColor: designVariables.bgSearchInput,
247-
border: OutlineInputBorder(
248-
borderRadius: BorderRadius.circular(10),
249-
borderSide: BorderSide.none,
250-
)))),
251-
]),
252-
),
185+
body: SafeArea(
186+
bottom: false,
187+
minimum: EdgeInsets.symmetric(horizontal: 8),
188+
child: Column(children: [
189+
Padding(
190+
padding: const EdgeInsetsDirectional.only(
191+
// In Figma design, this is 16px, but we compensate for that in
192+
// the icon button below.
193+
start: 8,
194+
top: 8, 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+
),
253255
Expanded(child: InsetShadowBox(
254256
top: 6, bottom: 6,
255257
color: designVariables.mainBackground,
@@ -261,7 +263,7 @@ class _SetStatusPageState extends State<SetStatusPage> {
261263
status: status,
262264
onTap: () => chooseStatusSuggestion(status)),
263265
])))),
264-
]),
266+
])),
265267
);
266268
}
267269
}
@@ -313,16 +315,9 @@ class StatusSuggestionsListEntry extends StatelessWidget {
313315

314316
@override
315317
Widget build(BuildContext context) {
316-
final designVariables = DesignVariables.of(context);
317-
318318
return InkWell(
319319
onTap: onTap,
320-
splashFactory: NoSplash.splashFactory,
321-
overlayColor: WidgetStateColor.resolveWith(
322-
(states) => states.any((e) => e == WidgetState.pressed)
323-
? designVariables.contextMenuItemBg.withFadedAlpha(0.20)
324-
: Colors.transparent,
325-
),
320+
overlayColor: WidgetStatePropertyAll(Colors.transparent),
326321
child: Padding(
327322
padding: EdgeInsets.symmetric(vertical: 7, horizontal: 16),
328323
child: Row(

0 commit comments

Comments
 (0)