From 66439d47be7e6e88d4480d2dae8efce82cdbc01f Mon Sep 17 00:00:00 2001 From: Jens Reinemuth Date: Mon, 7 Oct 2024 11:01:02 +0200 Subject: [PATCH] Namespacing --- lib/main.dart | 9 ----- lib/src/domain/entity/entities.dart | 11 +++++ lib/src/extensions/datetime_extensions.dart | 2 + lib/src/extensions/extensions.dart | 7 ++++ lib/src/extensions/i18n_extensions.dart | 7 ++++ lib/src/packages/ambito_api/base.dart | 3 +- lib/src/packages/ambito_db/base_db.dart | 3 +- lib/src/pages/actions/actions_page.dart | 1 + lib/src/pages/start/start_page.dart | 2 +- .../form/fields/field_daterangepicker.dart | 2 +- pubspec.lock | 40 +++++++++---------- pubspec.yaml | 2 +- 12 files changed, 53 insertions(+), 36 deletions(-) create mode 100644 lib/src/domain/entity/entities.dart create mode 100644 lib/src/extensions/extensions.dart create mode 100644 lib/src/extensions/i18n_extensions.dart diff --git a/lib/main.dart b/lib/main.dart index 1f8c7e3..1186768 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,9 +35,6 @@ void main() async { BaseApi().getContent('massnahmen'), ]); - //await BaseApi().getContent('baumarten'); - //await BaseApi().getContent('massnahmen'); - runApp(const Ambito()); } @@ -71,9 +68,3 @@ class Ambito extends StatelessWidget { ); } } - -extension ContextI18n on BuildContext { - translate(String key) { - return FlutterI18n.translate(this, key); - } -} diff --git a/lib/src/domain/entity/entities.dart b/lib/src/domain/entity/entities.dart new file mode 100644 index 0000000..cc84801 --- /dev/null +++ b/lib/src/domain/entity/entities.dart @@ -0,0 +1,11 @@ +library ambito_entities; + +export 'base_entity.dart'; +export 'baumarten/baumarten.dart'; +export 'file/file_part.dart'; +export 'file/thumbnail.dart'; +export 'file/thumbnails.dart'; +export 'id_value/id_value.dart'; +export 'id_value_color/id_value_color.dart'; +export 'id_value_mix/id_value_mix.dart'; +export 'massnahme/massnahme.dart'; diff --git a/lib/src/extensions/datetime_extensions.dart b/lib/src/extensions/datetime_extensions.dart index ae3a324..512177b 100644 --- a/lib/src/extensions/datetime_extensions.dart +++ b/lib/src/extensions/datetime_extensions.dart @@ -1,3 +1,5 @@ +part of 'extensions.dart'; + extension DateHelpers on DateTime { String nowString() { return DateTime.now().toUtc().toIso8601String(); diff --git a/lib/src/extensions/extensions.dart b/lib/src/extensions/extensions.dart new file mode 100644 index 0000000..ddee7ce --- /dev/null +++ b/lib/src/extensions/extensions.dart @@ -0,0 +1,7 @@ +library ambito_extensions; + +import 'package:flutter/material.dart'; +import 'package:flutter_i18n/flutter_i18n.dart'; + +part 'datetime_extensions.dart'; +part 'i18n_extensions.dart'; diff --git a/lib/src/extensions/i18n_extensions.dart b/lib/src/extensions/i18n_extensions.dart new file mode 100644 index 0000000..5fb7ea2 --- /dev/null +++ b/lib/src/extensions/i18n_extensions.dart @@ -0,0 +1,7 @@ +part of 'extensions.dart'; + +extension I18nExtensions on BuildContext { + translate(String key) { + return FlutterI18n.translate(this, key); + } +} diff --git a/lib/src/packages/ambito_api/base.dart b/lib/src/packages/ambito_api/base.dart index 01be017..29c08e7 100644 --- a/lib/src/packages/ambito_api/base.dart +++ b/lib/src/packages/ambito_api/base.dart @@ -1,11 +1,10 @@ import 'dart:convert'; -import 'package:ambito/src/domain/entity/massnahme/massnahme.dart'; +import 'package:ambito/src/domain/entity/entities.dart'; import 'package:ambito/src/packages/ambito_api/restclient.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart'; import '../../../main.dart'; -import '../../domain/entity/baumarten/baumarten.dart'; Map tables = { 'massnahmen': 328253, diff --git a/lib/src/packages/ambito_db/base_db.dart b/lib/src/packages/ambito_db/base_db.dart index 9d65c10..7451514 100644 --- a/lib/src/packages/ambito_db/base_db.dart +++ b/lib/src/packages/ambito_db/base_db.dart @@ -1,5 +1,4 @@ -import 'package:ambito/src/domain/entity/baumarten/baumarten.dart'; -import 'package:ambito/src/domain/entity/massnahme/massnahme.dart'; +import 'package:ambito/src/domain/entity/entities.dart'; import 'package:isar/isar.dart'; import '../../../main.dart'; diff --git a/lib/src/pages/actions/actions_page.dart b/lib/src/pages/actions/actions_page.dart index 015b7db..e78d424 100644 --- a/lib/src/pages/actions/actions_page.dart +++ b/lib/src/pages/actions/actions_page.dart @@ -1,5 +1,6 @@ import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart'; import 'package:ambito/src/domain/entity/massnahme/massnahme.dart'; +import 'package:ambito/src/extensions/extensions.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/widgets/form/fields/field_dropdown.dart'; import 'package:ambito/src/widgets/form/fields/field_monthsrangepicker.dart'; diff --git a/lib/src/pages/start/start_page.dart b/lib/src/pages/start/start_page.dart index cc34e26..031888b 100644 --- a/lib/src/pages/start/start_page.dart +++ b/lib/src/pages/start/start_page.dart @@ -1,4 +1,4 @@ -import 'package:ambito/main.dart'; +import 'package:ambito/src/extensions/extensions.dart'; import 'package:flutter/material.dart'; import '../actions/actions_page.dart'; diff --git a/lib/src/widgets/form/fields/field_daterangepicker.dart b/lib/src/widgets/form/fields/field_daterangepicker.dart index 9c71e99..961aac9 100644 --- a/lib/src/widgets/form/fields/field_daterangepicker.dart +++ b/lib/src/widgets/form/fields/field_daterangepicker.dart @@ -1,4 +1,4 @@ -import 'package:ambito/src/extensions/datetime_extensions.dart'; +import 'package:ambito/src/extensions/extensions.dart'; import 'package:ambito/src/widgets/form/form_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; diff --git a/pubspec.lock b/pubspec.lock index 6433d0e..3436775 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -90,10 +90,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: dd09dd4e2b078992f42aac7f1a622f01882a8492fef08486b27ddde929c19f04 + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" url: "https://pub.dev" source: hosted - version: "2.4.12" + version: "2.4.13" build_runner_core: dependency: transitive description: @@ -534,10 +534,10 @@ packages: dependency: transitive description: name: jovial_svg - sha256: "893dab3d9bbb8dd03e8225d457004950b9cf828d0009fd14c185cedacb96839c" + sha256: adbc985f89a9e9c601d29aebb9fc17dd0a5db05b67af7e6c21da91eeb13dacb7 url: "https://pub.dev" source: hosted - version: "1.1.22" + version: "1.1.23" js: dependency: transitive description: @@ -678,10 +678,10 @@ packages: dependency: transitive description: name: mime - sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "2.0.0" octo_image: dependency: transitive description: @@ -718,10 +718,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" + sha256: f7544c346a0742aee1450f9e5c0f5269d7c602b9c95fdbcd9fb8f5b1df13b1cc url: "https://pub.dev" source: hosted - version: "2.2.10" + version: "2.2.11" path_provider_foundation: dependency: transitive description: @@ -939,18 +939,18 @@ packages: dependency: transitive description: name: sqflite - sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d + sha256: ff5a2436ef8ebdfda748fbfe957f9981524cb5ff11e7bafa8c42771840e8a788 url: "https://pub.dev" source: hosted - version: "2.3.3+1" + version: "2.3.3+2" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "4058172e418eb7e7f2058dcb7657d451a8fc264afa0dea4dbd0f304a57131611" + sha256: "2d8e607db72e9cb7748c9c6e739e2c9618320a5517de693d5a24609c4671b1a4" url: "https://pub.dev" source: hosted - version: "2.5.4+3" + version: "2.5.4+4" stack_trace: dependency: transitive description: @@ -987,26 +987,26 @@ packages: dependency: transitive description: name: syncfusion_flutter_core - sha256: efbc44bdef33bf8f469c5ac7830df9631972721e157021db14bd78cdb1047fe1 + sha256: "95a53df168fd4473bbf23c481db656db97434d18d60f59fbeec97a754794f7b5" url: "https://pub.dev" source: hosted - version: "27.1.50" + version: "27.1.51" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: c54e0f4a56e713f68b4bdcac36f23c68cf35f3b0a02f0a9abb230c42ab64b3c6 + sha256: dcb9da082d2e39c84415a8323287a0714ffd349d5cf3bed93af1ad0b30b7dfd9 url: "https://pub.dev" source: hosted - version: "27.1.50" + version: "27.1.51" synchronized: dependency: transitive description: name: synchronized - sha256: "51b08572b9f091f8c3eb4d9d4be253f196ff0075d5ec9b10a884026d5b55d7bc" + sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" url: "https://pub.dev" source: hosted - version: "3.3.0+2" + version: "3.3.0+3" term_glyph: dependency: transitive description: @@ -1123,10 +1123,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.1.0" xml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2f2a701..5c8447d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: isar: version: 4.0.3 hosted: https://pub.isar-community.dev/ - isar_flutter_libs: # contains Isar Core + isar_flutter_libs: version: 4.0.3 hosted: https://pub.isar-community.dev/