Skip to content

Set status page adjustments #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 83 additions & 90 deletions lib/widgets/set_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import '../basic.dart';
import '../generated/l10n/zulip_localizations.dart';
import '../log.dart';
import 'app_bar.dart';
import 'color.dart';
import 'emoji_reaction.dart';
import 'icons.dart';
import 'inset_shadow.dart';
Expand Down Expand Up @@ -183,85 +182,86 @@ class _SetStatusPageState extends State<SetStatusPage> {
}),
],
),
body: Column(children: [
Padding(
padding: const EdgeInsetsDirectional.only(
// In Figma design, this is 16px, but we compensate for that in
// the icon button below.
start: 8,
top: 8, end: 10,
// In Figma design, this is 4px, be we compensate for that in
// [SingleChildScrollView.padding] below.
bottom: 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(
onPressed: chooseStatusEmoji,
style: IconButton.styleFrom(
splashFactory: NoSplash.splashFactory,
foregroundColor: designVariables.icon,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.symmetric(
vertical: 8,
// In Figma design, there is no horizontal padding, but we
// provide it in order to create a proper tap target size.
horizontal: 8)),
icon: Row(spacing: 4, children: [
ValueListenableBuilder(
valueListenable: statusChange,
builder: (_, change, _) {
final emoji = change.emoji.or(oldStatus.emoji);
return emoji == null
? const Icon(ZulipIcons.smile, size: 24)
: UserStatusEmoji(emoji: emoji, size: 24, neverAnimate: false);
}),
Icon(ZulipIcons.chevron_down, size: 16),
]),
),
Expanded(child: TextField(
controller: statusTextController,
minLines: 1,
maxLines: 2,
// The limit on the size of the status text is 60 characters.
// See: https://zulip.com/api/update-status#parameter-status_text
maxLength: 60,
cursorColor: designVariables.textInput,
textCapitalization: TextCapitalization.sentences,
style: TextStyle(fontSize: 19, height: 24 / 19),
decoration: InputDecoration(
// TODO: display a counter as suggested in CZO discussion:
// https://chat.zulip.org/#narrow/channel/530-mobile-design/topic/Set.20user.20status/near/2224549
counterText: '',
hintText: localizations.statusTextHint,
hintStyle: TextStyle(color: designVariables.labelSearchPrompt),
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 8,
// Subtracting 4 pixels to account for the internal
// 4-pixel horizontal padding.
horizontal: 10 - 4,
),
filled: true,
fillColor: designVariables.bgSearchInput,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide.none,
)))),
]),
),
Expanded(child: InsetShadowBox(
top: 6, bottom: 6,
color: designVariables.mainBackground,
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(vertical: 6),
child: Column(children: [
for (final status in suggestions)
StatusSuggestionsListEntry(
status: status,
onTap: () => chooseStatusSuggestion(status)),
])))),
]),
body: SafeArea(
bottom: false,
minimum: EdgeInsets.symmetric(horizontal: 8),
child: Column(children: [
Padding(
padding: const EdgeInsetsDirectional.only(
top: 8,
// In Figma design, this is 4px, be we compensate for that in
// [SingleChildScrollView.padding] below.
bottom: 0),
child: Row(
spacing: 4,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(
onPressed: chooseStatusEmoji,
style: IconButton.styleFrom(
splashFactory: NoSplash.splashFactory,
foregroundColor: designVariables.icon,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.symmetric(
vertical: 8,
// In Figma design, there is no horizontal padding, but we
// provide it in order to create a proper tap target size.
horizontal: 8)),
icon: Row(spacing: 4, children: [
ValueListenableBuilder(
valueListenable: statusChange,
builder: (_, change, _) {
final emoji = change.emoji.or(oldStatus.emoji);
return emoji == null
? const Icon(ZulipIcons.smile, size: 24)
: UserStatusEmoji(emoji: emoji, size: 24, neverAnimate: false);
}),
Icon(ZulipIcons.chevron_down, size: 16),
]),
),
Expanded(child: TextField(
controller: statusTextController,
minLines: 1,
maxLines: 2,
// The limit on the size of the status text is 60 characters.
// See: https://zulip.com/api/update-status#parameter-status_text
maxLength: 60,
cursorColor: designVariables.textInput,
textCapitalization: TextCapitalization.sentences,
style: TextStyle(fontSize: 19, height: 24 / 19),
decoration: InputDecoration(
// TODO: display a counter as suggested in CZO discussion:
// https://chat.zulip.org/#narrow/channel/530-mobile-design/topic/Set.20user.20status/near/2224549
counterText: '',
hintText: localizations.statusTextHint,
hintStyle: TextStyle(color: designVariables.labelSearchPrompt),
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 8,
// Subtracting 4 pixels to account for the internal
// 4-pixel horizontal padding.
horizontal: 10 - 4,
),
filled: true,
fillColor: designVariables.bgSearchInput,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide.none,
)))),
]),
),
Expanded(child: InsetShadowBox(
top: 6,
color: designVariables.mainBackground,
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(vertical: 6),
child: Column(children: [
for (final status in suggestions)
StatusSuggestionsListEntry(
status: status,
onTap: () => chooseStatusSuggestion(status)),
])))),
])),
);
}
}
Expand Down Expand Up @@ -313,18 +313,11 @@ class StatusSuggestionsListEntry extends StatelessWidget {

@override
Widget build(BuildContext context) {
final designVariables = DesignVariables.of(context);

return InkWell(
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap,
splashFactory: NoSplash.splashFactory,
overlayColor: WidgetStateColor.resolveWith(
(states) => states.any((e) => e == WidgetState.pressed)
? designVariables.contextMenuItemBg.withFadedAlpha(0.20)
: Colors.transparent,
),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 7, horizontal: 16),
padding: EdgeInsets.symmetric(vertical: 7, horizontal: 8),
child: Row(
spacing: 8,
children: [
Expand Down