Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Yustas committed Jan 6, 2025
1 parent 13dedfd commit 823c4fe
Show file tree
Hide file tree
Showing 14 changed files with 235 additions and 177 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=14
DB_VERSION=16
Binary file modified assets/db/mova.db
Binary file not shown.
44 changes: 0 additions & 44 deletions ios/Podfile

This file was deleted.

2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ SPEC CHECKSUMS:
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
PODFILE CHECKSUM: 7be2f5f74864d463a8ad433546ed1de7e0f29aef

COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MovaApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
theme: themeLight(context),
darkTheme: MaterialTheme.dark(context),
darkTheme: themeDark(context),//MaterialTheme.dark(context),
themeMode: ThemeMode.system,
home: const Pravopys(content: homeContent, prevContent: null),
);
Expand Down
2 changes: 0 additions & 2 deletions lib/screens/pravopys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ class _PravopysState extends State<Pravopys> {
}

return Scaffold(
// backgroundColor: Theme.of(context).colorScheme.surface,
appBar: AppBar(
title: Text(appBarTitle),
titleTextStyle: Theme.of(context).textTheme.titleMedium,
centerTitle: false,
titleSpacing: 0,
actions: actions,
Expand Down
45 changes: 38 additions & 7 deletions lib/themes/markdown.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter/material.dart';

var stylesheet = MarkdownStyleSheet(
h1: ThemeData()
.textTheme
.titleLarge!
.copyWith(fontSize: 24, color: Colors.blue),
listIndent: 15.0,
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(
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(
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(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
)
);
}
80 changes: 43 additions & 37 deletions lib/themes/material.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

const Color seedColor = Colors.white;

Expand All @@ -11,13 +12,42 @@ ColorScheme lightColorScheme(context) {
);
}

ColorScheme darkColorScheme(context) {
return ColorScheme.fromSeed(
seedColor: seedColor,
brightness: Brightness.dark,
contrastLevel: 0,
dynamicSchemeVariant: DynamicSchemeVariant.neutral
);
}

ThemeData themeLight(BuildContext context) {
return ThemeData(
useMaterial3: true,
colorScheme: lightColorScheme(context),
textTheme: MaterialTheme.textTheme(lightColorScheme(context)),
appBarTheme: AppBarTheme(
backgroundColor: lightColorScheme(context).surface
backgroundColor: lightColorScheme(context).surface,
foregroundColor: lightColorScheme(context).onSurface,
actionsIconTheme: IconThemeData(
color: lightColorScheme(context).onSurface,
),
// iconTheme: Theme.of(context).primaryIconTheme.copyWith(color: Colors.green),
)
);
}

ThemeData themeDark(BuildContext context) {
return ThemeData(
useMaterial3: true,
colorScheme: darkColorScheme(context),
textTheme: MaterialTheme.textTheme(darkColorScheme(context)),
appBarTheme: AppBarTheme(
backgroundColor: darkColorScheme(context).surface,
foregroundColor: darkColorScheme(context).onSurface,
actionsIconTheme: IconThemeData(
color: darkColorScheme(context).onSurface,
),
)
);
}
Expand All @@ -26,7 +56,10 @@ class MaterialTheme {
static TextTheme textTheme(ColorScheme colorScheme) {
return ThemeData().textTheme.copyWith(
// AppTitle
titleLarge: ThemeData().textTheme.titleLarge!.copyWith(fontSize: 20),
titleLarge: ThemeData().textTheme.titleLarge!.copyWith(
fontSize: 20,
color: colorScheme.onSurface
),
// # Heading 1
headlineLarge: ThemeData()
.textTheme
Expand All @@ -38,41 +71,14 @@ class MaterialTheme {
),
headlineSmall:
ThemeData().textTheme.headlineSmall!.copyWith(fontSize: 24),
bodyMedium: ThemeData().textTheme.bodyMedium!.copyWith(
fontSize: 15,
),
bodySmall: ThemeData().textTheme.bodySmall!.copyWith(fontSize: 16));
}
// Tinos height: 1.3,

static ThemeData light(BuildContext context) {
return ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: seedColor,
brightness: Brightness.light,
contrastLevel: 1,
dynamicSchemeVariant: DynamicSchemeVariant.content,
),
textTheme: MaterialTheme.textTheme(lightColorScheme(context)),
// scaffoldBackgroundColor: const Color(0xFF931010),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.white
));
}

static ThemeData dark(BuildContext context) {
return ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: seedColor,
brightness: Brightness.dark,
contrastLevel: -1,
dynamicSchemeVariant: DynamicSchemeVariant.content,
),
textTheme: MaterialTheme.textTheme(lightColorScheme(context)),
// scaffoldBackgroundColor: const Color(0xFF931010),
appBarTheme: const AppBarTheme(
// backgroundColor: Colors.amber
));
bodyMedium: GoogleFonts.roboto(textStyle: ThemeData().textTheme.bodyMedium!.copyWith(
fontSize: 18,
color: colorScheme.onSurfaceVariant,
// height: 1.3,
)),
bodySmall: ThemeData().textTheme.bodySmall!.copyWith(fontSize: 15),
);
}
}
8 changes: 7 additions & 1 deletion lib/utils/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class ContentSearchDelegate extends SearchDelegate {
IconButton(
icon: const Icon(Icons.clear),
onPressed: () => query.isEmpty ? close(context, null) : query = '',
style: IconButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.onSurface
),
),
];
}
Expand All @@ -25,6 +28,9 @@ class ContentSearchDelegate extends SearchDelegate {
return IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => close(context, null),
style: IconButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.onSurface
),
);
}

Expand Down Expand Up @@ -67,7 +73,7 @@ Widget emptySearchResults(BuildContext context) {
searchNotFond,
style: TextStyle(
fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize,
color: Colors.grey,
color: Colors.red,
),
),
);
Expand Down
19 changes: 12 additions & 7 deletions lib/widgets/articles_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,21 @@ class _ArticlesListState extends State<ArticlesList> {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: ListView.builder(
controller: _scrollController,
//controller: _scrollController,
scrollDirection: Axis.vertical,
itemCount: widget.articles.length,
itemBuilder: (context, index) {
return MarkdownBody(
data: widget.articles[index].body,
onTapLink: (text, url, title) {
openContent(context, text);
},
styleSheet: stylesheet,
return Column(
children: [
MarkdownBody(
data: widget.articles[index].body,
onTapLink: (text, url, title) {
openContent(context, text);
},
styleSheet: stylesheet(context),
),
const SizedBox(height: 10)
],
);
},
),
Expand Down
Loading

0 comments on commit 823c4fe

Please sign in to comment.