diff --git a/.env b/.env index c6aa43c..efd2030 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ #DB -DB_VERSION=14 \ No newline at end of file +DB_VERSION=16 \ No newline at end of file diff --git a/assets/db/mova.db b/assets/db/mova.db index 5379f4e..f0590a0 100644 Binary files a/assets/db/mova.db and b/assets/db/mova.db differ diff --git a/ios/Podfile b/ios/Podfile deleted file mode 100644 index d97f17e..0000000 --- a/ios/Podfile +++ /dev/null @@ -1,44 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '12.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) - end -end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ff75f5f..d601865 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -31,6 +31,6 @@ SPEC CHECKSUMS: path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec -PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 +PODFILE CHECKSUM: 7be2f5f74864d463a8ad433546ed1de7e0f29aef COCOAPODS: 1.15.2 diff --git a/lib/main.dart b/lib/main.dart index 497cf64..9f1c401 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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), ); diff --git a/lib/screens/pravopys.dart b/lib/screens/pravopys.dart index 1ee3226..2073388 100644 --- a/lib/screens/pravopys.dart +++ b/lib/screens/pravopys.dart @@ -73,10 +73,8 @@ class _PravopysState extends State { } 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, diff --git a/lib/themes/markdown.dart b/lib/themes/markdown.dart index cac1beb..7d3684e 100644 --- a/lib/themes/markdown.dart +++ b/lib/themes/markdown.dart @@ -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, + ) + ); +} diff --git a/lib/themes/material.dart b/lib/themes/material.dart index 33386d3..b261c2e 100644 --- a/lib/themes/material.dart +++ b/lib/themes/material.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; const Color seedColor = Colors.white; @@ -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, + ), ) ); } @@ -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 @@ -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), + ); } } diff --git a/lib/utils/search.dart b/lib/utils/search.dart index 1c4e045..22a5283 100644 --- a/lib/utils/search.dart +++ b/lib/utils/search.dart @@ -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 + ), ), ]; } @@ -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 + ), ); } @@ -67,7 +73,7 @@ Widget emptySearchResults(BuildContext context) { searchNotFond, style: TextStyle( fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize, - color: Colors.grey, + color: Colors.red, ), ), ); diff --git a/lib/widgets/articles_list.dart b/lib/widgets/articles_list.dart index 1323202..d412e60 100644 --- a/lib/widgets/articles_list.dart +++ b/lib/widgets/articles_list.dart @@ -53,16 +53,21 @@ class _ArticlesListState extends State { 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) + ], ); }, ), diff --git a/lib/widgets/content_list.dart b/lib/widgets/content_list.dart index 5093a08..d75d0a6 100644 --- a/lib/widgets/content_list.dart +++ b/lib/widgets/content_list.dart @@ -24,52 +24,61 @@ class ContentList extends StatelessWidget { } return Container( - color: Colors.grey, - // decoration: const BoxDecoration( - // border: Border( - // top: BorderSide(color: Color.fromARGB(70, 150, 150, 150)))), + padding: const EdgeInsets.fromLTRB(16.0, 10.0, 16.0, 0), child: Container( - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), - child: Container( - padding: const EdgeInsets.all(16.0), - color: Colors.white, - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: content.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - openContent( - context, - content[index], - ); - }, - child: Container( - padding: const EdgeInsets.symmetric(vertical: 6.0), - decoration: const BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color.fromARGB(70, 150, 150, 150)))), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - children: [Text(content[index].numeration)], - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [Text(content[index].data)], - ), - ), - const Column( - children: [Icon(Icons.chevron_right)], + decoration: BoxDecoration( + //color: Theme.of(context).colorScheme.surfaceContainerLowest, + borderRadius: BorderRadius.circular(20), + ), + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: content.length, + itemBuilder: (context, index) { + Widget numeration = content[index].numeration.toString().isNotEmpty + ? Text(content[index].numeration, style: Theme.of(context).textTheme.titleLarge) + : Text('•', style: Theme.of(context).textTheme.titleLarge); + + return InkWell( + onTap: () { + openContent( + context, + content[index], + ); + }, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 12.0), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + //color: Color.fromARGB(70, 150, 150, 150) + color: Theme.of(context).colorScheme.outlineVariant, + ))), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + numeration, + const SizedBox(width: 25) + ], + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(content[index].data, + style: Theme.of(context).textTheme.titleLarge) + ], ), - ], - ), - )); - }, - ), + ), + const Column( + children: [Icon(Icons.chevron_right)], + ), + ], + ), + )); + }, ), ), ); diff --git a/lib/widgets/search.dart b/lib/widgets/search.dart index 3a5cfca..8b87479 100644 --- a/lib/widgets/search.dart +++ b/lib/widgets/search.dart @@ -1,40 +1,54 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mova/utils/search.dart'; import '../i18n/ua.dart'; -class Search extends StatelessWidget { +class Search extends StatefulWidget { const Search({super.key}); + @override + State createState() => _SearchTextFieldExampleState(); +} + +class _SearchTextFieldExampleState extends State { + late TextEditingController textController; + + @override + void initState() { + super.initState(); + textController = TextEditingController(text: ''); + } + + @override + void dispose() { + textController.dispose(); + super.dispose(); + } + + void routeToSearch(BuildContext context) { + FocusScope.of(context).unfocus(); + textController.clear(); + + } + + void searchAction(BuildContext context) { + search(context, textController.text); + textController.value = TextEditingValue.empty; + } + @override Widget build(BuildContext context) { - return SearchAnchor( - builder: (BuildContext context, SearchController controller) { - return SearchBar( - //onTap: controller.openView, - onTap: () => search(context, ''), - onChanged: (text) { - search(context, text); - controller.text = ""; - }, - controller: controller, - padding: const WidgetStatePropertyAll( - EdgeInsets.symmetric(horizontal: 16.0, vertical: 0)), - elevation: const WidgetStatePropertyAll(0.0), - backgroundColor: - const WidgetStatePropertyAll(Color.fromARGB(255, 240, 240, 240)), - shape: WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12.0), - )), - leading: const Icon(Icons.search), - hintText: searchHint, - textStyle: WidgetStatePropertyAll(TextStyle( - fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize)), - ); - }, - suggestionsBuilder: (BuildContext context, SearchController controller) => - {}, + FocusScope.of(context).unfocus(); + + return CupertinoSearchTextField( + autocorrect: false, + autofocus: false, + controller: textController, + placeholder: searchHint, + onChanged: (value) => searchAction(context), + onTap: () => searchAction(context), + onSuffixTap: () => textController.clear(), ); } -} +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 87931ad..f46ee54 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -130,10 +130,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: a23c41ee57573e62fc2190a1f36a0480c4d90bde3a8a8d7126e5d5992fb53fb7 + sha256: "255b00afa1a7bad19727da6a7780cf3db6c3c12e68d302d85e0ff1fdf173db9e" url: "https://pub.dev" source: hosted - version: "0.7.3+1" + version: "0.7.4+3" flutter_native_splash: dependency: "direct main" description: @@ -152,6 +152,14 @@ packages: description: flutter source: sdk version: "0.0.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 + url: "https://pub.dev" + source: hosted + version: "6.2.1" html: dependency: transitive description: @@ -160,6 +168,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.15.4" + http: + dependency: transitive + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" image: dependency: transitive description: @@ -429,6 +453,14 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.4" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 321fa21..9d7f0b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,9 +39,10 @@ dependencies: sqflite: ^2.3.2 path: ^1.9.0 logging: ^1.2.0 - flutter_markdown: ^0.7.3+1 flutter_dotenv: ^5.1.0 flutter_native_splash: ^2.4.0 + google_fonts: ^6.2.1 + flutter_markdown: ^0.7.4+3 dev_dependencies: flutter_test: