Skip to content

Commit 08cb069

Browse files
committed
fix: Base bottom sheet title
1 parent a45754e commit 08cb069

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ui/lib/src/bottom_sheets/base_bottom_sheet.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Future<T?> showBaseBottomSheet<T>({
66
required BuildContext context,
77
bool hasCloseButton = true,
88
bool? closeButtonReturnValue,
9+
910
/// Has translation so just pass the key
1011
String? bottomSheetTitle,
1112
List<Widget>? widgets,
@@ -19,8 +20,14 @@ Future<T?> showBaseBottomSheet<T>({
1920
(!((widgets != null && bottomSheetTitle != null) && content != null)),
2021
"Only one of content or widgets should be specified.");
2122
String translate(String text) => FlutterI18n.translate(context, text);
22-
String translatedTitle = translate(bottomSheetTitle ?? "");
23-
String capitalizedTitle = translatedTitle[0].toUpperCase() + translatedTitle.substring(1);
23+
24+
String? title;
25+
if (bottomSheetTitle != null) {
26+
String translatedTitle = translate(bottomSheetTitle);
27+
title =
28+
translatedTitle[0].toUpperCase() + translatedTitle.substring(1);
29+
}
30+
2431
return showModalBottomSheet<T>(
2532
context: context,
2633
useRootNavigator: true,
@@ -58,7 +65,7 @@ Future<T?> showBaseBottomSheet<T>({
5865
crossAxisAlignment: CrossAxisAlignment.start,
5966
children: [
6067
MxcAppBarEvenly.title(
61-
titleText: capitalizedTitle,
68+
titleText: title ?? "",
6269
action: hasCloseButton
6370
? Container(
6471
alignment: Alignment.centerRight,

0 commit comments

Comments
 (0)