Skip to content

Commit

Permalink
DB update and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Yustas committed Jan 11, 2025
1 parent 30d73e7 commit a679de2
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#DB
DB_VERSION=16
DB_VERSION=73
Binary file modified assets/db/mova.db
Binary file not shown.
13 changes: 10 additions & 3 deletions lib/models/article.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ class Article {
/// Returns parsed article body
get body {
String body = data;
RegExp exp = RegExp(r'(§( ?)+\d+)');
Iterable<RegExpMatch> links = exp.allMatches(data);
RegExp contentLink = RegExp(r'(§( ?)+\d+)');
Iterable<RegExpMatch> links = contentLink.allMatches(data);
for (final m in links) {
String link = m[0]!.replaceAll(' ', '');
body = data.replaceAll(m[0] as Pattern, '[$link]($link)');
body = body.replaceAll(m[0] as Pattern, '[$link]($link)');
}

RegExp note = RegExp(r'(\*\*Примітка( \d)?\*\*.)');
Iterable<RegExpMatch> notes = note.allMatches(data);
for (final m in notes) {
body = body.replaceAll(m[0] as Pattern, '');
}

return body;
}
}
84 changes: 60 additions & 24 deletions lib/themes/markdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,76 @@ import 'package:flutter/material.dart';

stylesheet(BuildContext context) {
return MarkdownStyleSheet(
h1: ThemeData()
.textTheme
.titleLarge!
.copyWith(fontSize: 24, color: Colors.blue),
listIndent: 25.0,
//p: ThemeData().textTheme.bodyMedium!.copyWith(),
// pPadding: const EdgeInsets.only(bottom: 15),
blockquote: ThemeData().textTheme.titleLarge!.copyWith(fontSize: 34),
blockquotePadding: const EdgeInsets.all(15),
blockquoteDecoration: BoxDecoration(
h1: ThemeData()
.textTheme
.titleLarge!
.copyWith(fontSize: 24, color: Colors.blue),
h6: ThemeData().textTheme.bodyLarge!.copyWith(),
h6Padding: EdgeInsets.all(0),
h6Align: WrapAlignment.start,
// horizontalRuleDecoration: ShapeDecoration(
// shape: LinearBorder(
//
// ),
// color: Colors.red,
p: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.onSurface,
),
strong: Theme.of(context).textTheme.bodyMedium!.copyWith(
fontSize: 20,
fontWeight: FontWeight.w600,
),
em: Theme.of(context).textTheme.bodyMedium!.copyWith(
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w100,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
code: Theme.of(context)
.textTheme
.bodyLarge!
.copyWith(overflow: TextOverflow.fade),
codeblockPadding: EdgeInsets.all(10),
codeblockAlign: WrapAlignment.end,
codeblockDecoration: BoxDecoration(
border: Border(
left: BorderSide(
color: Theme.of(context).colorScheme.surfaceContainer,
width: 3))),
//listIndent: 0,
orderedListAlign: WrapAlignment.start,
//p: ThemeData().textTheme.bodyMedium!.copyWith(),
// pPadding: const EdgeInsets.only(bottom: 15),
// blockquote: ThemeData().textTheme.bodyMedium!.copyWith(
// // Doesn't applied
// // See: https://github.com/flutter/flutter/issues/81720
// //
// ),
blockquotePadding: const EdgeInsets.all(15),
blockquoteDecoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(20.0),
// border: Border(
// bottom: BorderSide(color: Theme.of(context).colorScheme.shadow),
// right: BorderSide(color: Theme.of(context).colorScheme.shadow)
// )
),
tableBorder: TableBorder(
),
tableBorder: TableBorder(
verticalInside: BorderSide(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
width: 1,
),
),
tableCellsPadding: const EdgeInsets.fromLTRB(10, 5, 5, 5),
tableHead: TextStyle(
fontSize: Theme.of(context).textTheme.bodySmall!.fontSize,

),
tableBody: TextStyle(
fontSize: Theme.of(context).textTheme.bodySmall!.fontSize,
),
tableColumnWidth: IntrinsicColumnWidth(),
tableCellsDecoration: BoxDecoration(
),
tableCellsPadding: const EdgeInsets.fromLTRB(10, 5, 5, 5),
tableHead: TextStyle(
fontSize: Theme.of(context).textTheme.bodySmall!.fontSize,
),
tableBody: TextStyle(
fontSize: Theme.of(context).textTheme.bodySmall!.fontSize,
),
tableColumnWidth: IntrinsicColumnWidth(),
tableCellsDecoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
)
),
textAlign: WrapAlignment.start
);
}
9 changes: 8 additions & 1 deletion lib/themes/material.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,18 @@ class MaterialTheme {
headlineSmall:
ThemeData().textTheme.headlineSmall!.copyWith(fontSize: 24),

bodyLarge: GoogleFonts.roboto(textStyle: ThemeData().textTheme.bodyMedium!.copyWith(
fontSize: 18,
color: colorScheme.onSurfaceVariant,
)),
bodyMedium: GoogleFonts.roboto(textStyle: ThemeData().textTheme.bodyMedium!.copyWith(
fontSize: 18,
color: colorScheme.onSurfaceVariant,
)),
bodySmall: ThemeData().textTheme.bodySmall!.copyWith(fontSize: 15),
bodySmall: GoogleFonts.lato(textStyle: ThemeData().textTheme.bodyMedium!.copyWith(
fontSize: 18,
color: colorScheme.onSurfaceVariant,
)),
);
}
}
1 change: 1 addition & 0 deletions lib/widgets/articles_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ArticlesList extends StatelessWidget {
itemCount: articles.length,
itemBuilder: (context, index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MarkdownBody(
data: articles[index].body,
Expand Down

0 comments on commit a679de2

Please sign in to comment.