Skip to content

Commit

Permalink
feat: use custom code block
Browse files Browse the repository at this point in the history
  • Loading branch information
PeronGH committed Feb 20, 2024
1 parent 3e70dc1 commit 210fcbf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
40 changes: 21 additions & 19 deletions lib/widgets/message_tile.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_highlighter/flutter_highlighter.dart';
import 'package:flutter_highlighter/themes/atom-one-dark.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
Expand Down Expand Up @@ -117,22 +118,14 @@ class MessageTile extends StatelessWidget {
inlineSyntaxList: [LatexSyntax()], generators: [latexGenerator]),
config: MarkdownConfig(configs: [
PreConfig(
margin: const EdgeInsets.all(0),
decoration: const BoxDecoration(
color: Color(0xff282c34),
borderRadius:
BorderRadius.vertical(bottom: Radius.circular(8.0))),
theme: atomOneDarkTheme,
textStyle: GoogleFonts.robotoMono(),
styleNotMatched: GoogleFonts.robotoMono(),
wrapper: (child, code, language) => Column(
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey[900],
borderRadius: const BorderRadius.vertical(
top: Radius.circular(8.0))),
child: Padding(
builder: (code, language) => Container(
decoration: BoxDecoration(
color: Colors.grey[900],
borderRadius: BorderRadius.circular(8)),
clipBehavior: Clip.antiAlias,
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand All @@ -148,9 +141,18 @@ class MessageTile extends StatelessWidget {
],
),
),
),
child
],
SizedBox(
width: double.infinity,
child: HighlightView(
code,
language: language,
theme: atomOneDarkTheme,
textStyle: GoogleFonts.robotoMono(),
tabSize: 4,
padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
))
],
),
),
),
CodeConfig(style: GoogleFonts.robotoMono()),
Expand Down
22 changes: 11 additions & 11 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -261,26 +261,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
sha256: cdd14e3836065a1f6302a236ec8b5f700695c803c57ae11a1c84df31e6bcf831
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.0.3"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
sha256: "9b2ef90589911d665277464e0482b209d39882dffaaf4ef69a3561a3354b2ebc"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.2"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
sha256: fd3cd66cb2bcd7b50dcd3b413af49d78051f809c8b3f6e047962765c15a0d23d
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.0"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -539,10 +539,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
tuple:
dependency: transitive
description:
Expand Down Expand Up @@ -675,10 +675,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
sha256: a2662fb1f114f4296cf3f5a50786a2d888268d7776cf681aa17d660ffa23b246
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.0.0"
web:
dependency: transitive
description:
Expand Down Expand Up @@ -713,4 +713,4 @@ packages:
version: "6.5.0"
sdks:
dart: ">=3.3.0-279.1.beta <4.0.0"
flutter: ">=3.16.0"
flutter: ">=3.18.0-18.0.pre.54"

0 comments on commit 210fcbf

Please sign in to comment.