Skip to content

Commit 10641e5

Browse files
committed
action_sheet: Rename BottomSheetHeaderPlainText to BottomSheetInfoText
This way, it can be used for purposes other than being a header, such as in the next commits, when read receipts fail to load, we use this widget in the center of bottom sheet to give feedback to the user. Additional changes: - Adds a TextAlign property for controlling the alignment. - Removes vertical padding so callers can decide about it. But keeps the horizontal padding of 16 as it is the default padding of our bottoms sheets.
1 parent 76fe89f commit 10641e5

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lib/widgets/action_sheet.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,31 @@ void _showActionSheet(
9898
});
9999
}
100100

101-
/// A header for a bottom sheet with a multiline UI string.
101+
/// A plain text widget for a bottom sheet with a multiline UI string.
102102
///
103-
/// Assumes 8px padding below the top of the bottom sheet.
103+
/// Use it to present short, non-interactive explanatory messages to the user,
104+
/// such as an error message or other feedback.
105+
///
106+
/// Comes with built-in 16px horizontal padding.
104107
///
105108
/// Figma:
106109
/// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3481-26993&m=dev
107-
class BottomSheetHeaderPlainText extends StatelessWidget {
108-
const BottomSheetHeaderPlainText({super.key, required this.text});
110+
class BottomSheetInfoText extends StatelessWidget {
111+
const BottomSheetInfoText({super.key, required this.text, this.textAlign});
109112

110113
final String text;
114+
final TextAlign? textAlign;
111115

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

116120
return Padding(
117-
padding: EdgeInsets.fromLTRB(16, 8, 16, 4),
121+
padding: EdgeInsets.symmetric(horizontal: 16),
118122
child: SizedBox(
119123
width: double.infinity,
120124
child: Text(
125+
textAlign: textAlign,
121126
style: TextStyle(
122127
color: designVariables.labelTime,
123128
fontSize: 17,

lib/widgets/emoji_reaction.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,8 @@ class ViewReactionsHeader extends StatelessWidget {
773773

774774
if (reactions == null || reactions.aggregated.isEmpty) {
775775
return Padding(
776-
padding: const EdgeInsets.only(top: 8),
777-
child: BottomSheetHeaderPlainText(text: zulipLocalizations.seeWhoReactedSheetNoReactions),
776+
padding: const EdgeInsets.only(top: 16, bottom: 4),
777+
child: BottomSheetInfoText(text: zulipLocalizations.seeWhoReactedSheetNoReactions),
778778
);
779779
}
780780

0 commit comments

Comments
 (0)