Skip to content

Commit

Permalink
feat: mono font for code block
Browse files Browse the repository at this point in the history
  • Loading branch information
PeronGH committed Dec 10, 2023
1 parent a6acfab commit 613d6de
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 1 deletion.
Binary file added fonts/RobotoMono-Bold.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-BoldItalic.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-ExtraLight.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-ExtraLightItalic.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-Italic.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-Light.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-LightItalic.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-Medium.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-MediumItalic.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-Regular.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-SemiBold.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-SemiBoldItalic.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-Thin.ttf
Binary file not shown.
Binary file added fonts/RobotoMono-ThinItalic.ttf
Binary file not shown.
11 changes: 10 additions & 1 deletion lib/widgets/message_tile.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:sydney_webui/models/message.dart';
import 'package:sydney_webui/utils/array.dart';

Expand All @@ -16,6 +17,10 @@ class MessageTile extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);

final markdownTheme = MarkdownStyleSheet.fromTheme(theme).copyWith(
code: theme.textTheme.bodyMedium!
.copyWith(fontFamily: GoogleFonts.robotoMono().fontFamily));

return ListTile(
title: Padding(
padding: const EdgeInsets.only(bottom: 8),
Expand All @@ -42,7 +47,11 @@ class MessageTile extends StatelessWidget {
],
),
),
subtitle: MarkdownBody(data: message.content),
subtitle: MarkdownBody(
selectable: true,
data: message.content,
styleSheet: markdownTheme,
),
titleTextStyle: theme.textTheme.bodySmall,
);
}
Expand Down
40 changes: 40 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.18.0"
crypto:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.3"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -128,6 +136,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
sha256: f0b8d115a13ecf827013ec9fc883390ccc0e87a96ed5347a3114cac177ef18e8
url: "https://pub.dev"
source: hosted
version: "6.1.0"
http:
dependency: transitive
description:
name: http
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139
url: "https://pub.dev"
source: hosted
version: "1.1.2"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -293,6 +325,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.1"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.2"
vector_math:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies:
get_storage:
file_picker: ^6.1.1
flutter_markdown:
google_fonts:

dev_dependencies:
flutter_test:
Expand All @@ -52,3 +53,5 @@ dev_dependencies:
# The following section is specific to Flutter packages.
flutter:
uses-material-design: true
assets:
- fonts/

0 comments on commit 613d6de

Please sign in to comment.