initial commit v2

This commit is contained in:
reinjens 2024-09-18 15:07:08 +02:00
parent 5ce7dcd277
commit 7ed4d3b23a
51 changed files with 26680 additions and 211 deletions

33
assets/i18n/de.json Normal file
View file

@ -0,0 +1,33 @@
{
"page": {
"start": {
"title": "AmBiTo Toolkit",
"links": {
"start": {
"title": "Start"
},
"database": {
"title": "Datenbank"
},
"designer": {
"title": "Designer"
},
"service": {
"title": "Beratung"
},
"network": {
"title": "Netzwerk"
},
"contact": {
"title": "Kontakt"
}
}
},
"actions": {
"title": "Recherchieren Sie in allen Biodiversitätsmaßnahmen",
"intro": "In dieser Datenbank finden Sie die Maßnahmen, die zu Ihrem Betrieb und Ihrer Region passen."
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 KiB

BIN
assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,125 +1,163 @@
import 'package:ambito/src/domain/entity/baumarten/baumarten.dart';
import 'package:ambito/src/domain/entity/massnahme/massnahme.dart';
import 'package:ambito/src/packages/ambito_api/base.dart';
import 'package:ambito/src/pages/actions/actions_page.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:isar/isar.dart';
import 'package:logger/logger.dart';
void main() {
runApp(const MyApp());
final String AmbitoToken = 'TFxO7vzBLVRCu9I3VMoHmTuCvSu8aCDi';
final Logger logger = Logger(
printer: PrettyPrinter(),
);
late Isar isar;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
/*Isar.open(
schemas: [BaumartenSchema, IdValueColorSchema, IdValueSchema],
directory: '',
);*/
await Isar.initialize();
const dir = Isar.sqliteInMemory;
const engine = kIsWeb ? IsarEngine.sqlite : IsarEngine.isar;
isar = Isar.open(
schemas: [BaumartenSchema, MassnahmeSchema],
directory: dir,
engine: engine,
inspector: true,
);
Future.wait([
BaseApi().getContent('baumarten'),
BaseApi().getContent('massnahmen'),
]);
//await BaseApi().getContent('baumarten');
//await BaseApi().getContent('massnahmen');
runApp(const Ambito());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
class Ambito extends StatelessWidget {
const Ambito({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
return GetMaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: [
FlutterI18nDelegate(
translationLoader: FileTranslationLoader(
fallbackFile: 'de',
basePath: 'i18n',
),
missingTranslationHandler: (key, locale) {
print("--- Missing Key: $key, languageCode: $locale");
},
),
],
title: 'Flutter Demo',
locale: const Locale('de'),
builder: FlutterI18n.rootAppBuilder(),
theme: ThemeData(
// This is the theme of your application.
//
// TRY THIS: Try running your application with "flutter run". You'll see
// the application has a purple toolbar. Then, without quitting the app,
// try changing the seedColor in the colorScheme below to Colors.green
// and then invoke "hot reload" (save your changes or press the "hot
// reload" button in a Flutter-supported IDE, or press "r" if you used
// the command line to start the app).
//
// Notice that the counter didn't reset back to zero; the application
// state is not lost during the reload. To reset the state, use hot
// restart instead.
//
// This works for code too, not just values: Most code changes can be
// tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
scaffoldBackgroundColor: Colors.white,
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
String activeLink = '';
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
@override
void initState() {
activeLink = 'start';
super.initState();
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
double fontSize = 16;
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
//
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
// action in the IDE, or press "p" in the console), to see the
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
body: Column(
children: [
SizedBox(height: 50),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
LinkButton('start'),
LinkButton('database'),
LinkButton('designer'),
Image.asset(
'images/logo.png',
scale: 1.3,
),
LinkButton('service'),
LinkButton('network'),
LinkButton('contact'),
],
),
SizedBox(height: 50),
Expanded(
child: getContent(),
),
],
));
}
Widget getContent() {
if (activeLink == 'database') {
return ActionsPage();
}
return Text(activeLink);
}
Widget LinkButton(String link) {
double fontSize = 16;
return TextButton(
style: ButtonStyle(
overlayColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
return Colors.white;
}),
),
onPressed: () {
setState(() {
activeLink = link;
});
},
child: Text(
context.translate('page.start.links.$link.title'),
style: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
color: (activeLink == link)
? Colors.grey.shade400
: Colors.grey.shade800,
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
extension ContextI18n on BuildContext {
translate(String key) {
return FlutterI18n.translate(this, key);
}
}

View file

@ -0,0 +1 @@
class BaseEntity {}

View file

@ -0,0 +1,78 @@
import 'package:ambito/src/domain/entity/id_value/id_value.dart';
import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
import '../base_entity.dart';
part 'baumarten.g.dart';
@JsonSerializable(explicitToJson: true)
@collection
class Baumarten extends BaseEntity {
Baumarten();
late int id;
@JsonKey(name: 'order')
String? orderString;
@JsonKey(name: 'Art')
String? art;
@JsonKey(name: 'id 2')
String? id2;
@JsonKey(name: 'dt. Name')
String? name;
@JsonKey(name: 'Höhemin')
String? minSize;
@JsonKey(name: 'Höhemax')
String? maxSize;
@JsonKey(name: 'Lebensform')
List<IdValueColor>? lebensform;
@JsonKey(name: 'Wuchs/Krone')
List<IdValueColor>? growth;
@JsonKey(name: 'KLIMA')
List<IdValueColor>? climate;
@JsonKey(name: 'Risiko Kirschessigfliege')
IdValueColor? riskCherryVinegarFly;
@JsonKey(name: 'Wärmeliebend/mild')
IdValueColor? thermophilic;
@JsonKey(name: 'Frosthart')
IdValueColor? frost;
@JsonKey(name: 'Spätfrost')
IdValueColor? latefrost;
@JsonKey(name: 'Dürre')
IdValueColor? drought;
@JsonKey(name: 'Bodenwasser')
String? waterlevel;
@JsonKey(name: 'Bodenfeuchte')
List<IdValueColor>? humidity;
String? Lichtzahl;
String? Temperaturzahl;
String? Feuchtezahl;
String? Reaktionszahl;
String? Stickstoffzahl;
List<IdValueColor>? Region;
String? Anmerkung;
@JsonKey(name: "Wild/Kulturart")
String? typeOfCulture;
@JsonKey(name: 'Gebiet 1')
String? region1;
@JsonKey(name: 'Gebiet 2')
String? region2;
@JsonKey(name: 'Gebiet 3')
String? region3;
@JsonKey(name: 'Gebiet 4')
String? region4;
@JsonKey(name: 'Gebiet 5')
String? region5;
@JsonKey(name: 'Gebiet 6')
String? region6;
@JsonKey(name: '00 Maßnahmen_Main')
List<IdValue>? actions;
@JsonKey(name: 'Heimisch')
bool? local;
factory Baumarten.fromJson(Map<String, dynamic> json) =>
_$BaumartenFromJson(json);
Map<String, dynamic> toJson() => _$BaumartenToJson(this);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
import 'package:ambito/src/domain/entity/file/thumbnails.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'file_part.g.dart';
@JsonSerializable(explicitToJson: true)
@embedded
class FilePart {
FilePart();
String? url;
Thumbnails? thumbnails;
String? visible_name;
String? name;
int? size;
String? mime_type;
bool? is_image;
int? image_width;
int? image_height;
String? uploaded_at;
factory FilePart.fromJson(Map<String, dynamic> json) =>
_$FilePartFromJson(json);
Map<String, dynamic> toJson() => _$FilePartToJson(this);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'thumbnail.g.dart';
@JsonSerializable(explicitToJson: true)
@embedded
class Thumbnail {
Thumbnail();
String? url;
int? width;
int? height;
factory Thumbnail.fromJson(Map<String, dynamic> json) =>
_$ThumbnailFromJson(json);
Map<String, dynamic> toJson() => _$ThumbnailToJson(this);
}

View file

@ -0,0 +1,470 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'thumbnail.dart';
// **************************************************************************
// _IsarEmbeddedGenerator
// **************************************************************************
// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint
const ThumbnailSchema = IsarGeneratedSchema(
schema: IsarSchema(
name: 'Thumbnail',
embedded: true,
properties: [
IsarPropertySchema(
name: 'url',
type: IsarType.string,
),
IsarPropertySchema(
name: 'width',
type: IsarType.long,
),
IsarPropertySchema(
name: 'height',
type: IsarType.long,
),
],
indexes: [],
),
converter: IsarObjectConverter<void, Thumbnail>(
serialize: serializeThumbnail,
deserialize: deserializeThumbnail,
),
);
@isarProtected
int serializeThumbnail(IsarWriter writer, Thumbnail object) {
{
final value = object.url;
if (value == null) {
IsarCore.writeNull(writer, 1);
} else {
IsarCore.writeString(writer, 1, value);
}
}
IsarCore.writeLong(writer, 2, object.width ?? -9223372036854775808);
IsarCore.writeLong(writer, 3, object.height ?? -9223372036854775808);
return 0;
}
@isarProtected
Thumbnail deserializeThumbnail(IsarReader reader) {
final object = Thumbnail();
object.url = IsarCore.readString(reader, 1);
{
final value = IsarCore.readLong(reader, 2);
if (value == -9223372036854775808) {
object.width = null;
} else {
object.width = value;
}
}
{
final value = IsarCore.readLong(reader, 3);
if (value == -9223372036854775808) {
object.height = null;
} else {
object.height = value;
}
}
return object;
}
extension ThumbnailQueryFilter
on QueryBuilder<Thumbnail, Thumbnail, QFilterCondition> {
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlGreaterThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition>
urlGreaterThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlLessThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition>
urlLessThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlBetween(
String? lower,
String? upper, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 1,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlContains(
String value,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 1,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlMatches(
String pattern,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 1,
wildcard: pattern,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 1,
value: '',
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> urlIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 1,
value: '',
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> widthIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> widthIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> widthEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 2,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> widthGreaterThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 2,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition>
widthGreaterThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 2,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> widthLessThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 2,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition>
widthLessThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 2,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> widthBetween(
int? lower,
int? upper,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 2,
lower: lower,
upper: upper,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> heightIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 3));
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> heightIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 3));
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> heightEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 3,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> heightGreaterThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 3,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition>
heightGreaterThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 3,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> heightLessThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 3,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition>
heightLessThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 3,
value: value,
),
);
});
}
QueryBuilder<Thumbnail, Thumbnail, QAfterFilterCondition> heightBetween(
int? lower,
int? upper,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 3,
lower: lower,
upper: upper,
),
);
});
}
}
extension ThumbnailQueryObject
on QueryBuilder<Thumbnail, Thumbnail, QFilterCondition> {}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Thumbnail _$ThumbnailFromJson(Map<String, dynamic> json) => Thumbnail()
..url = json['url'] as String?
..width = (json['width'] as num?)?.toInt()
..height = (json['height'] as num?)?.toInt();
Map<String, dynamic> _$ThumbnailToJson(Thumbnail instance) => <String, dynamic>{
'url': instance.url,
'width': instance.width,
'height': instance.height,
};

View file

@ -0,0 +1,20 @@
import 'package:ambito/src/domain/entity/file/thumbnail.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'thumbnails.g.dart';
@JsonSerializable(explicitToJson: true)
@embedded
class Thumbnails {
Thumbnails();
Thumbnail? tiny;
Thumbnail? small;
Thumbnail? card_cover;
factory Thumbnails.fromJson(Map<String, dynamic> json) =>
_$ThumbnailsFromJson(json);
Map<String, dynamic> toJson() => _$ThumbnailsToJson(this);
}

View file

@ -0,0 +1,198 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'thumbnails.dart';
// **************************************************************************
// _IsarEmbeddedGenerator
// **************************************************************************
// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint
const ThumbnailsSchema = IsarGeneratedSchema(
schema: IsarSchema(
name: 'Thumbnails',
embedded: true,
properties: [
IsarPropertySchema(
name: 'tiny',
type: IsarType.object,
target: 'Thumbnail',
),
IsarPropertySchema(
name: 'small',
type: IsarType.object,
target: 'Thumbnail',
),
IsarPropertySchema(
name: 'card_cover',
type: IsarType.object,
target: 'Thumbnail',
),
],
indexes: [],
),
converter: IsarObjectConverter<void, Thumbnails>(
serialize: serializeThumbnails,
deserialize: deserializeThumbnails,
),
);
@isarProtected
int serializeThumbnails(IsarWriter writer, Thumbnails object) {
{
final value = object.tiny;
if (value == null) {
IsarCore.writeNull(writer, 1);
} else {
final objectWriter = IsarCore.beginObject(writer, 1);
serializeThumbnail(objectWriter, value);
IsarCore.endObject(writer, objectWriter);
}
}
{
final value = object.small;
if (value == null) {
IsarCore.writeNull(writer, 2);
} else {
final objectWriter = IsarCore.beginObject(writer, 2);
serializeThumbnail(objectWriter, value);
IsarCore.endObject(writer, objectWriter);
}
}
{
final value = object.card_cover;
if (value == null) {
IsarCore.writeNull(writer, 3);
} else {
final objectWriter = IsarCore.beginObject(writer, 3);
serializeThumbnail(objectWriter, value);
IsarCore.endObject(writer, objectWriter);
}
}
return 0;
}
@isarProtected
Thumbnails deserializeThumbnails(IsarReader reader) {
final object = Thumbnails();
{
final objectReader = IsarCore.readObject(reader, 1);
if (objectReader.isNull) {
object.tiny = null;
} else {
final embedded = deserializeThumbnail(objectReader);
IsarCore.freeReader(objectReader);
object.tiny = embedded;
}
}
{
final objectReader = IsarCore.readObject(reader, 2);
if (objectReader.isNull) {
object.small = null;
} else {
final embedded = deserializeThumbnail(objectReader);
IsarCore.freeReader(objectReader);
object.small = embedded;
}
}
{
final objectReader = IsarCore.readObject(reader, 3);
if (objectReader.isNull) {
object.card_cover = null;
} else {
final embedded = deserializeThumbnail(objectReader);
IsarCore.freeReader(objectReader);
object.card_cover = embedded;
}
}
return object;
}
extension ThumbnailsQueryFilter
on QueryBuilder<Thumbnails, Thumbnails, QFilterCondition> {
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> tinyIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> tinyIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> smallIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> smallIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition>
card_coverIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 3));
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition>
card_coverIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 3));
});
}
}
extension ThumbnailsQueryObject
on QueryBuilder<Thumbnails, Thumbnails, QFilterCondition> {
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> tiny(
FilterQuery<Thumbnail> q) {
return QueryBuilder.apply(this, (query) {
return query.object(q, 1);
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> small(
FilterQuery<Thumbnail> q) {
return QueryBuilder.apply(this, (query) {
return query.object(q, 2);
});
}
QueryBuilder<Thumbnails, Thumbnails, QAfterFilterCondition> card_cover(
FilterQuery<Thumbnail> q) {
return QueryBuilder.apply(this, (query) {
return query.object(q, 3);
});
}
}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Thumbnails _$ThumbnailsFromJson(Map<String, dynamic> json) => Thumbnails()
..tiny = json['tiny'] == null
? null
: Thumbnail.fromJson(json['tiny'] as Map<String, dynamic>)
..small = json['small'] == null
? null
: Thumbnail.fromJson(json['small'] as Map<String, dynamic>)
..card_cover = json['card_cover'] == null
? null
: Thumbnail.fromJson(json['card_cover'] as Map<String, dynamic>);
Map<String, dynamic> _$ThumbnailsToJson(Thumbnails instance) =>
<String, dynamic>{
'tiny': instance.tiny?.toJson(),
'small': instance.small?.toJson(),
'card_cover': instance.card_cover?.toJson(),
};

View file

@ -0,0 +1,18 @@
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'id_value.g.dart';
@JsonSerializable(explicitToJson: true)
@embedded
class IdValue {
IdValue();
int? id;
String? value;
factory IdValue.fromJson(Map<String, dynamic> json) =>
_$IdValueFromJson(json);
Map<String, dynamic> toJson() => _$IdValueToJson(this);
}

View file

@ -0,0 +1,358 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'id_value.dart';
// **************************************************************************
// _IsarEmbeddedGenerator
// **************************************************************************
// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint
const IdValueSchema = IsarGeneratedSchema(
schema: IsarSchema(
name: 'IdValue',
embedded: true,
properties: [
IsarPropertySchema(
name: 'id',
type: IsarType.long,
),
IsarPropertySchema(
name: 'value',
type: IsarType.string,
),
],
indexes: [],
),
converter: IsarObjectConverter<void, IdValue>(
serialize: serializeIdValue,
deserialize: deserializeIdValue,
),
);
@isarProtected
int serializeIdValue(IsarWriter writer, IdValue object) {
IsarCore.writeLong(writer, 1, object.id ?? -9223372036854775808);
{
final value = object.value;
if (value == null) {
IsarCore.writeNull(writer, 2);
} else {
IsarCore.writeString(writer, 2, value);
}
}
return 0;
}
@isarProtected
IdValue deserializeIdValue(IsarReader reader) {
final object = IdValue();
{
final value = IsarCore.readLong(reader, 1);
if (value == -9223372036854775808) {
object.id = null;
} else {
object.id = value;
}
}
object.value = IsarCore.readString(reader, 2);
return object;
}
extension IdValueQueryFilter
on QueryBuilder<IdValue, IdValue, QFilterCondition> {
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idGreaterThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idGreaterThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idLessThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idLessThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> idBetween(
int? lower,
int? upper,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 1,
lower: lower,
upper: upper,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueGreaterThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition>
valueGreaterThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueLessThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueLessThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueBetween(
String? lower,
String? upper, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 2,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueContains(
String value,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueMatches(
String pattern,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 2,
wildcard: pattern,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 2,
value: '',
),
);
});
}
QueryBuilder<IdValue, IdValue, QAfterFilterCondition> valueIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 2,
value: '',
),
);
});
}
}
extension IdValueQueryObject
on QueryBuilder<IdValue, IdValue, QFilterCondition> {}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
IdValue _$IdValueFromJson(Map<String, dynamic> json) => IdValue()
..id = (json['id'] as num?)?.toInt()
..value = json['value'] as String?;
Map<String, dynamic> _$IdValueToJson(IdValue instance) => <String, dynamic>{
'id': instance.id,
'value': instance.value,
};

View file

@ -0,0 +1,19 @@
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'id_value_color.g.dart';
@JsonSerializable(explicitToJson: true)
@embedded
class IdValueColor {
IdValueColor();
int? id;
String? value;
String? color;
factory IdValueColor.fromJson(Map<String, dynamic> json) =>
_$IdValueColorFromJson(json);
Map<String, dynamic> toJson() => _$IdValueColorToJson(this);
}

View file

@ -0,0 +1,576 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'id_value_color.dart';
// **************************************************************************
// _IsarEmbeddedGenerator
// **************************************************************************
// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint
const IdValueColorSchema = IsarGeneratedSchema(
schema: IsarSchema(
name: 'IdValueColor',
embedded: true,
properties: [
IsarPropertySchema(
name: 'id',
type: IsarType.long,
),
IsarPropertySchema(
name: 'value',
type: IsarType.string,
),
IsarPropertySchema(
name: 'color',
type: IsarType.string,
),
],
indexes: [],
),
converter: IsarObjectConverter<void, IdValueColor>(
serialize: serializeIdValueColor,
deserialize: deserializeIdValueColor,
),
);
@isarProtected
int serializeIdValueColor(IsarWriter writer, IdValueColor object) {
IsarCore.writeLong(writer, 1, object.id ?? -9223372036854775808);
{
final value = object.value;
if (value == null) {
IsarCore.writeNull(writer, 2);
} else {
IsarCore.writeString(writer, 2, value);
}
}
{
final value = object.color;
if (value == null) {
IsarCore.writeNull(writer, 3);
} else {
IsarCore.writeString(writer, 3, value);
}
}
return 0;
}
@isarProtected
IdValueColor deserializeIdValueColor(IsarReader reader) {
final object = IdValueColor();
{
final value = IsarCore.readLong(reader, 1);
if (value == -9223372036854775808) {
object.id = null;
} else {
object.id = value;
}
}
object.value = IsarCore.readString(reader, 2);
object.color = IsarCore.readString(reader, 3);
return object;
}
extension IdValueColorQueryFilter
on QueryBuilder<IdValueColor, IdValueColor, QFilterCondition> {
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> idIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
idIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> idEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> idGreaterThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
idGreaterThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> idLessThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
idLessThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> idBetween(
int? lower,
int? upper,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 1,
lower: lower,
upper: upper,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> valueEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueGreaterThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueGreaterThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> valueLessThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueLessThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> valueBetween(
String? lower,
String? upper, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 2,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> valueEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> valueContains(
String value,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> valueMatches(
String pattern,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 2,
wildcard: pattern,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 2,
value: '',
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
valueIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 2,
value: '',
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 3));
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 3));
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> colorEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorGreaterThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorGreaterThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> colorLessThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorLessThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> colorBetween(
String? lower,
String? upper, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 3,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> colorEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> colorContains(
String value,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition> colorMatches(
String pattern,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 3,
wildcard: pattern,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 3,
value: '',
),
);
});
}
QueryBuilder<IdValueColor, IdValueColor, QAfterFilterCondition>
colorIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 3,
value: '',
),
);
});
}
}
extension IdValueColorQueryObject
on QueryBuilder<IdValueColor, IdValueColor, QFilterCondition> {}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
IdValueColor _$IdValueColorFromJson(Map<String, dynamic> json) => IdValueColor()
..id = (json['id'] as num?)?.toInt()
..value = json['value'] as String?
..color = json['color'] as String?;
Map<String, dynamic> _$IdValueColorToJson(IdValueColor instance) =>
<String, dynamic>{
'id': instance.id,
'value': instance.value,
'color': instance.color,
};

View file

@ -0,0 +1,19 @@
import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'id_value_mix.g.dart';
@JsonSerializable(explicitToJson: true)
@embedded
class IdValueMix {
IdValueMix();
int? id;
IdValueColor? value;
factory IdValueMix.fromJson(Map<String, dynamic> json) =>
_$IdValueMixFromJson(json);
Map<String, dynamic> toJson() => _$IdValueMixToJson(this);
}

View file

@ -0,0 +1,209 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'id_value_mix.dart';
// **************************************************************************
// _IsarEmbeddedGenerator
// **************************************************************************
// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint
const IdValueMixSchema = IsarGeneratedSchema(
schema: IsarSchema(
name: 'IdValueMix',
embedded: true,
properties: [
IsarPropertySchema(
name: 'id',
type: IsarType.long,
),
IsarPropertySchema(
name: 'value',
type: IsarType.object,
target: 'IdValueColor',
),
],
indexes: [],
),
converter: IsarObjectConverter<void, IdValueMix>(
serialize: serializeIdValueMix,
deserialize: deserializeIdValueMix,
),
);
@isarProtected
int serializeIdValueMix(IsarWriter writer, IdValueMix object) {
IsarCore.writeLong(writer, 1, object.id ?? -9223372036854775808);
{
final value = object.value;
if (value == null) {
IsarCore.writeNull(writer, 2);
} else {
final objectWriter = IsarCore.beginObject(writer, 2);
serializeIdValueColor(objectWriter, value);
IsarCore.endObject(writer, objectWriter);
}
}
return 0;
}
@isarProtected
IdValueMix deserializeIdValueMix(IsarReader reader) {
final object = IdValueMix();
{
final value = IsarCore.readLong(reader, 1);
if (value == -9223372036854775808) {
object.id = null;
} else {
object.id = value;
}
}
{
final objectReader = IsarCore.readObject(reader, 2);
if (objectReader.isNull) {
object.value = null;
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
object.value = embedded;
}
}
return object;
}
extension IdValueMixQueryFilter
on QueryBuilder<IdValueMix, IdValueMix, QFilterCondition> {
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> idIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> idIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> idEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> idGreaterThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition>
idGreaterThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> idLessThan(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition>
idLessThanOrEqualTo(
int? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 1,
value: value,
),
);
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> idBetween(
int? lower,
int? upper,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 1,
lower: lower,
upper: upper,
),
);
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> valueIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> valueIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
}
extension IdValueMixQueryObject
on QueryBuilder<IdValueMix, IdValueMix, QFilterCondition> {
QueryBuilder<IdValueMix, IdValueMix, QAfterFilterCondition> value(
FilterQuery<IdValueColor> q) {
return QueryBuilder.apply(this, (query) {
return query.object(q, 2);
});
}
}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
IdValueMix _$IdValueMixFromJson(Map<String, dynamic> json) => IdValueMix()
..id = (json['id'] as num?)?.toInt()
..value = json['value'] == null
? null
: IdValueColor.fromJson(json['value'] as Map<String, dynamic>);
Map<String, dynamic> _$IdValueMixToJson(IdValueMix instance) =>
<String, dynamic>{
'id': instance.id,
'value': instance.value?.toJson(),
};

View file

@ -0,0 +1,152 @@
import 'package:ambito/src/domain/entity/base_entity.dart';
import 'package:ambito/src/domain/entity/id_value/id_value.dart';
import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
import '../file/file_part.dart';
import '../file/thumbnail.dart';
import '../file/thumbnails.dart';
import '../id_value_mix/id_value_mix.dart';
part 'massnahme.g.dart';
@JsonSerializable(explicitToJson: true)
@collection
class Massnahme extends BaseEntity {
Massnahme();
late int id;
@JsonKey(name: 'order')
String? orderString;
@JsonKey(name: 'Maßnahmenbezeichung')
@Index()
String? name;
@JsonKey(name: 'Flächentyp Factsheet')
List<IdValueColor>? factsheetAreaType;
@JsonKey(name: 'Beispielabbildung\\\n(Link)')
String? examples;
@JsonKey(name: 'Definition Factsheet')
String? factsheetDefinition;
@JsonKey(name: 'Zielsetzung Factsheet')
String? factsheetTarget;
@JsonKey(name: 'Wissenschaftlicher Hintergrund redundant')
String? scientificBackgroundRedundant;
@JsonKey(name: 'Wissenschaftlicher Hintergrund Factsheet')
String? factsheetScientificBackground;
@JsonKey(name: 'Quellen')
String? sources;
@JsonKey(name: 'Zeitrahmen Anlage')
List<IdValueColor>? timeFrame;
@JsonKey(name: 'Beachtenswert - Anlage')
String? attachmentReminder;
@JsonKey(name: 'Arbeitsschritte Anlage')
String? attachmentWorkSteps;
@JsonKey(name: "Standort Fact Sheet")
String? factsheetLocation;
@JsonKey(name: "Größe/Fläche Factsheet")
String? factsheetSizeArea;
@JsonKey(name: "Genehmigungspflicht redundant")
String? redundantAllowance;
@JsonKey(name: "Fachgerechte Umsetzung_Anlage_Kosten_Geld")
String? moneyAction;
@JsonKey(name: "Fachgerechte Umsetzung_Anlage_Kosten_Zeit")
String? timeAction;
@JsonKey(name: "Dienstleister redundant")
String? serviceProvider;
@JsonKey(name: "Tipp - Anlage")
String? attachmentTip;
@JsonKey(name: "Zeitrahmen Pflege")
String? timeMaintenance;
@JsonKey(name: "Arbeitsschritte Pflege")
String? workMaintenance;
@JsonKey(name: "Frequenz Pflege")
List<IdValueColor>? frequencyMaintenance;
@JsonKey(name: "Besonderheiten - Pflege")
String? specialsMaintenance;
@JsonKey(name: "Maßnahmenkombination (passt gut zu)")
String? matchingActions;
@JsonKey(name: "Fachexpertise redundant")
String? redundantExpertise;
@JsonKey(name: "Maßnahmen_geförderte_Organismen")
List<IdValue>? organismActions;
@JsonKey(name: "Maßnahmengruppe")
IdValueColor? actionGroup;
@JsonKey(name: "Förderprogramme")
List<IdValueColor>? fundingPrograms;
@JsonKey(name: "Datei")
List<FilePart>? files;
@JsonKey(name: "Maßnahmennummer")
List<IdValue>? numberOfAction;
@JsonKey(name: "Factsheet_Status")
List<IdValue>? factsheetStatus;
@JsonKey(name: "04 Standortansprüche")
List<IdValue>? requiredLocation;
@JsonKey(name: "06 Betriebsverzeichnis")
List<IdValue>? business;
@JsonKey(name: "05 Referenzumsetzung")
List<IdValue>? referenceAction;
@JsonKey(name: "Material Anlage")
List<IdValueColor>? attachmentMaterial;
@JsonKey(name: "08 Genehmigungspflicht")
List<IdValueColor>? requiredAllowance;
@JsonKey(name: "Zeitaufwand Anlage (Minuten)")
String? requiredTimeForAction;
@JsonKey(name: "Materialkosten")
String? costsMaterial;
@JsonKey(name: "Fachexpertise Dienstleister")
List<IdValueColor>? expertiseWorker;
@JsonKey(name: "Fachexpertise Ansprechperson")
List<IdValueColor>? expertiseContact;
@JsonKey(name: "Arbeitsmittel Anlage")
List<IdValueColor>? materialAction;
@JsonKey(name: "Zeitrahmen Anlage Zusatz")
String? timeframeActionAdditional;
@JsonKey(name: "Arbeitsmittel Pflege")
List<IdValueColor>? maintenanceMaterial;
@JsonKey(name: "12 Quellen")
List<IdValue>? sourcesList;
@JsonKey(name: "Sonstiges - Voraussetzungen")
String? requirements;
@JsonKey(name: "Material - Pflege")
List<IdValueColor>? materialMaintenance;
@JsonKey(name: "Pflege Zeitrahmen Zusatz")
String? timeMaintenanceAdditional;
@JsonKey(name: "Maßnahmenkombinationen")
List<IdValue>? combinedActions;
@JsonKey(name: "Bearbeitet")
bool? done;
@JsonKey(name: "Factsheet vorhanden")
List<IdValueMix>? existingFactSheet;
@JsonKey(name: "Zeitrahmen Pflege 2")
List<IdValueColor>? timeframeMaintenance2;
@JsonKey(name: "13 Baumarten")
List<IdValueColor>? treeTypes;
@JsonKey(name: "Pflege Frequenz Zusatz")
String? frequencyMaintenanceAdditional;
@JsonKey(name: "Besonderheiten - Anlage")
String? specialCreation;
@JsonKey(name: "Ökologische Relevanz - Hintergrund")
String? oekologischeRelevanzBackground;
@JsonKey(name: "Beachtenswert - Vorraussetzungen")
String? remarkablePresets;
@JsonKey(name: "Beachtenswert .- Pflege")
String? remarkableMaintenance;
@JsonKey(name: "Tipp - Vorraussetzungen")
String? tipsPresets;
@JsonKey(name: "Tipp - Pflege")
String? tipsMaintenance;
@JsonKey(name: "Gut zu wissen - Anlage")
String? goodToKnowAttachment;
@JsonKey(name: "Hintergrund - Tipps")
String? tipsBackground;
@JsonKey(name: "Besonderheit - Hintergrund")
String? specialBackground;
@JsonKey(name: "12 Quellen - Verwendet in Maßnahmendatenblatt")
List<IdValue>? sourcesUsedInDataSheet;
factory Massnahme.fromJson(Map<String, dynamic> json) =>
_$MassnahmeFromJson(json);
Map<String, dynamic> toJson() => _$MassnahmeToJson(this);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,62 @@
import 'dart:convert';
import 'package:ambito/src/domain/entity/massnahme/massnahme.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<String, int> tables = {
'massnahmen': 328253,
'massnahmenkombination': 328217,
'organismen': 328255,
'foerderprogramme': 328256,
'factsheet': 328273,
'standortansprueche': 328188,
'referenzumsetzung': 328465,
'betriebsverzeichnis': 328472,
'erfahrungsbericht': 330802,
'genehmigungspflicht': 330806,
'dienstleister': 330824,
'ansprechperson': 330832,
'material': 330836,
'quellen': 334231,
'baumarten': 342622,
'aenderungfactsheet': 330946,
};
class BaseApi {
Future<bool> getContent(String table) async {
int tableId = tables[table] ?? 0;
if (tableId > 0) {
var response =
await RestClient().get('$tableId/?user_field_names=true&size=200');
if (response.statusCode == 200) {
var json = jsonDecode(utf8.decode(response.body.runes.toList()));
switch (table) {
case 'baumarten':
for (var baumart in json['results']) {
BaseDB.put(Baumarten.fromJson(baumart));
Baumarten art = Baumarten.fromJson(baumart);
isar.write((isar) {
isar.baumartens.put(art);
});
}
break;
case 'massnahmen':
for (var massnahme in json['results']) {
BaseDB.put(Massnahme.fromJson(massnahme));
isar.write((isar) {
isar.massnahmes.put(Massnahme.fromJson(massnahme));
});
}
break;
}
return true;
}
return false;
}
return false;
}
}

View file

@ -0,0 +1,138 @@
library vyc_api;
import 'dart:async';
import 'dart:convert';
import 'package:ambito/main.dart';
import 'package:http/http.dart' as http;
class RestClient {
final String baseUrl = 'https://api.baserow.io/api/database/rows/table/';
static final http.Client _client = http.Client();
static const String contentType = "application/json; charset=utf-8";
static const String accept = 'application/json; charset=UTF-8';
RestClient();
Map<String, String> _getHeaders() {
var headers = {
"Content-Type": contentType,
"Accept": accept,
"Authorization": "Token $AmbitoToken",
};
return headers;
}
Future<http.Response> _performRequest(
Function request,
) async {
try {
http.Response response = await request();
_logResponse(response);
return response;
} catch (e) {
_logError(e);
rethrow;
}
}
void _logResponse(http.Response response) {
if (response.statusCode != 200 && response.statusCode != 204) {
logger.e('ERROR PERFORMING REQUEST:');
logger.e(response.request?.method.toString());
logger.e(response.request?.url);
logger.e(response.request?.toString());
logger.e('REPONSE:');
logger.e(response.statusCode);
logger.e(response.headers);
logger.e(response.body);
}
}
void _logError(dynamic error) {
logger.e(error);
}
Future<http.Response> delete(String endpoint) async {
final String uriString = '$baseUrl$endpoint';
final Uri uri = Uri.parse(uriString);
final Map<String, String> headers = _getHeaders();
return _performRequest(
() {
return _client.delete(
uri,
headers: headers,
);
},
);
}
Future<http.Response> get(String endpoint) async {
final String uriString = '$baseUrl$endpoint';
final Uri uri = Uri.parse(uriString);
final Map<String, String> headers = _getHeaders();
return _performRequest(
() {
return _client.get(
uri,
headers: headers,
);
},
);
}
Future<http.Response> post(
String endpoint,
dynamic body,
) async {
final String uriString = '$baseUrl$endpoint';
final Uri uri = Uri.parse(uriString);
final Map<String, String> headers = _getHeaders();
return _performRequest(
() {
return _client.post(
uri,
body: jsonEncode(body),
headers: headers,
);
},
);
}
Future<http.Response> put(
String endpoint,
dynamic body,
) async {
final String uriString = '$baseUrl$endpoint';
final Uri uri = Uri.parse(uriString);
final Map<String, String> headers = _getHeaders();
return _performRequest(
() {
return _client.put(
uri,
body: jsonEncode(body),
headers: headers,
);
},
);
}
Future<http.Response> patch(
String endpoint,
dynamic body,
) async {
final String uriString = '$baseUrl$endpoint';
final Uri uri = Uri.parse(uriString);
final Map<String, String> headers = _getHeaders();
return _performRequest(
() {
return _client.patch(
uri,
body: jsonEncode(body),
headers: headers,
);
},
);
}
}

View file

@ -0,0 +1,31 @@
import 'package:ambito/src/domain/entity/baumarten/baumarten.dart';
import 'package:ambito/src/domain/entity/massnahme/massnahme.dart';
import 'package:isar/isar.dart';
import '../../../main.dart';
class BaseDB {
static put(var entity) {
switch (entity.runtimeType) {
case 'Baumarten':
isar.write((isar) {
isar.baumartens.put(entity);
});
break;
case 'Massnahme':
isar.write((isar) {
isar.massnahmes.put(entity);
});
break;
}
}
static getAll(String type) {
switch (type) {
case 'Maßnahme':
return isar.massnahmes.where().sortByName().findAll();
case 'Baumart':
return isar.baumartens.where().findAll();
}
}
}

View file

@ -0,0 +1,251 @@
import 'package:ambito/src/domain/entity/massnahme/massnahme.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:expandable_text/expandable_text.dart';
import 'package:flutter/material.dart';
import '../../../main.dart';
class ActionsPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => ActionsPageState();
}
class ActionsPageState extends State<ActionsPage> {
final GlobalKey<FormFieldState> _keyType = GlobalKey<FormFieldState>();
final GlobalKey<FormFieldState> _keyAreaType = GlobalKey<FormFieldState>();
Map<int, bool> visible = {};
List<String> effort = [];
List<String> effect = [];
List<String> type = [];
String? filterType;
List<String> areaType = [];
String? filterAreaType;
List<String> region = [];
List<String> support = [];
@override
void initState() {
effort = [];
effect = [];
type = [];
areaType = [];
region = [];
support = [];
}
@override
Widget build(BuildContext context) {
List<Massnahme> massnahmen = BaseDB.getAll('Maßnahme');
List<Widget> actionCards = [];
for (var massnahme in massnahmen) {
//logger.d(massnahme.toJson());
if (massnahme.actionGroup != null &&
!type.contains(massnahme.actionGroup!.value)) {
setState(() {
type.add(massnahme.actionGroup!.value!);
});
}
if (massnahme.factsheetAreaType != null) {
for (var aType in massnahme.factsheetAreaType!) {
if (!areaType.contains(aType.value)) {
setState(() {
areaType.add(aType.value!);
});
}
}
}
}
for (var massnahme in massnahmen) {
bool myVisibility = true;
if (filterType != null) {
if (massnahme.actionGroup == null ||
massnahme.actionGroup!.value != filterType) {
myVisibility = false;
}
}
if (filterAreaType != null) {
if (massnahme.factsheetAreaType != null) {
myVisibility = false;
for (var aType in massnahme.factsheetAreaType!) {
if (aType.value == filterAreaType) {
myVisibility = true;
}
}
}
}
setState(() {
visible[massnahme.id] = myVisibility;
});
actionCards.add(getCard(context, massnahme));
}
logger.d(visible);
//logger.d(areaType);
return Padding(
padding: const EdgeInsets.only(left: 32, right: 32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.translate('page.actions.title'),
style: Theme.of(context).textTheme.headlineLarge,
),
getSpacer(),
Text(
context.translate('page.actions.intro'),
style: Theme.of(context).textTheme.titleLarge,
),
getSpacer(),
getFilter(context),
getSpacer(),
Expanded(
child: SingleChildScrollView(
child: Wrap(
children: actionCards,
),
),
),
],
),
);
}
Widget getSpacer() {
return const SizedBox(
height: 8,
);
}
Widget getFilter(BuildContext context) {
return Row(
children: [
DropdownMenu(
key: _keyAreaType,
initialSelection: filterAreaType,
leadingIcon: (filterAreaType != null)
? IconButton(
onPressed: () {
_keyAreaType.currentState!.didChange(null);
_keyAreaType.currentState!.reset();
setState(() {
filterAreaType = null;
});
},
icon: const Icon(Icons.delete),
)
: null,
onSelected: (String? selection) {
setState(() {
filterAreaType = selection;
});
},
dropdownMenuEntries:
areaType.map<DropdownMenuEntry<String>>((String entry) {
return DropdownMenuEntry<String>(
value: entry,
label: entry,
);
}).toList(),
),
DropdownMenu(
key: _keyType,
leadingIcon: (filterType != null)
? IconButton(
onPressed: () {
setState(() {
filterType = null;
});
_keyType.currentState!.reset();
},
icon: const Icon(Icons.delete),
)
: null,
onSelected: (String? selection) {
setState(() {
filterType = selection;
});
},
dropdownMenuEntries:
type.map<DropdownMenuEntry<String>>((String entry) {
return DropdownMenuEntry<String>(
value: entry,
label: entry,
);
}).toList(),
),
],
);
}
Widget getCard(BuildContext context, Massnahme massnahme) {
Color background = Colors.white;
switch (massnahme.actionGroup?.value) {
case 'Baulelemente':
background = const Color(0xffFFD269);
break;
case 'Begrünung':
background = const Color(0xff40DD74);
break;
case 'Bewirtschaftung':
background = const Color(0xffBF72ED);
break;
case 'Nisthilfe':
background = const Color(0xffDAE3FD);
break;
case 'Pflanzung':
background = const Color(0xff40D6E9);
break;
case 'Sondermaßnahmen':
background = const Color(0xff689EF1);
break;
}
var image;
if (massnahme.files != null && massnahme.files!.isNotEmpty) {
if (massnahme.files![0].thumbnails?.card_cover?.url != null) {
image = CachedNetworkImage(
imageUrl: massnahme.files![0].thumbnails!.card_cover!.url!,
placeholder: (context, url) => const CircularProgressIndicator(),
errorWidget: (context, url, error) => const Icon(Icons.error),
);
}
}
return Visibility(
visible: visible[massnahme.id] ?? false,
child: SizedBox(
width: 400,
child: Card(
color: background,
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
children: [
if (image != null) image,
const SizedBox(
height: 8,
),
Text(massnahme.name!,
style: Theme.of(context).textTheme.headlineSmall),
const SizedBox(
height: 8,
),
ExpandableText(
massnahme.factsheetDefinition ?? '',
maxLines: 3,
expandText: 'mehr',
collapseText: 'weniger',
)
],
),
),
),
),
);
}
}

View file

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin");
isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar);
}

View file

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
isar_flutter_libs
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View file

@ -5,6 +5,14 @@
import FlutterMacOS
import Foundation
import geolocator_apple
import isar_flutter_libs
import path_provider_foundation
import sqflite
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
}

File diff suppressed because it is too large Load diff

View file

@ -1,90 +1,52 @@
name: ambito
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
description: "..."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1001
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: '>=3.4.4 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
intl: ^0.19.0
flutter_map: ^7.0.2
latlong2: ^0.9.1
flutter_map_location_marker: ^9.1.1
flutter_map_cache: ^1.5.1
maps_toolkit: ^3.0.0
fast_immutable_collections: ^10.2.4
badges: ^3.1.2
logger: ^2.4.0
geolocator: ^13.0.1
permission_handler: ^11.3.1
flutter_i18n: ^0.36.2
isar:
version: 4.0.3
hosted: https://pub.isar-community.dev/
isar_flutter_libs: # contains Isar Core
version: 4.0.3
hosted: https://pub.isar-community.dev/
country_flags: ^3.0.0
get: ^4.6.6
json_serializable: ^6.8.0
json_annotation: ^4.9.0
expandable_text: ^2.3.0
path_provider: ^2.1.4
cached_network_image: ^3.4.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
build_runner: any
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^3.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
assets:
- assets/
- assets/i18n/
- assets/images/

View file

@ -1,30 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ambito/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}

View file

@ -31,8 +31,75 @@
<title>ambito</title>
<link rel="manifest" href="manifest.json">
<style>
.loader,.loader:before,.loader:after{
top:0;
bottom:0;
left:0;
right:0;
content:"";
position:absolute;
border-radius:50%;
}
body{
background-image: url("assets/images/logo_trans.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
.loader{
position:fixed;
width:200px;
height:200px;
margin:auto;
animation:spin 4s linear infinite;
}
@keyframes spin{
100%{transform:rotate(360deg);}
}
.loader:before{
border:5px solid #86A34D;
border-bottom:5px solid #D4D707;
border-left:5px solid #3C683E;
animation:spin1 1s linear infinite;
}
.loader:after{
border:5px solid #AAC01C;
border-top:5px solid transparent;
border-right:5px solid transparent;
animation:spin2 1s linear infinite;
}
@keyframes spin1{
20%{transform:rotate(150deg)}
40%{transform:rotate(300deg)}
80%{transform:rotate(300deg)}
100%{transform:rotate(360deg)}
}
@keyframes spin2{
0%{transform:rotate(-30deg)}
20%{transform:rotate(-30deg);
border-color:transparent transparent #AAC01C #AAC01C}
21%{border-color:#D4D707 #D4D707 transparent transparent}
40%{transform:rotate(-30deg)}
60%{transform:rotate(120deg);
border-color:#86A34D #86A34D transparent transparent}
61%{border-color:transparent transparent #3C683E #3C683E}
80%{transform:rotate(270deg)}
100%{transform:rotate(330deg);}
}
</style>
</head>
<body>
<div class="loader"></div>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>

View file

@ -6,6 +6,15 @@
#include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h>
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows"));
IsarFlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
}

View file

@ -3,6 +3,9 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows
isar_flutter_libs
permission_handler_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST