Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move implementation to src dir #77

Merged
merged 6 commits into from Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions .github/workflows/code_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,9 @@ jobs:
- name: Get dependencies
run: flutter pub get

- name: Setup Dart Code Metrics
run: dart pub get dart_code_metrics

- name: Run Dart Code Metrics
run: |
dirs_to_analyze=""
if [ -d lib ]; then dirs_to_analyze+=" lib"; fi
if [ -d test ]; then dirs_to_analyze+=" test"; fi
if [ -d example ]; then dirs_to_analyze+=" example"; fi
if [ dirs_to_analyze != "" ]
then
dart run dart_code_metrics:metrics \
analyze \
$dirs_to_analyze \
--fatal-warnings \
--fatal-performance \
--fatal-style
fi
- name: Custom lint
run: dart run custom_lint

- name: Check formatting
run: dart format . --set-exit-if-changed

Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {
}

/// Example App main page
// ignore: prefer-match-file-name
// ignore: prefer_match_file_name
class App extends StatefulWidget {
/// Example app constructor
const App({super.key});
Expand Down
36 changes: 18 additions & 18 deletions lib/languagetool_textfield.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
library languagetool_textfield;

export 'client/language_tool_client.dart';
export 'core/controllers/language_tool_controller.dart';
export 'core/enums/delay_type.dart';
export 'core/model/category.dart';
export 'core/model/language_tool_raw.dart';
export 'core/model/match.dart';
export 'core/model/replacement.dart';
export 'core/model/rule.dart';
export 'domain/highlight_style.dart';
export 'domain/language_check_service.dart';
export 'domain/mistake.dart';
export 'domain/writing_mistake.dart';
export 'implementations/debounce_lang_tool_service.dart';
export 'implementations/lang_tool_service.dart';
export 'implementations/throttling_lang_tool_service.dart';
export 'presentation/language_tool_text_field.dart';
export 'utils/mistake_popup.dart';
export 'utils/popup_overlay_renderer.dart';
export 'src/client/language_tool_client.dart';
export 'src/core/controllers/language_tool_controller.dart';
export 'src/core/enums/delay_type.dart';
export 'src/core/model/category.dart';
export 'src/core/model/language_tool_raw.dart';
export 'src/core/model/match.dart';
export 'src/core/model/replacement.dart';
export 'src/core/model/rule.dart';
export 'src/domain/highlight_style.dart';
export 'src/domain/language_check_service.dart';
export 'src/domain/mistake.dart';
export 'src/domain/writing_mistake.dart';
export 'src/implementations/debounce_lang_tool_service.dart';
export 'src/implementations/lang_tool_service.dart';
export 'src/implementations/throttling_lang_tool_service.dart';
export 'src/presentation/language_tool_text_field.dart';
export 'src/utils/mistake_popup.dart';
export 'src/utils/popup_overlay_renderer.dart';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:convert';

import 'package:http/http.dart' as http;
import 'package:languagetool_textfield/core/model/language_tool_raw.dart';
import 'package:languagetool_textfield/domain/writing_mistake.dart';
import 'package:languagetool_textfield/src/core/model/language_tool_raw.dart';
import 'package:languagetool_textfield/src/domain/writing_mistake.dart';

/// Class to interact with the LanguageTool API.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import 'dart:math';
import 'package:collection/collection.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:languagetool_textfield/client/language_tool_client.dart';
import 'package:languagetool_textfield/core/enums/delay_type.dart';
import 'package:languagetool_textfield/core/enums/mistake_type.dart';
import 'package:languagetool_textfield/domain/highlight_style.dart';
import 'package:languagetool_textfield/domain/language_check_service.dart';
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/implementations/debounce_lang_tool_service.dart';
import 'package:languagetool_textfield/implementations/lang_tool_service.dart';
import 'package:languagetool_textfield/implementations/throttling_lang_tool_service.dart';
import 'package:languagetool_textfield/utils/closed_range.dart';
import 'package:languagetool_textfield/utils/keep_latest_response_service.dart';
import 'package:languagetool_textfield/utils/mistake_popup.dart';
import 'package:languagetool_textfield/src/client/language_tool_client.dart';
import 'package:languagetool_textfield/src/core/enums/delay_type.dart';
import 'package:languagetool_textfield/src/core/enums/mistake_type.dart';
import 'package:languagetool_textfield/src/domain/highlight_style.dart';
import 'package:languagetool_textfield/src/domain/language_check_service.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/implementations/debounce_lang_tool_service.dart';
import 'package:languagetool_textfield/src/implementations/lang_tool_service.dart';
import 'package:languagetool_textfield/src/implementations/throttling_lang_tool_service.dart';
import 'package:languagetool_textfield/src/utils/closed_range.dart';
import 'package:languagetool_textfield/src/utils/keep_latest_response_service.dart';
import 'package:languagetool_textfield/src/utils/mistake_popup.dart';

/// A TextEditingController with overrides buildTextSpan for building
/// marked TextSpans with tap recognizer
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/core/model/match.dart → lib/src/core/model/match.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:languagetool_textfield/core/model/replacement.dart';
import 'package:languagetool_textfield/core/model/rule.dart';
import 'package:languagetool_textfield/src/core/model/replacement.dart';
import 'package:languagetool_textfield/src/core/model/rule.dart';

/// Object that stores information about matched mistakes.
class Match {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/core/model/rule.dart → lib/src/core/model/rule.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:languagetool_textfield/core/enums/mistake_type.dart';
import 'package:languagetool_textfield/core/model/category.dart';
import 'package:languagetool_textfield/src/core/enums/mistake_type.dart';
import 'package:languagetool_textfield/src/core/model/category.dart';

/// Object that stores information about the rule (description, type, etc).
class Rule {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/utils/result.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/utils/result.dart';

/// A base language check service.
abstract class LanguageCheckService {
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/mistake.dart → lib/src/domain/mistake.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:languagetool_textfield/core/enums/mistake_type.dart';
import 'package:languagetool_textfield/src/core/enums/mistake_type.dart';

/// A data model class that stores information about a single writing mistake.
class Mistake {
Expand Down
6 changes: 3 additions & 3 deletions lib/domain/typedefs.dart → lib/src/domain/typedefs.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/widgets.dart';
import 'package:languagetool_textfield/core/controllers/language_tool_controller.dart';
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/utils/popup_overlay_renderer.dart';
import 'package:languagetool_textfield/src/core/controllers/language_tool_controller.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/utils/popup_overlay_renderer.dart';

/// Callback used to build popup body
typedef MistakeBuilderCallback = Widget Function({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:languagetool_textfield/core/enums/mistake_type.dart';
import 'package:languagetool_textfield/src/core/enums/mistake_type.dart';

/// Object that stores information about a single writing mistake.
class WritingMistake {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:languagetool_textfield/domain/language_check_service.dart';
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/utils/result.dart';
import 'package:languagetool_textfield/src/domain/language_check_service.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/utils/result.dart';
import 'package:throttling/throttling.dart';

/// A language check service with debouncing.
Expand All @@ -21,6 +21,7 @@ class DebounceLangToolService extends LanguageCheckService {
Future<Result<List<Mistake>>?> findMistakes(String text) async =>
await debouncing.debounce(() => baseService.findMistakes(text));

// ignore: proper_super_calls
@override
Future<void> dispose() async {
debouncing.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:languagetool_textfield/client/language_tool_client.dart';
import 'package:languagetool_textfield/domain/language_check_service.dart';
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/domain/writing_mistake.dart';
import 'package:languagetool_textfield/utils/result.dart';
import 'package:languagetool_textfield/src/client/language_tool_client.dart';
import 'package:languagetool_textfield/src/domain/language_check_service.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/domain/writing_mistake.dart';
import 'package:languagetool_textfield/src/utils/result.dart';

/// An implementation of language check service with language tool service.
class LangToolService extends LanguageCheckService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:languagetool_textfield/domain/language_check_service.dart';
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/utils/result.dart';
import 'package:languagetool_textfield/src/domain/language_check_service.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/utils/result.dart';
import 'package:throttling/throttling.dart';

/// A language check service with debouncing.
Expand All @@ -22,6 +22,7 @@ class ThrottlingLangToolService extends LanguageCheckService {
Future<Result<List<Mistake>>?> findMistakes(String text) async =>
throttling.throttle(() => baseService.findMistakes(text));

// ignore: proper_super_calls
@override
Future<void> dispose() async {
throttling.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:languagetool_textfield/core/controllers/language_tool_controller.dart';
import 'package:languagetool_textfield/utils/mistake_popup.dart';
import 'package:languagetool_textfield/utils/popup_overlay_renderer.dart';
import 'package:languagetool_textfield/src/core/controllers/language_tool_controller.dart';
import 'package:languagetool_textfield/src/utils/mistake_popup.dart';
import 'package:languagetool_textfield/src/utils/popup_overlay_renderer.dart';

/// A TextField widget that checks the grammar using the given
/// [LanguageToolController]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import 'dart:math';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:languagetool_textfield/core/controllers/language_tool_controller.dart';
import 'package:languagetool_textfield/core/langtool_images.dart';
import 'package:languagetool_textfield/domain/mistake.dart';
import 'package:languagetool_textfield/domain/typedefs.dart';
import 'package:languagetool_textfield/utils/extensions/string_extension.dart';
import 'package:languagetool_textfield/utils/popup_overlay_renderer.dart';
import 'package:languagetool_textfield/src/core/controllers/language_tool_controller.dart';
import 'package:languagetool_textfield/src/core/langtool_images.dart';
import 'package:languagetool_textfield/src/domain/mistake.dart';
import 'package:languagetool_textfield/src/domain/typedefs.dart';
import 'package:languagetool_textfield/src/utils/extensions/string_extension.dart';
import 'package:languagetool_textfield/src/utils/popup_overlay_renderer.dart';

/// Builder class that uses specified [popupRenderer] and [mistakeBuilder]
/// to create mistake popup
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
solid_lints: ^0.0.14
solid_lints: ^0.1.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs CI update.


flutter:
uses-material-design: true
Expand Down
Loading