Stand 2024-11-25
This commit is contained in:
parent
ed31c1e4dc
commit
9058dc2491
15 changed files with 3124 additions and 94 deletions
BIN
images/spacer.png
Normal file
BIN
images/spacer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
|
@ -4,8 +4,9 @@ import 'package:ambito/src/packages/ambito_api/base_api.dart';
|
|||
import 'package:ambito/src/packages/ambito_db/base_db.dart';
|
||||
import 'package:ambito/src/packages/ambito_notifier/notifier/theme_manager.dart';
|
||||
import 'package:ambito/src/packages/ambito_sharedprefs/ambito_sharedprefs.dart';
|
||||
import 'package:ambito/src/pages/actions/actions_categories_page.dart';
|
||||
import 'package:ambito/src/pages/actions/actions_page.dart';
|
||||
import 'package:ambito/src/pages/actions/actions_pre_page.dart';
|
||||
import 'package:ambito/src/pages/actions/actions_types_page.dart';
|
||||
import 'package:ambito/src/pages/actions/create/action_create_page.dart';
|
||||
import 'package:ambito/src/pages/actions/detail/action_detail_page.dart';
|
||||
import 'package:ambito/src/pages/calendar/calendar_page.dart';
|
||||
|
@ -38,6 +39,7 @@ void main() async {
|
|||
//BaseApi().getContent('material'),
|
||||
//BaseApi().getContent('source'),
|
||||
]);
|
||||
await MeasureRepository().getCategoriesAndTypes();
|
||||
await MeasureRepository().buildMeasureFilters();
|
||||
//await MeasureRepository().downloadImages();
|
||||
runApp(const Ambito());
|
||||
|
@ -83,7 +85,7 @@ class Ambito extends StatelessWidget {
|
|||
getPages: [
|
||||
GetPage(
|
||||
name: '/',
|
||||
page: () => const ActionsPrePage(),
|
||||
page: () => const ActionsCategoriesPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/kalender',
|
||||
|
@ -95,15 +97,15 @@ class Ambito extends StatelessWidget {
|
|||
),
|
||||
GetPage(
|
||||
name: '/massnahmen',
|
||||
page: () => const ActionsPrePage(),
|
||||
page: () => const ActionsCategoriesPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/massnahmendatenbank',
|
||||
page: () => const ActionsPage(),
|
||||
page: () => const ActionsCategoriesPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/massnahmendatenbank/:kategorie',
|
||||
page: () => const ActionsPage(),
|
||||
page: () => const ActionsTypesPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/massnahmendatenbank/:kategorie/:typ',
|
||||
|
|
20
lib/src/entity/measure/measure_category.dart
Normal file
20
lib/src/entity/measure/measure_category.dart
Normal file
|
@ -0,0 +1,20 @@
|
|||
import 'package:ambito/src/entity/base_entity.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'measure_category.g.dart';
|
||||
|
||||
@collection
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class MeasureCategory extends BaseEntity with EntityWithIdAndName {
|
||||
MeasureCategory();
|
||||
|
||||
String? image;
|
||||
String? description;
|
||||
int children = 0;
|
||||
|
||||
factory MeasureCategory.fromJson(Map<String, dynamic> json) =>
|
||||
_$MeasureCategoryFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MeasureCategoryToJson(this);
|
||||
}
|
1344
lib/src/entity/measure/measure_category.g.dart
Normal file
1344
lib/src/entity/measure/measure_category.g.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,7 @@
|
|||
import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart';
|
||||
import 'package:ambito/src/entity/entities.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_category.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_type.dart';
|
||||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:ambito/src/packages/ambito_db/base_db.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
@ -10,6 +12,67 @@ class MeasureRepository extends BaseDB {
|
|||
@override
|
||||
IsarCollection collection = isar.measures;
|
||||
|
||||
Future<bool> getCategoriesAndTypes() async {
|
||||
final categoriesMap = <String, MeasureCategory>{};
|
||||
final typesMap = <String, MeasureType>{};
|
||||
|
||||
final autoIncrementCat = isar.measureCategorys.autoIncrement;
|
||||
final autoIncrementType = isar.measureTypes.autoIncrement;
|
||||
|
||||
// Fetch all measures
|
||||
final allMeasures = await isar.measures.where().findAll();
|
||||
|
||||
for (final measure in allMeasures) {
|
||||
if (measure.actionGroup == null ||
|
||||
measure.factsheetAreaType == null ||
|
||||
measure.factsheetAreaType!.isEmpty) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process categories
|
||||
for (final cat in measure.factsheetAreaType!) {
|
||||
final categoryName = cat.value;
|
||||
if (categoryName == null) continue;
|
||||
|
||||
if (!categoriesMap.containsKey(categoryName)) {
|
||||
categoriesMap[categoryName] = MeasureCategory()
|
||||
..id = autoIncrementCat()
|
||||
..name = categoryName
|
||||
..image =
|
||||
'images/actions/areatype/${categoryName.toLowerCase().replaceUmlauts()}.jpg'
|
||||
..description = 'Lorem ipsum dolor sit amet.'
|
||||
..children = 1;
|
||||
} else {
|
||||
categoriesMap[categoryName]!.children++;
|
||||
}
|
||||
}
|
||||
|
||||
// Process types
|
||||
final actionGroupName = measure.actionGroup!.value;
|
||||
if (actionGroupName == null) continue;
|
||||
|
||||
if (!typesMap.containsKey(actionGroupName)) {
|
||||
typesMap[actionGroupName] = MeasureType()
|
||||
..id = autoIncrementType()
|
||||
..name = actionGroupName
|
||||
..description = measure.factsheetDefinition
|
||||
..image = (measure.files != null && measure.files!.isNotEmpty)
|
||||
? measure.files![0].url
|
||||
: 'images/spacer.png' // Add the appropriate image URL if available
|
||||
..children = 1;
|
||||
} else {
|
||||
typesMap[actionGroupName]!.children++;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert maps to lists
|
||||
isar.write((isar) {
|
||||
isar.measureCategorys.putAll(categoriesMap.values.toList());
|
||||
isar.measureTypes.putAll(typesMap.values.toList());
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<bool> buildLists() async {
|
||||
var measures = getAll();
|
||||
Map<String, List<Map<String, IdValueColor>>> lists = {};
|
||||
|
@ -147,4 +210,12 @@ class MeasureRepository extends BaseDB {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
List<MeasureCategory> getCategories() {
|
||||
return isar.measureCategorys.where().findAll();
|
||||
}
|
||||
|
||||
List<MeasureType> getTypes() {
|
||||
return isar.measureTypes.where().findAll();
|
||||
}
|
||||
}
|
||||
|
|
20
lib/src/entity/measure/measure_type.dart
Normal file
20
lib/src/entity/measure/measure_type.dart
Normal file
|
@ -0,0 +1,20 @@
|
|||
import 'package:ambito/src/entity/base_entity.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'measure_type.g.dart';
|
||||
|
||||
@collection
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class MeasureType extends BaseEntity with EntityWithIdAndName {
|
||||
MeasureType();
|
||||
|
||||
String? image;
|
||||
String? description;
|
||||
int children = 0;
|
||||
|
||||
factory MeasureType.fromJson(Map<String, dynamic> json) =>
|
||||
_$MeasureTypeFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MeasureTypeToJson(this);
|
||||
}
|
1316
lib/src/entity/measure/measure_type.g.dart
Normal file
1316
lib/src/entity/measure/measure_type.g.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,6 @@
|
|||
import 'package:ambito/src/entity/entities.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_category.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_type.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
@ -25,6 +27,8 @@ class AmbitoIsarDB {
|
|||
MaterialSchema,
|
||||
MeasureSchema,
|
||||
MeasureCombinationSchema,
|
||||
MeasureCategorySchema,
|
||||
MeasureTypeSchema,
|
||||
NumberFactsheetSchema,
|
||||
OrganismSchema,
|
||||
ReferenceImplementationSchema,
|
||||
|
|
|
@ -28,26 +28,26 @@ final greenColors = {
|
|||
};
|
||||
|
||||
final actionGroupColors = {
|
||||
'Bauelemente': const Color(0xffFFD269).withOpacity(.4),
|
||||
'Begrünung': const Color(0xff40DD74).withOpacity(.4),
|
||||
'Bewirtschaftung': const Color(0xffBF72ED).withOpacity(.4),
|
||||
'Nisthilfe': const Color(0xffDAE3FD).withOpacity(.4),
|
||||
'Pflanzung': const Color(0xff40D6E9).withOpacity(.4),
|
||||
'Sondermaßnahmen': const Color(0xff689EF1).withOpacity(.4),
|
||||
'Bauelemente': const Color(0xffFFD269).withOpacity(.3),
|
||||
'Begrünung': const Color(0xff40DD74).withOpacity(.3),
|
||||
'Bewirtschaftung': const Color(0xffBF72ED).withOpacity(.3),
|
||||
'Nisthilfe': const Color(0xffDAE3FD).withOpacity(.3),
|
||||
'Pflanzung': const Color(0xff40D6E9).withOpacity(.3),
|
||||
'Sondermaßnahmen': const Color(0xff689EF1).withOpacity(.3),
|
||||
};
|
||||
|
||||
final actionAreaColors = {
|
||||
'Landschaft': const Color(0xffeebb4b).withOpacity(.3),
|
||||
'Weinberg': const Color(0xff88a44e).withOpacity(.3),
|
||||
'Betriebsfläche': const Color(0xff96172f).withOpacity(.3),
|
||||
'Betriebsstätte': const Color(0xffCCCDCC).withOpacity(.6),
|
||||
'Landschaft': const Color(0xffeebb4b).withOpacity(.1),
|
||||
'Weinberg': const Color(0xff88a44e).withOpacity(.1),
|
||||
'Betriebsfläche': const Color(0xff96172f).withOpacity(.1),
|
||||
'Betriebsstätte': const Color(0xffCCCDCC).withOpacity(.1),
|
||||
};
|
||||
|
||||
final actionAreaFGColors = {
|
||||
'Landschaft': const Color(0xffec863a),
|
||||
'Weinberg': const Color(0xff3d693f),
|
||||
'Betriebsfläche': const Color(0xff883443),
|
||||
'Betriebsstätte': const Color(0xff999999),
|
||||
'Landschaft': const Color(0xffeebb4b),
|
||||
'Weinberg': const Color(0xff88a44e),
|
||||
'Betriebsfläche': const Color(0xff96172f),
|
||||
'Betriebsstätte': const Color(0xff666666),
|
||||
};
|
||||
|
||||
AmbitoTheme getTheme(BuildContext context) {
|
||||
|
@ -56,7 +56,7 @@ AmbitoTheme getTheme(BuildContext context) {
|
|||
ThemeManager().setTheme(largeTheme);
|
||||
return largeTheme;
|
||||
}
|
||||
if (breakpoint >= myBreakpoints.sm) {
|
||||
if (breakpoint > myBreakpoints.sm) {
|
||||
ThemeManager().setTheme(mediumTheme);
|
||||
return mediumTheme;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class AmbitoThemeLarge extends AmbitoTheme {
|
|||
letterSpacing: 0,
|
||||
),
|
||||
headlineSmall: GoogleFonts.openSans(
|
||||
fontSize: 32,
|
||||
fontSize: 24,
|
||||
height: 1.33,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: 0,
|
||||
|
@ -47,25 +47,25 @@ class AmbitoThemeLarge extends AmbitoTheme {
|
|||
letterSpacing: 0,
|
||||
),
|
||||
titleMedium: GoogleFonts.openSans(
|
||||
fontSize: 16,
|
||||
fontSize: 32,
|
||||
height: 1.5,
|
||||
fontWeight: FontWeight.w500,
|
||||
letterSpacing: 0.15,
|
||||
),
|
||||
titleSmall: GoogleFonts.openSans(
|
||||
fontSize: 14,
|
||||
fontSize: 20,
|
||||
height: 1.42,
|
||||
fontWeight: FontWeight.w500,
|
||||
letterSpacing: 0.1,
|
||||
),
|
||||
labelLarge: GoogleFonts.openSans(
|
||||
fontSize: 28,
|
||||
fontSize: 32,
|
||||
height: 1.42,
|
||||
fontWeight: FontWeight.w500,
|
||||
letterSpacing: 0.1,
|
||||
),
|
||||
labelMedium: GoogleFonts.openSans(
|
||||
fontSize: 20,
|
||||
fontSize: 24,
|
||||
height: 1.33,
|
||||
fontWeight: FontWeight.w500,
|
||||
letterSpacing: 0.15,
|
||||
|
@ -77,13 +77,13 @@ class AmbitoThemeLarge extends AmbitoTheme {
|
|||
letterSpacing: 0.1,
|
||||
),
|
||||
bodyLarge: GoogleFonts.openSans(
|
||||
fontSize: 16,
|
||||
fontSize: 20,
|
||||
height: 1.5,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
bodyMedium: GoogleFonts.openSans(
|
||||
fontSize: 14,
|
||||
fontSize: 18,
|
||||
height: 1.42,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: 0.25,
|
||||
|
|
|
@ -65,7 +65,7 @@ class AmbitoThemeSmall extends AmbitoTheme {
|
|||
letterSpacing: 0.1,
|
||||
),
|
||||
labelMedium: GoogleFonts.openSans(
|
||||
fontSize: 24,
|
||||
fontSize: 12,
|
||||
height: 1.33,
|
||||
fontWeight: FontWeight.w500,
|
||||
letterSpacing: 0.15,
|
||||
|
|
250
lib/src/pages/actions/actions_categories_page.dart
Normal file
250
lib/src/pages/actions/actions_categories_page.dart
Normal file
|
@ -0,0 +1,250 @@
|
|||
import 'package:ambito/src/config/config.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_category.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_repository.dart';
|
||||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:ambito/src/pages/ambito_page.dart';
|
||||
import 'package:ambito/src/widgets/page/base_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:screen_breakpoints/screen_breakpoints.dart';
|
||||
|
||||
import '../../consts/consts.dart';
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
|
||||
class ActionsCategoriesPage extends AmbitoPage {
|
||||
const ActionsCategoriesPage({super.key});
|
||||
|
||||
@override
|
||||
final String path = 'massnahmen';
|
||||
@override
|
||||
final String title = 'Maßnamen';
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => ActionsPrePageState();
|
||||
}
|
||||
|
||||
class ActionsPrePageState extends State<ActionsCategoriesPage> {
|
||||
Set<Widget> cards = {};
|
||||
Map<String, int> counter = {};
|
||||
Map<String, int> ids = {};
|
||||
int counterComplete = 0;
|
||||
List<MeasureCategory>? categories;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
cards = {};
|
||||
categories = MeasureRepository().getCategories();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
setState(() {
|
||||
cards = {};
|
||||
});
|
||||
|
||||
for (MeasureCategory category in categories!) {
|
||||
setState(() {
|
||||
cards.add(_buildCard(context, category));
|
||||
});
|
||||
}
|
||||
|
||||
return BasePage().getPage(
|
||||
context,
|
||||
BreakpointBuilder(builder: (
|
||||
context,
|
||||
breakpoint,
|
||||
configuration,
|
||||
) {
|
||||
return SingleChildScrollView(
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: Breakpoint.fromContext(context).width,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(breakpoint.toString()),
|
||||
theme.verticalSpacerMax,
|
||||
Text(
|
||||
context.translate('page.general.links.massnahmen.title'),
|
||||
textAlign: TextAlign.start,
|
||||
style: theme.headlineMedium.copyWith(
|
||||
color: theme.currentColorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
theme.verticalSpacerMax,
|
||||
Wrap(
|
||||
alignment: WrapAlignment.start,
|
||||
spacing: 40,
|
||||
runSpacing: 40,
|
||||
children: cards.toList(),
|
||||
),
|
||||
theme.verticalSpacerMax,
|
||||
InkWell(
|
||||
onHover: (hovered) {},
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
await prefs.setString('selected_areaType', '');
|
||||
await Get.toNamed('/massnahmendatenbank');
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(8)),
|
||||
color:
|
||||
theme.currentColorScheme.onSurface.withOpacity(.1),
|
||||
),
|
||||
width: Breakpoint.fromContext(context).width,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Text(
|
||||
'Alle Maßnahmen anzeigen',
|
||||
style: theme.titleMedium.copyWith(
|
||||
color: theme.currentColorScheme.outline,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCard(BuildContext context, MeasureCategory category) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
prefs.setString('selected_areaType', category.name!).then((value) {
|
||||
Get.toNamed(
|
||||
'/massnahmendatenbank/${category.name!.toLowerCase().replaceUmlauts()}');
|
||||
});
|
||||
},
|
||||
onHover: (hovered) {},
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
child: context.breakpoint.breakpoint == myBreakpoints.sm!.breakpoint
|
||||
? _smallCard(category)
|
||||
: _normalCard(category),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _smallCard(MeasureCategory category) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: actionAreaColors[category.name!],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 128,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
image: DecorationImage(
|
||||
image: AssetImage(category.image!),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
theme.verticalSpacerSmall,
|
||||
Text(
|
||||
category.name!,
|
||||
style: theme.labelMedium.copyWith(
|
||||
color: actionAreaFGColors[category.name!]!,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Anzahl: ${category.children}',
|
||||
style: theme.labelMedium.copyWith(
|
||||
color: actionAreaFGColors[category.name],
|
||||
),
|
||||
),
|
||||
theme.verticalSpacerSmall,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _normalCard(MeasureCategory category) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return SizedBox(
|
||||
width: 357,
|
||||
height: 606,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
color: actionAreaColors[category.name!],
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Image.asset(
|
||||
category.image!,
|
||||
),
|
||||
),
|
||||
largeTheme.verticalSpacer,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Text(
|
||||
category.name!,
|
||||
textAlign: TextAlign.start,
|
||||
style: theme.titleMedium.copyWith(
|
||||
color: actionAreaFGColors[category.name!],
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
largeTheme.verticalSpacer,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Text(
|
||||
'Letter of Marque transom booty hail-shot rigging wherry tender Yellow Jack hang the jib piracy. Reef sails man-of-war spyglass doubloon log handsomely overhaul Arr rigging bucko. Ballast Buccaneer warp parrel fire ship bounty skysail square-rigged chase keelhaul.',
|
||||
textAlign: TextAlign.justify,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
child: Text(
|
||||
'Anzahl: ${category.children}',
|
||||
style: theme.titleMedium.copyWith(
|
||||
color: actionAreaFGColors[category.name!],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
import 'package:ambito/src/config/config.dart';
|
||||
import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart';
|
||||
import 'package:ambito/src/entity/entities.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_repository.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_type.dart';
|
||||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:ambito/src/pages/ambito_page.dart';
|
||||
import 'package:ambito/src/widgets/page/base_page.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:screen_breakpoints/screen_breakpoints.dart';
|
||||
|
@ -12,8 +12,8 @@ import 'package:screen_breakpoints/screen_breakpoints.dart';
|
|||
import '../../consts/consts.dart';
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
|
||||
class ActionsPrePage extends AmbitoPage {
|
||||
const ActionsPrePage({super.key});
|
||||
class ActionsTypesPage extends AmbitoPage {
|
||||
const ActionsTypesPage({super.key});
|
||||
|
||||
@override
|
||||
final String path = 'massnahmen';
|
||||
|
@ -24,18 +24,17 @@ class ActionsPrePage extends AmbitoPage {
|
|||
State<StatefulWidget> createState() => ActionsPrePageState();
|
||||
}
|
||||
|
||||
class ActionsPrePageState extends State<ActionsPrePage> {
|
||||
class ActionsPrePageState extends State<ActionsTypesPage> {
|
||||
Set<Widget> cards = {};
|
||||
Map<String, int> counter = {};
|
||||
Map<String, int> ids = {};
|
||||
int counterComplete = 0;
|
||||
Set<ItemFilter>? filters;
|
||||
List<MeasureType>? categories;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
cards = {};
|
||||
filters = ItemFilterRepository().getByType('areaType');
|
||||
counterComplete = MeasureRepository().getMeasureCount();
|
||||
categories = MeasureRepository().getTypes();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -47,9 +46,9 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
cards = {};
|
||||
});
|
||||
|
||||
for (ItemFilter filter in filters!) {
|
||||
for (MeasureType category in categories!) {
|
||||
setState(() {
|
||||
cards.add(_buildCard(context, filter));
|
||||
cards.add(_buildCard(context, category));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -82,8 +81,9 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
alignment: WrapAlignment.start,
|
||||
spacing: 32,
|
||||
runSpacing: 32,
|
||||
children: cards.toList(),
|
||||
),
|
||||
),
|
||||
|
@ -127,11 +127,12 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _buildCard(BuildContext context, ItemFilter filter) {
|
||||
Widget _buildCard(BuildContext context, MeasureType category) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
prefs.setString('selected_areaType', filter.name!).then((value) {
|
||||
Get.toNamed('/massnahmendatenbank/${filter.name}');
|
||||
prefs.setString('selected_areaType', category.name!).then((value) {
|
||||
Get.toNamed(
|
||||
'/massnahmendatenbank/${category.name!.toLowerCase().replaceUmlauts()}');
|
||||
});
|
||||
},
|
||||
onHover: (hovered) {},
|
||||
|
@ -140,22 +141,25 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
child: context.breakpoint.breakpoint == myBreakpoints.sm!.breakpoint
|
||||
? _smallCard(filter)
|
||||
: _normalCard(filter),
|
||||
? _smallCard(category)
|
||||
: _normalCard(category),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _smallCard(ItemFilter filter) {
|
||||
Widget _smallCard(MeasureType category) {
|
||||
logger.d(category.image);
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Container(
|
||||
height: 180,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
image: DecorationImage(
|
||||
image: AssetImage(filter.image!),
|
||||
image: (category.image == 'images/logo_trans.png')
|
||||
? AssetImage(category.image!)
|
||||
: CachedNetworkImageProvider(category.image!),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
|
@ -165,7 +169,7 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
Container(
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: actionAreaFGColors[filter.name!]!.withOpacity(.6),
|
||||
color: actionGroupColors[category.name!]!,
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10)),
|
||||
|
@ -177,14 +181,14 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
filter.name!,
|
||||
category.name!,
|
||||
style: theme.labelMedium.copyWith(
|
||||
color: theme.currentColorScheme.onPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Anzahl: ${filter.ids!.length}',
|
||||
'Anzahl: ${category.children}',
|
||||
style: theme.titleMedium.copyWith(
|
||||
color: theme.currentColorScheme.onPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
@ -199,29 +203,36 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _normalCard(ItemFilter filter) {
|
||||
Widget _normalCard(MeasureType category) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return SizedBox(
|
||||
width: 262,
|
||||
height: 380,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
color: actionAreaColors[filter.name!],
|
||||
color: actionGroupColors[category.name!],
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Image.asset(
|
||||
filter.image!,
|
||||
Container(
|
||||
height: 180,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
image: DecorationImage(
|
||||
image: (category.image == 'images/logo_trans.png')
|
||||
? AssetImage(category.image!)
|
||||
: CachedNetworkImageProvider(category.image!),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
largeTheme.verticalSpacer,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Text(
|
||||
filter.name!,
|
||||
category.name!,
|
||||
style: theme.labelMedium.copyWith(
|
||||
color: actionAreaFGColors[filter.name!],
|
||||
color: actionAreaFGColors[category.name!],
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
@ -230,7 +241,7 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
child: Text(
|
||||
filter.description!,
|
||||
category.description!,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.onSurface,
|
||||
),
|
||||
|
@ -240,9 +251,9 @@ class ActionsPrePageState extends State<ActionsPrePage> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
child: Text(
|
||||
'Anzahl: ${filter.ids!.length}',
|
||||
'Anzahl: ${category.children}',
|
||||
style: theme.titleMedium.copyWith(
|
||||
color: actionAreaFGColors[filter.name!],
|
||||
color: actionAreaFGColors[category.name!],
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
|
@ -31,7 +31,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
}
|
||||
|
||||
initDataSource() {
|
||||
monthFilter = ItemFilterRepository().getByType('month');
|
||||
monthFilter = ItemFilterRepository().getByType('month')?.toList();
|
||||
for (String month in months) {
|
||||
DateTime now = DateTime.now();
|
||||
int monthInt = months.indexOf(month) + 1;
|
||||
|
|
56
pubspec.lock
56
pubspec.lock
|
@ -290,10 +290,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: equatable
|
||||
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
|
||||
sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.7"
|
||||
expandable_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -662,18 +662,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: jovial_misc
|
||||
sha256: f6e64f789ee311025bb367be9c9afe9759f76dd8209070b7f38e735b5f529eb1
|
||||
sha256: "4b10a4cac4f492d9692e97699bff775efa84abdba29909124cbccf3126e31cea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.5"
|
||||
version: "0.9.0"
|
||||
jovial_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: jovial_svg
|
||||
sha256: adbc985f89a9e9c601d29aebb9fc17dd0a5db05b67af7e6c21da91eeb13dacb7
|
||||
sha256: ca14d42956b9949c36333065c9141f100e930c918f57f4bd8dd59d35581bd3fc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.23"
|
||||
version: "1.1.24"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -694,10 +694,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: json_serializable
|
||||
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
|
||||
sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.8.0"
|
||||
version: "6.9.0"
|
||||
latlong2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -918,10 +918,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: percent_indicator
|
||||
sha256: c37099ad833a883c9d71782321cb65c3a848c21b6939b6185f0ff6640d05814c
|
||||
sha256: "0d77d5c6fa9b7f60202cedf748b568ba9ba38d3f30405d6ceae4da76f5185462"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.3"
|
||||
version: "4.2.4"
|
||||
permission_handler:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -950,10 +950,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_html
|
||||
sha256: "6b9cb54b7135073841a35513fba39e598b421702d5f4d92319992fd6eb5532a9"
|
||||
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3+4"
|
||||
version: "0.1.3+5"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -994,14 +994,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
pointycastle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.9.1"
|
||||
polylabel:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1134,10 +1126,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611"
|
||||
sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
@ -1195,10 +1187,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490"
|
||||
sha256: "761b9740ecbd4d3e66b8916d784e581861fd3c3553eda85e167bc49fdb68f709"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.4+5"
|
||||
version: "2.5.4+6"
|
||||
sqflite_darwin:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1259,34 +1251,34 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_flutter_calendar
|
||||
sha256: "00703dd2e154ad534e7e898958f1e4c1573b15a19448c0b183365f4b9779f054"
|
||||
sha256: "0f049bbc7ea1f86a22db7c9090d967c71dc1c72f36b83393c66090141c37f819"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "27.2.2"
|
||||
version: "27.2.3"
|
||||
syncfusion_flutter_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_core
|
||||
sha256: "225b1cc135549bb4eef096d63b7323c30ee61c4b095c7e8a14bf9333e243d84b"
|
||||
sha256: a39ddfb22b30c7cba620fec7dc682e46f151998febd25bca5519c17431084951
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "27.2.2"
|
||||
version: "27.2.3"
|
||||
syncfusion_flutter_datepicker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_flutter_datepicker
|
||||
sha256: e2e2a97b033390f0791316c6019743991aa598563d09f603ba13230cd50b8905
|
||||
sha256: "5af3301119607fe834ca0d222013102884e6644fc8324430a8ff56f73442e3d5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "27.2.2"
|
||||
version: "27.2.3"
|
||||
syncfusion_localizations:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_localizations
|
||||
sha256: c821c64ce38126ce1f5e5a36bc433157d49a03f04c19b45878cb82cca6267fde
|
||||
sha256: d6123f30f100a3e5e1dc235c6195194f5b82ca51fa8ce94718812b8b05120b60
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "27.2.2"
|
||||
version: "27.2.3"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Loading…
Reference in a new issue