Skip to content

Commit f84921c

Browse files
committed
Add markdown emoji support
1 parent 023ef0c commit f84921c

File tree

5 files changed

+85
-39
lines changed

5 files changed

+85
-39
lines changed

app/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Install Operating system and dependencies
2+
FROM ubuntu:22.04 AS builder
3+
4+
RUN apt-get update
5+
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3
6+
RUN apt-get clean
7+
8+
RUN mkdir /app/
9+
COPY . /app
10+
WORKDIR /app
11+
# download Flutter SDK from Flutter Github repo
12+
RUN git clone https://github.com/flutter/flutter.git -b $(cat /FLUTTER_VERSION) /usr/local/flutter
13+
14+
# Set flutter environment path
15+
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
16+
# Run flutter doctor
17+
RUN flutter doctor
18+
19+
RUN flutter config --enable-web
20+
21+
# Copy files to container and build
22+
RUN flutter build web
23+
24+
FROM python:3
25+
26+
RUN mkdir /app/
27+
# Copy build/web in container to /app/
28+
COPY --from=builder ./build/web /app/
29+
WORKDIR /app/
30+
31+
# Record the exposed port
32+
EXPOSE 5000
33+
34+
CMD python -m http.server 5000

app/lib/widgets/markdown_field.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_markdown/flutter_markdown.dart';
33
import 'package:url_launcher/url_launcher_string.dart';
4+
import 'package:markdown/markdown.dart' as md;
45

56
class MarkdownField extends StatefulWidget {
67
final String value;
@@ -78,6 +79,13 @@ class _MarkdownFieldState extends State<MarkdownField> {
7879
builder: (context, child) => MarkdownBody(
7980
data: _controller.text,
8081
onTapText: () => setState(() => _editMode = true),
82+
extensionSet: md.ExtensionSet(
83+
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
84+
[
85+
md.EmojiSyntax(),
86+
...md.ExtensionSet.gitHubFlavored.inlineSyntaxes
87+
],
88+
),
8189
onTapLink: (text, href, title) async {
8290
if (href != null && await canLaunchUrlString(href)) {
8391
launchUrlString(href);

app/lib/widgets/navigation.dart

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -162,36 +162,39 @@ class FlowNavigation extends StatelessWidget {
162162
: _NativeWindowArea(child: child)));
163163
}
164164

165-
return Row(
166-
textDirection: TextDirection.rtl,
167-
crossAxisAlignment: CrossAxisAlignment.stretch,
168-
children: [
169-
Expanded(
170-
child: Scaffold(
171-
appBar: appBar,
172-
drawer: isMobile
173-
? const Drawer(
174-
width: _drawerWidth,
175-
child: drawer,
176-
)
177-
: null,
178-
endDrawer: isMobile && endDrawer != null
179-
? Drawer(child: endDrawer)
180-
: null,
181-
body: Row(
182-
children: [
183-
Expanded(child: body),
184-
if (!isMobile && endDrawer != null)
185-
SizedBox(
186-
width: 250,
187-
child: endDrawer!,
188-
)
189-
],
165+
return GestureDetector(
166+
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
167+
child: Row(
168+
textDirection: TextDirection.rtl,
169+
crossAxisAlignment: CrossAxisAlignment.stretch,
170+
children: [
171+
Expanded(
172+
child: Scaffold(
173+
appBar: appBar,
174+
drawer: isMobile
175+
? const Drawer(
176+
width: _drawerWidth,
177+
child: drawer,
178+
)
179+
: null,
180+
endDrawer: isMobile && endDrawer != null
181+
? Drawer(child: endDrawer)
182+
: null,
183+
body: Row(
184+
children: [
185+
Expanded(child: body),
186+
if (!isMobile && endDrawer != null)
187+
SizedBox(
188+
width: 250,
189+
child: endDrawer!,
190+
)
191+
],
192+
),
193+
floatingActionButton: floatingActionButton,
190194
),
191-
floatingActionButton: floatingActionButton,
192195
),
193-
),
194-
].reversed.toList(),
196+
].reversed.toList(),
197+
),
195198
);
196199
});
197200
}

app/pubspec.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ packages:
181181
dependency: "direct main"
182182
description:
183183
name: connectivity_plus
184-
sha256: d73575bb66216738db892f72ba67dc478bd3b5490fbbcf43644b57645eabc822
184+
sha256: "5c7ad2d90aae958c230b27450044a29f5b0a69ea4b1792e17164b3a53de33e47"
185185
url: "https://pub.dev"
186186
source: hosted
187-
version: "3.0.4"
187+
version: "3.0.5"
188188
connectivity_plus_platform_interface:
189189
dependency: transitive
190190
description:
@@ -293,10 +293,10 @@ packages:
293293
dependency: "direct main"
294294
description:
295295
name: file_picker
296-
sha256: b85eb92b175767fdaa0c543bf3b0d1f610fe966412ea72845fe5ba7801e763ff
296+
sha256: e6c7ad8e572379df86ea64ef0a5395889fba3954411d47ca021b888d79f8e798
297297
url: "https://pub.dev"
298298
source: hosted
299-
version: "5.2.10"
299+
version: "5.2.11"
300300
fixnum:
301301
dependency: transitive
302302
description:
@@ -583,7 +583,7 @@ packages:
583583
source: hosted
584584
version: "1.1.1"
585585
markdown:
586-
dependency: transitive
586+
dependency: "direct main"
587587
description:
588588
name: markdown
589589
sha256: d95a9d12954aafc97f984ca29baaa7690ed4d9ec4140a23ad40580bcdb6c87f5
@@ -715,10 +715,10 @@ packages:
715715
dependency: transitive
716716
description:
717717
name: path_provider_windows
718-
sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130
718+
sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6
719719
url: "https://pub.dev"
720720
source: hosted
721-
version: "2.1.5"
721+
version: "2.1.6"
722722
petitparser:
723723
dependency: transitive
724724
description:
@@ -1207,10 +1207,10 @@ packages:
12071207
dependency: transitive
12081208
description:
12091209
name: win32
1210-
sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4
1210+
sha256: dd8f9344bc305ae2923e3d11a2a911d9a4e2c7dd6fe0ed10626d63211a69676e
12111211
url: "https://pub.dev"
12121212
source: hosted
1213-
version: "3.1.4"
1213+
version: "4.1.3"
12141214
window_manager:
12151215
dependency: "direct main"
12161216
description:

app/pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies:
4141
freezed_annotation: ^2.2.0
4242
json_annotation: ^4.8.0
4343
shared_preferences: ^2.1.0
44-
file_picker: ^5.2.10
44+
file_picker: ^5.2.11
4545
collection: ^1.17.1
4646
infinite_scroll_pagination: 4.0.0-dev.1
4747
window_manager: ^0.3.2
@@ -56,7 +56,7 @@ dependencies:
5656
simple_icons: ^7.10.0
5757
flutter_localized_locales: ^2.0.4
5858
xml: ^6.3.0
59-
connectivity_plus: ^3.0.4
59+
connectivity_plus: ^3.0.5
6060
rxdart: ^0.27.7
6161
flutter_secure_storage: ^8.0.0
6262
pubspec_parse: ^1.2.2
@@ -65,6 +65,7 @@ dependencies:
6565
url: https://github.com/s5-dev/lib5.git
6666
ref: 4b07c3ad5122654b0ad8ff3238bb0b2493a43fc4
6767
flutter_markdown: ^0.6.14
68+
markdown: ^7.0.2
6869
dev_dependencies:
6970
build_runner: ^2.3.3
7071
flutter_lints: ^2.0.1

0 commit comments

Comments
 (0)