Skip to content

Commit

Permalink
ui: add mono font for device ids
Browse files Browse the repository at this point in the history
  • Loading branch information
jjanku committed Mar 10, 2024
1 parent 9ddc627 commit 968a191
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 34 deletions.
Binary file added assets/RobotoMono.ttf
Binary file not shown.
10 changes: 1 addition & 9 deletions lib/ui/device_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ class HexTable extends StatelessWidget {

@override
Widget build(BuildContext context) {
final monoStyle = Theme.of(context).textTheme.bodyMedium?.copyWith(
fontFeatures: const [
// TODO: does not apply to letters, use a full mono font?
FontFeature.tabularFigures(),
FontFeature.slashedZero()
],
);

final chunks = hex.splitByLength(charsPerCell).toList();
assert(width > 1);
final height = (chunks.length + 1) ~/ width;
Expand All @@ -42,7 +34,7 @@ class HexTable extends StatelessWidget {
Center(
child: Text(
chunks[y * width + x],
style: monoStyle,
style: const TextStyle(fontFamily: 'RobotoMono'),
),
)
])
Expand Down
8 changes: 2 additions & 6 deletions lib/ui/search_peer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ class DeviceSuggestionTile extends StatelessWidget {
softWrap: false,
overflow: TextOverflow.fade,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface.withOpacity(.3),
// TODO: does not apply to letters, use a full mono font?
fontFeatures: const [
FontFeature.tabularFigures(),
FontFeature.slashedZero()
],
color: Theme.of(context).colorScheme.onSurface.withOpacity(.26),
fontFamily: 'RobotoMono',
),
),
);
Expand Down
23 changes: 4 additions & 19 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,7 @@ flutter:
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
fonts:
- family: RobotoMono
fonts:
- asset: assets/RobotoMono.ttf

0 comments on commit 968a191

Please sign in to comment.