Skip to content

Commit

Permalink
fix: attempt to relieve vertical alignment issue (but does not seem t…
Browse files Browse the repository at this point in the history
…o work...)

Related to #192. From flutter/flutter#128019.
  • Loading branch information
w568w committed Jun 28, 2023
1 parent b1c0fbd commit 378840a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/common/constant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ class Constant {
return '\u00A5$num';
}

/// An Unicode ZERO WIDTH SPACE wrapper.
///
/// We mainly use it to relieve vertical alignment issues.
/// See https://github.com/flutter/flutter/issues/128019 for details.
///
/// Remove this method and its usage if the issue has been resolved.
static String withZwb(String? originalStr) {
if (originalStr == null) return "";
return '$originalStr\u200b';
}

/// Get the link to update the application.
static String updateUrl() {
// Don't use GitHub URL, since access is not guaranteed in China.
Expand Down
3 changes: 2 additions & 1 deletion lib/widget/opentreehole/bbs_tags_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import 'package:dan_xi/common/constant.dart';
import 'package:dan_xi/model/opentreehole/tag.dart';
import 'package:dan_xi/widget/libraries/round_chip.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -62,7 +63,7 @@ class BBSTagsContainerState extends State<BBSTagsContainer> {
(e) => Padding(
padding: const EdgeInsets.only(top: 16, right: 12),
child: RoundChip(
label: e.name,
label: Constant.withZwb(e.name),
color: e.color,
onTap: () => widget.onTap?.call(e))),
)
Expand Down
3 changes: 2 additions & 1 deletion lib/widget/opentreehole/treehole_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import 'package:dan_xi/common/constant.dart';
import 'package:dan_xi/generated/l10n.dart';
import 'package:dan_xi/model/opentreehole/floor.dart';
import 'package:dan_xi/model/opentreehole/hole.dart';
Expand Down Expand Up @@ -105,7 +106,7 @@ Widget generateTagWidgets(BuildContext context, OTHole? e,
children: [
RoundChip(
onTap: () => onTap(element.name),
label: element.name,
label: Constant.withZwb(element.name),
color: useAccessibilityColoring
? Theme.of(context).textTheme.bodyLarge!.color
: element.color,
Expand Down

0 comments on commit 378840a

Please sign in to comment.