Skip to content

Commit

Permalink
Add markdown emoji support
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Apr 26, 2023
1 parent 023ef0c commit f84921c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 39 deletions.
34 changes: 34 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Install Operating system and dependencies
FROM ubuntu:22.04 AS builder

RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3
RUN apt-get clean

RUN mkdir /app/
COPY . /app
WORKDIR /app
# download Flutter SDK from Flutter Github repo
RUN git clone https://github.com/flutter/flutter.git -b $(cat /FLUTTER_VERSION) /usr/local/flutter

# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor

RUN flutter config --enable-web

# Copy files to container and build
RUN flutter build web

FROM python:3

RUN mkdir /app/
# Copy build/web in container to /app/
COPY --from=builder ./build/web /app/
WORKDIR /app/

# Record the exposed port
EXPOSE 5000

CMD python -m http.server 5000
8 changes: 8 additions & 0 deletions app/lib/widgets/markdown_field.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:markdown/markdown.dart' as md;

class MarkdownField extends StatefulWidget {
final String value;
Expand Down Expand Up @@ -78,6 +79,13 @@ class _MarkdownFieldState extends State<MarkdownField> {
builder: (context, child) => MarkdownBody(
data: _controller.text,
onTapText: () => setState(() => _editMode = true),
extensionSet: md.ExtensionSet(
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
[
md.EmojiSyntax(),
...md.ExtensionSet.gitHubFlavored.inlineSyntaxes
],
),
onTapLink: (text, href, title) async {
if (href != null && await canLaunchUrlString(href)) {
launchUrlString(href);
Expand Down
59 changes: 31 additions & 28 deletions app/lib/widgets/navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,36 +162,39 @@ class FlowNavigation extends StatelessWidget {
: _NativeWindowArea(child: child)));
}

return Row(
textDirection: TextDirection.rtl,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Scaffold(
appBar: appBar,
drawer: isMobile
? const Drawer(
width: _drawerWidth,
child: drawer,
)
: null,
endDrawer: isMobile && endDrawer != null
? Drawer(child: endDrawer)
: null,
body: Row(
children: [
Expanded(child: body),
if (!isMobile && endDrawer != null)
SizedBox(
width: 250,
child: endDrawer!,
)
],
return GestureDetector(
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
child: Row(
textDirection: TextDirection.rtl,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Scaffold(
appBar: appBar,
drawer: isMobile
? const Drawer(
width: _drawerWidth,
child: drawer,
)
: null,
endDrawer: isMobile && endDrawer != null
? Drawer(child: endDrawer)
: null,
body: Row(
children: [
Expanded(child: body),
if (!isMobile && endDrawer != null)
SizedBox(
width: 250,
child: endDrawer!,
)
],
),
floatingActionButton: floatingActionButton,
),
floatingActionButton: floatingActionButton,
),
),
].reversed.toList(),
].reversed.toList(),
),
);
});
}
Expand Down
18 changes: 9 additions & 9 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ packages:
dependency: "direct main"
description:
name: connectivity_plus
sha256: d73575bb66216738db892f72ba67dc478bd3b5490fbbcf43644b57645eabc822
sha256: "5c7ad2d90aae958c230b27450044a29f5b0a69ea4b1792e17164b3a53de33e47"
url: "https://pub.dev"
source: hosted
version: "3.0.4"
version: "3.0.5"
connectivity_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -293,10 +293,10 @@ packages:
dependency: "direct main"
description:
name: file_picker
sha256: b85eb92b175767fdaa0c543bf3b0d1f610fe966412ea72845fe5ba7801e763ff
sha256: e6c7ad8e572379df86ea64ef0a5395889fba3954411d47ca021b888d79f8e798
url: "https://pub.dev"
source: hosted
version: "5.2.10"
version: "5.2.11"
fixnum:
dependency: transitive
description:
Expand Down Expand Up @@ -583,7 +583,7 @@ packages:
source: hosted
version: "1.1.1"
markdown:
dependency: transitive
dependency: "direct main"
description:
name: markdown
sha256: d95a9d12954aafc97f984ca29baaa7690ed4d9ec4140a23ad40580bcdb6c87f5
Expand Down Expand Up @@ -715,10 +715,10 @@ packages:
dependency: transitive
description:
name: path_provider_windows
sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130
sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6
url: "https://pub.dev"
source: hosted
version: "2.1.5"
version: "2.1.6"
petitparser:
dependency: transitive
description:
Expand Down Expand Up @@ -1207,10 +1207,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4
sha256: dd8f9344bc305ae2923e3d11a2a911d9a4e2c7dd6fe0ed10626d63211a69676e
url: "https://pub.dev"
source: hosted
version: "3.1.4"
version: "4.1.3"
window_manager:
dependency: "direct main"
description:
Expand Down
5 changes: 3 additions & 2 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies:
freezed_annotation: ^2.2.0
json_annotation: ^4.8.0
shared_preferences: ^2.1.0
file_picker: ^5.2.10
file_picker: ^5.2.11
collection: ^1.17.1
infinite_scroll_pagination: 4.0.0-dev.1
window_manager: ^0.3.2
Expand All @@ -56,7 +56,7 @@ dependencies:
simple_icons: ^7.10.0
flutter_localized_locales: ^2.0.4
xml: ^6.3.0
connectivity_plus: ^3.0.4
connectivity_plus: ^3.0.5
rxdart: ^0.27.7
flutter_secure_storage: ^8.0.0
pubspec_parse: ^1.2.2
Expand All @@ -65,6 +65,7 @@ dependencies:
url: https://github.com/s5-dev/lib5.git
ref: 4b07c3ad5122654b0ad8ff3238bb0b2493a43fc4
flutter_markdown: ^0.6.14
markdown: ^7.0.2
dev_dependencies:
build_runner: ^2.3.3
flutter_lints: ^2.0.1
Expand Down

0 comments on commit f84921c

Please sign in to comment.