Categorypage -> responsive, collapsible,

This commit is contained in:
reinjens 2024-11-20 17:09:53 +01:00
parent c0608d9cff
commit ed31c1e4dc
49 changed files with 481 additions and 427 deletions

View file

@ -1,28 +1,4 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
linter: linter:
# The lint rules applied to this project can be customized in the rules:
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View file

@ -1,11 +1,9 @@
import 'package:ambito/src/config/config.dart';
import 'package:ambito/src/consts/consts.dart';
import 'package:ambito/src/packages/ambito_api/base_api.dart'; 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_db/base_db.dart';
import 'package:ambito/src/packages/ambito_notifier/notifier/theme_manager.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/packages/ambito_sharedprefs/ambito_sharedprefs.dart';
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
import 'package:ambito/src/packages/ambito_theme/ambito_theme_large.dart';
import 'package:ambito/src/packages/ambito_theme/ambito_theme_medium.dart';
import 'package:ambito/src/packages/ambito_theme/ambito_theme_small.dart';
import 'package:ambito/src/pages/actions/actions_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_pre_page.dart';
import 'package:ambito/src/pages/actions/create/action_create_page.dart'; import 'package:ambito/src/pages/actions/create/action_create_page.dart';
@ -18,85 +16,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:isar/isar.dart';
import 'package:logger/logger.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:syncfusion_localizations/syncfusion_localizations.dart'; import 'package:syncfusion_localizations/syncfusion_localizations.dart';
final Logger logger = Logger(
printer: PrettyPrinter(),
);
const BreakpointConfiguration myBreakpoints = BreakpointConfiguration(
xs: Breakpoint(
breakpoint: 0,
width: double.infinity,
margin: 16,
padding: 0,
columns: 4,
),
sm: Breakpoint(
breakpoint: 320,
width: double.infinity,
margin: 32,
padding: 10,
columns: 8,
),
md: Breakpoint(
breakpoint: 905,
width: 840,
margin: null,
padding: 0,
columns: 12,
),
lg: Breakpoint(
breakpoint: 1240,
width: 1152,
margin: 0,
padding: 0,
columns: 12,
),
xl: Breakpoint(
breakpoint: 1440,
width: 1152,
margin: null,
padding: 0,
columns: 12,
),
xxl: null,
);
late Isar isar;
late SharedPreferences prefs;
AmbitoTheme largeTheme = AmbitoThemeLarge();
AmbitoTheme mediumTheme = AmbitoThemeMedium();
AmbitoTheme smallTheme = AmbitoThemeSmall();
const BASEROW_TOKEN = 'TFxO7vzBLVRCu9I3VMoHmTuCvSu8aCDi';
const BASEROW_IDS = {
"measure": 328253,
"measure_combination": 328217,
"organism": 328255,
"funding_program": 328256,
"factsheet": 328273,
"location_requirements": 328188,
"reference_implementation": 328465,
"business": 328472,
"experience_report": 330802,
"approval_requirement": 330806,
"service_provider": 330824,
"service_provider_contact_person": 330832,
"material": 330836,
"source": 334231,
"tree_type": 342622,
"aenderungfactsheet": 330946,
};
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
//await dotenv.load(fileName: '.env');
await AmbitoSharedPrefs.start(); await AmbitoSharedPrefs.start();
await AmbitoIsarDB.init(); await AmbitoIsarDB.init();
await Future.wait([ await Future.wait([
@ -113,11 +38,8 @@ void main() async {
//BaseApi().getContent('material'), //BaseApi().getContent('material'),
//BaseApi().getContent('source'), //BaseApi().getContent('source'),
]); ]);
await MeasureRepository().buildMeasureFilters(); await MeasureRepository().buildMeasureFilters();
//await MeasureRepository().downloadImages();
await MeasureRepository().downloadImages();
runApp(const Ambito()); runApp(const Ambito());
} }
@ -151,8 +73,8 @@ class Ambito extends StatelessWidget {
SfGlobalLocalizations.delegate, SfGlobalLocalizations.delegate,
], ],
title: 'AmBiTo', title: 'AmBiTo',
supportedLocales: const [Locale('de')], supportedLocales: supportedLocales,
locale: const Locale('de'), locale: ThemeManager().locale,
builder: FlutterI18n.rootAppBuilder(), builder: FlutterI18n.rootAppBuilder(),
theme: ThemeManager().themeData?.lightThemeData, theme: ThemeManager().themeData?.lightThemeData,
darkTheme: ThemeManager().themeData?.darkThemeData, darkTheme: ThemeManager().themeData?.darkThemeData,

View file

@ -0,0 +1,66 @@
import 'dart:ui';
import 'package:screen_breakpoints/screen_breakpoints.dart';
const supportedLocales = [Locale('de')];
const currentLocale = Locale('de');
/// configure the used breakpoints. Currently only sm is handled separately
const BreakpointConfiguration myBreakpoints = BreakpointConfiguration(
xs: Breakpoint(
breakpoint: 0,
width: double.infinity,
margin: 16,
padding: 0,
columns: 4,
),
sm: Breakpoint(
breakpoint: 320,
width: double.infinity,
margin: 10,
padding: 10,
columns: 8,
),
md: Breakpoint(
breakpoint: 905,
width: 840,
margin: null,
padding: 0,
columns: 12,
),
lg: Breakpoint(
breakpoint: 1240,
width: 1152,
margin: 0,
padding: 0,
columns: 12,
),
xl: Breakpoint(
breakpoint: 1440,
width: 1152,
margin: null,
padding: 0,
columns: 12,
),
xxl: null,
);
const baserowToken = 'TFxO7vzBLVRCu9I3VMoHmTuCvSu8aCDi';
const baserowIds = {
"measure": 328253,
"measure_combination": 328217,
"organism": 328255,
"funding_program": 328256,
"factsheet": 328273,
"location_requirements": 328188,
"reference_implementation": 328465,
"business": 328472,
"experience_report": 330802,
"approval_requirement": 330806,
"service_provider": 330824,
"service_provider_contact_person": 330832,
"material": 330836,
"source": 334231,
"tree_type": 342622,
"aenderungfactsheet": 330946,
};

View file

@ -1,3 +1,12 @@
import 'package:isar/isar.dart';
import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../packages/ambito_theme/ambito_theme.dart';
import '../packages/ambito_theme/ambito_theme_large.dart';
import '../packages/ambito_theme/ambito_theme_medium.dart';
import '../packages/ambito_theme/ambito_theme_small.dart';
const List<String> months = [ const List<String> months = [
'Januar', 'Januar',
'Februar', 'Februar',
@ -12,3 +21,13 @@ const List<String> months = [
'November', 'November',
'Dezember', 'Dezember',
]; ];
final Logger logger = Logger(
printer: PrettyPrinter(),
);
late Isar isar;
late SharedPreferences prefs;
final AmbitoTheme largeTheme = AmbitoThemeLarge();
final AmbitoTheme mediumTheme = AmbitoThemeMedium();
final AmbitoTheme smallTheme = AmbitoThemeSmall();

View file

@ -3,15 +3,15 @@ import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:ambito/src/packages/ambito_notifier/notifier/filter_notifier.dart'; import 'package:ambito/src/packages/ambito_notifier/notifier/filter_notifier.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../../consts/consts.dart';
import '../../../widgets/form/fields/field_dropdown.dart'; import '../../../widgets/form/fields/field_dropdown.dart';
class ItemFilterRepository extends BaseDB { class ItemFilterRepository extends BaseDB {
@override @override
IsarCollection collection = isar.itemFilters; IsarCollection collection = isar.itemFilters;
List<ItemFilter>? getByType(String type) { Set<ItemFilter>? getByType(String type) {
return isar.itemFilters.where().typeEqualTo(type).findAll(); return isar.itemFilters.where().typeEqualTo(type).findAll().toSet();
} }
List<dynamic>? getIdsByType(String type) { List<dynamic>? getIdsByType(String type) {
@ -41,7 +41,7 @@ class ItemFilterRepository extends BaseDB {
FieldDropdown getDropDown(String type, String label) { FieldDropdown getDropDown(String type, String label) {
if (type == 'month') {} if (type == 'month') {}
List<ItemFilter> filterItems = getByType(type)!; Set<ItemFilter> filterItems = getByType(type)!;
return FieldDropdown( return FieldDropdown(
name: type, name: type,

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class ApprovalRequirementRepository extends BaseDB { class ApprovalRequirementRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class BusinessRepository extends BaseDB { class BusinessRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class ExperienceReportRepository extends BaseDB { class ExperienceReportRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class FundingProgramRepository extends BaseDB { class FundingProgramRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class LocationRequirementsRepository extends BaseDB { class LocationRequirementsRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class MaterialRepository extends BaseDB { class MaterialRepository extends BaseDB {
@override @override

View file

@ -4,7 +4,7 @@ import 'package:ambito/src/extensions/extensions.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class MeasureRepository extends BaseDB { class MeasureRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class MeasureCombinationRepository extends BaseDB { class MeasureCombinationRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class NumberFactsheetRepository extends BaseDB { class NumberFactsheetRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class OrganismRepository extends BaseDB { class OrganismRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class ReferenceImplementationRepository extends BaseDB { class ReferenceImplementationRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class ServiceProviderContactPersonRepository extends BaseDB { class ServiceProviderContactPersonRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class ServiceProviderRepository extends BaseDB { class ServiceProviderRepository extends BaseDB {
@override @override

View file

@ -2,7 +2,7 @@ import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart'; import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
class SourceRepository extends BaseDB { class SourceRepository extends BaseDB {
@override @override

View file

@ -1,7 +1,7 @@
import 'package:ambito/src/entity/entities.dart'; import 'package:ambito/src/entity/entities.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../../main.dart'; import '../../consts/consts.dart';
import '../../packages/ambito_db/base_db.dart'; import '../../packages/ambito_db/base_db.dart';
class TreeTypeRepository extends BaseDB { class TreeTypeRepository extends BaseDB {

View file

@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:ambito/src/entity/entities.dart'; import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/packages/ambito_api/restclient.dart'; import 'package:ambito/src/packages/ambito_api/restclient.dart';
import '../../../main.dart'; import '../../config/config.dart';
import '../ambito_db/base_db.dart'; import '../ambito_db/base_db.dart';
class BaseApi { class BaseApi {
@ -11,7 +11,7 @@ class BaseApi {
init() { init() {
// read table ids from .env file... // read table ids from .env file...
tables = BASEROW_IDS; tables = baserowIds;
} }
Future<bool> getContent(String table) async { Future<bool> getContent(String table) async {

View file

@ -3,9 +3,11 @@ library vyc_api;
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:ambito/main.dart'; import 'package:ambito/src/config/config.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import '../../consts/consts.dart';
class RestClient { class RestClient {
final String baseUrl = 'https://api.baserow.io/api/database/rows/table/'; final String baseUrl = 'https://api.baserow.io/api/database/rows/table/';
static final http.Client _client = http.Client(); static final http.Client _client = http.Client();
@ -19,7 +21,7 @@ class RestClient {
var headers = { var headers = {
"Content-Type": contentType, "Content-Type": contentType,
"Accept": accept, "Accept": accept,
"Authorization": "Token $BASEROW_TOKEN", "Authorization": "Token $baserowToken",
}; };
return headers; return headers;
} }

View file

@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import '../../../main.dart'; import '../../consts/consts.dart';
export 'repositories/_repositories.dart'; export 'repositories/_repositories.dart';

View file

@ -1,4 +1,4 @@
import '../../../main.dart'; import '../../consts/consts.dart';
class AmbitoDownloader { class AmbitoDownloader {
static Future<bool> downloadImage( static Future<bool> downloadImage(

View file

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../main.dart'; import '../../consts/consts.dart';
class AmbitoFormBuilder { class AmbitoFormBuilder {
String type = ''; String type = '';

View file

@ -1,7 +1,8 @@
import 'package:ambito/main.dart';
import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart'; import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '../../../consts/consts.dart';
AmbitoFilterNotifier ambitoFilterNotifier = AmbitoFilterNotifier(); AmbitoFilterNotifier ambitoFilterNotifier = AmbitoFilterNotifier();
class AmbitoFilterNotifier extends ChangeNotifier { class AmbitoFilterNotifier extends ChangeNotifier {
@ -30,7 +31,9 @@ class AmbitoFilterNotifier extends ChangeNotifier {
}); });
} }
List<int>? getMergedIds() {} List<int>? getMergedIds() {
return null;
}
String? getFilter(String type) { String? getFilter(String type) {
return activeFilters[type]; return activeFilters[type];

View file

@ -5,15 +5,28 @@ import 'package:flutter/cupertino.dart';
class ThemeManager with ChangeNotifier { class ThemeManager with ChangeNotifier {
AmbitoTheme? _themeData; AmbitoTheme? _themeData;
Locale? _locale;
/// Use this method on UI to get selected theme. /// Use this method on UI to get selected theme.
AmbitoTheme? get themeData { AmbitoTheme? get themeData {
_themeData ??= AmbitoThemeMedium(); _themeData ??= AmbitoThemeMedium();
return _themeData; return _themeData;
} }
Locale? get locale {
_locale ??= const Locale('de');
return _locale;
}
/// Sets theme and notifies listeners about change. /// Sets theme and notifies listeners about change.
setTheme(AmbitoTheme theme) async { setTheme(AmbitoTheme theme) async {
_themeData = theme; _themeData = theme;
notifyListeners(); notifyListeners();
} }
/// Sets locale and notifies listeners about change
setLocale(Locale locale) async {
_locale = locale;
notifyListeners();
}
} }

View file

@ -1,6 +1,6 @@
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../../../main.dart'; import '../../consts/consts.dart';
class AmbitoSharedPrefs { class AmbitoSharedPrefs {
static Future<SharedPreferences> start() async { static Future<SharedPreferences> start() async {

View file

@ -3,7 +3,8 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../../main.dart'; import '../../config/config.dart';
import '../../consts/consts.dart';
final orangeColors = { final orangeColors = {
'primary': const Color(0xffeebb4b), 'primary': const Color(0xffeebb4b),
@ -56,10 +57,10 @@ AmbitoTheme getTheme(BuildContext context) {
return largeTheme; return largeTheme;
} }
if (breakpoint >= myBreakpoints.sm) { if (breakpoint >= myBreakpoints.sm) {
ThemeManager().setTheme(smallTheme); ThemeManager().setTheme(mediumTheme);
return mediumTheme; return mediumTheme;
} }
ThemeManager().setTheme(mediumTheme); ThemeManager().setTheme(smallTheme);
return smallTheme; return smallTheme;
} }

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
class AmbitoThemeLarge extends AmbitoTheme { class AmbitoThemeLarge extends AmbitoTheme {
@override
TextTheme get textTheme => TextTheme( TextTheme get textTheme => TextTheme(
displayLarge: GoogleFonts.openSans( displayLarge: GoogleFonts.openSans(
fontSize: 57, fontSize: 57,

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
class AmbitoThemeMedium extends AmbitoTheme { class AmbitoThemeMedium extends AmbitoTheme {
@override
TextTheme get textTheme => TextTheme( TextTheme get textTheme => TextTheme(
displayLarge: GoogleFonts.openSans( displayLarge: GoogleFonts.openSans(
fontSize: 57, fontSize: 57,

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
class AmbitoThemeSmall extends AmbitoTheme { class AmbitoThemeSmall extends AmbitoTheme {
@override
TextTheme get textTheme => TextTheme( TextTheme get textTheme => TextTheme(
displayLarge: GoogleFonts.openSans( displayLarge: GoogleFonts.openSans(
fontSize: 57, fontSize: 57,
@ -22,19 +23,19 @@ class AmbitoThemeSmall extends AmbitoTheme {
letterSpacing: 0, letterSpacing: 0,
), ),
headlineLarge: GoogleFonts.openSans( headlineLarge: GoogleFonts.openSans(
fontSize: 32, fontSize: 18,
height: 1.25, height: 1.25,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
letterSpacing: 0, letterSpacing: 0,
), ),
headlineMedium: GoogleFonts.openSans( headlineMedium: GoogleFonts.openSans(
fontSize: 28, fontSize: 20,
height: 1.29, height: 1.29,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
letterSpacing: 0, letterSpacing: 0,
), ),
headlineSmall: GoogleFonts.openSans( headlineSmall: GoogleFonts.openSans(
fontSize: 24, fontSize: 16,
height: 1.33, height: 1.33,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
letterSpacing: 0, letterSpacing: 0,

View file

@ -210,10 +210,13 @@ class ActionsPageState extends State<ActionsPage> {
return getCard(context, massnahme); return getCard(context, massnahme);
}).toList(); }).toList();
final AmbitoTheme theme = getTheme(context);
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32), padding: const EdgeInsets.symmetric(horizontal: 32),
@ -357,7 +360,7 @@ class ActionsPageState extends State<ActionsPage> {
), ),
Expanded( Expanded(
child: Padding( child: Padding(
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View file

@ -1,14 +1,16 @@
import 'package:ambito/src/config/config.dart';
import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart'; import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart';
import 'package:ambito/src/entity/entities.dart'; import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/entity/measure/measure_repository.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/pages/ambito_page.dart';
import 'package:ambito/src/widgets/page/base_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../../main.dart'; import '../../consts/consts.dart';
import '../../packages/ambito_theme/ambito_theme.dart'; import '../../packages/ambito_theme/ambito_theme.dart';
import '../../widgets/appbar/ambito_appbar.dart';
class ActionsPrePage extends AmbitoPage { class ActionsPrePage extends AmbitoPage {
const ActionsPrePage({super.key}); const ActionsPrePage({super.key});
@ -23,91 +25,17 @@ class ActionsPrePage extends AmbitoPage {
} }
class ActionsPrePageState extends State<ActionsPrePage> { class ActionsPrePageState extends State<ActionsPrePage> {
List<Widget> cards = []; Set<Widget> cards = {};
Map<String, int> counter = {}; Map<String, int> counter = {};
Map<String, int> ids = {}; Map<String, int> ids = {};
int counterComplete = 0; int counterComplete = 0;
Set<ItemFilter>? filters;
@override @override
void initState() { void initState() {
List<ItemFilter>? filters = ItemFilterRepository().getByType('areaType'); cards = {};
filters = ItemFilterRepository().getByType('areaType');
counterComplete = MeasureRepository().getMeasureCount(); counterComplete = MeasureRepository().getMeasureCount();
for (ItemFilter filter in filters!) {
setState(() {
cards.add(
InkWell(
onTap: () {
prefs.setString('selected_areaType', filter.name!).then((value) {
Get.toNamed('/massnahmendatenbank/${filter.name}');
setState(() {});
});
},
onHover: (hovered) {},
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
child: SizedBox(
width: 262,
height: 380,
child: Card(
elevation: 0,
color: actionAreaColors[filter.name!],
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.asset(
filter.image!,
),
),
largeTheme.verticalSpacer,
Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Text(
filter.name!,
style: largeTheme.currentThemeData.textTheme.labelMedium
?.copyWith(
color: actionAreaFGColors[filter.name!],
fontWeight: FontWeight.bold,
),
),
),
largeTheme.verticalSpacer,
Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Text(
filter.description!,
style: largeTheme.currentThemeData.textTheme.bodyMedium
?.copyWith(
color: largeTheme.currentColorScheme.onSurface,
),
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, bottom: 16),
child: Text(
'Anzahl: ${filter.ids!.length}',
style: largeTheme.currentThemeData.textTheme.titleMedium
?.copyWith(
color: actionAreaFGColors[filter.name!],
fontWeight: FontWeight.bold,
),
),
),
],
),
),
),
),
);
});
}
super.initState(); super.initState();
} }
@ -115,12 +43,19 @@ class ActionsPrePageState extends State<ActionsPrePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context); final AmbitoTheme theme = getTheme(context);
return Scaffold( setState(() {
appBar: AmbitoAppbar( cards = {};
links: const ['dashboard', 'massnahmen'], });
breakpoint: Breakpoint.fromContext(context),
), for (ItemFilter filter in filters!) {
body: BreakpointBuilder(builder: ( setState(() {
cards.add(_buildCard(context, filter));
});
}
return BasePage().getPage(
context,
BreakpointBuilder(builder: (
context, context,
breakpoint, breakpoint,
configuration, configuration,
@ -135,20 +70,22 @@ class ActionsPrePageState extends State<ActionsPrePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(breakpoint.toString()), Text(breakpoint.toString()),
theme.verticalSpacerMax, theme.verticalSpacer,
Text( Text(
'Maßnahmenkategorien', context.translate('page.general.links.massnahmen.title'),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: theme.currentThemeData.textTheme.headlineLarge style: theme.headlineLarge.copyWith(
?.copyWith(
color: theme.currentColorScheme.onSurface, color: theme.currentColorScheme.onSurface,
), ),
), ),
theme.verticalSpacerMax, theme.verticalSpacerMax,
Wrap( Align(
alignment: WrapAlignment.center, alignment: Alignment.center,
spacing: 32, child: Wrap(
children: cards, alignment: WrapAlignment.center,
spacing: 32,
children: cards.toList(),
),
), ),
theme.verticalSpacerMax, theme.verticalSpacerMax,
InkWell( InkWell(
@ -189,4 +126,130 @@ class ActionsPrePageState extends State<ActionsPrePage> {
}), }),
); );
} }
Widget _buildCard(BuildContext context, ItemFilter filter) {
return InkWell(
onTap: () {
prefs.setString('selected_areaType', filter.name!).then((value) {
Get.toNamed('/massnahmendatenbank/${filter.name}');
});
},
onHover: (hovered) {},
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
child: context.breakpoint.breakpoint == myBreakpoints.sm!.breakpoint
? _smallCard(filter)
: _normalCard(filter),
);
}
Widget _smallCard(ItemFilter filter) {
final AmbitoTheme theme = getTheme(context);
return Padding(
padding: EdgeInsets.only(bottom: 10),
child: Container(
height: 180,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: AssetImage(filter.image!),
fit: BoxFit.cover,
),
),
child: Column(
children: [
const Expanded(child: SizedBox()),
Container(
height: 80,
decoration: BoxDecoration(
color: actionAreaFGColors[filter.name!]!.withOpacity(.6),
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10)),
),
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
filter.name!,
style: theme.labelMedium.copyWith(
color: theme.currentColorScheme.onPrimary,
fontWeight: FontWeight.bold,
),
),
Text(
'Anzahl: ${filter.ids!.length}',
style: theme.titleMedium.copyWith(
color: theme.currentColorScheme.onPrimary,
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
),
);
}
Widget _normalCard(ItemFilter filter) {
final AmbitoTheme theme = getTheme(context);
return SizedBox(
width: 262,
height: 380,
child: Card(
elevation: 0,
color: actionAreaColors[filter.name!],
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.asset(
filter.image!,
),
),
largeTheme.verticalSpacer,
Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Text(
filter.name!,
style: theme.labelMedium.copyWith(
color: actionAreaFGColors[filter.name!],
fontWeight: FontWeight.bold,
),
),
),
largeTheme.verticalSpacer,
Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Text(
filter.description!,
style: theme.bodyMedium.copyWith(
color: theme.currentColorScheme.onSurface,
),
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Text(
'Anzahl: ${filter.ids!.length}',
style: theme.titleMedium.copyWith(
color: actionAreaFGColors[filter.name!],
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
} }

View file

@ -35,9 +35,9 @@ class ActionsCreatePageState extends State<ActionsCreatePage> {
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
), theme: theme),
body: BreakpointBuilder(builder: ( body: BreakpointBuilder(builder: (
context, context,
breakpoint, breakpoint,

View file

@ -1,4 +1,3 @@
import 'package:ambito/main.dart';
import 'package:ambito/src/entity/entities.dart'; import 'package:ambito/src/entity/entities.dart';
import 'package:ambito/src/entity/measure/measure_repository.dart'; import 'package:ambito/src/entity/measure/measure_repository.dart';
import 'package:ambito/src/extensions/extensions.dart'; import 'package:ambito/src/extensions/extensions.dart';
@ -9,6 +8,7 @@ import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../../config/config.dart';
import '../../../packages/ambito_theme/ambito_theme.dart'; import '../../../packages/ambito_theme/ambito_theme.dart';
import '../../../widgets/appbar/ambito_appbar.dart'; import '../../../widgets/appbar/ambito_appbar.dart';
import '../../ambito_page.dart'; import '../../ambito_page.dart';
@ -61,6 +61,7 @@ class ActionDetailPageState extends State<ActionDetailPage> {
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: (context.breakpoint != myBreakpoints.sm) body: (context.breakpoint != myBreakpoints.sm)
? _buildInfoPage(context, massnahme) ? _buildInfoPage(context, massnahme)

View file

@ -1,7 +1,5 @@
import 'package:ambito/src/extensions/extensions.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_rating/flutter_rating.dart'; import 'package:flutter_rating/flutter_rating.dart';
import 'package:flutter_rating_stars/flutter_rating_stars.dart';
import '../../../../entity/entities.dart'; import '../../../../entity/entities.dart';
import '../../../../packages/ambito_theme/ambito_theme.dart'; import '../../../../packages/ambito_theme/ambito_theme.dart';
@ -58,56 +56,5 @@ class ReviewCard extends StatelessWidget {
), ),
], ],
); );
return SizedBox(
width: double.infinity,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
elevation: 0,
color: theme.currentColorScheme.tertiary,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.translate('page.actionDetailPage.review.title'),
style: theme.currentThemeData.textTheme.titleMedium,
),
theme.verticalSpacer,
RatingStars(
value: 4.5,
onValueChanged: (v) {},
starBuilder: (index, color) => Icon(
Icons.star,
color: color,
),
starCount: 5,
starSize: 32,
valueLabelColor: const Color(0xff9b9b9b),
valueLabelTextStyle: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 12.0),
valueLabelRadius: 10,
maxValue: 5,
starSpacing: 2,
maxValueVisibility: true,
valueLabelVisibility: false,
animationDuration: const Duration(milliseconds: 1000),
valueLabelPadding:
const EdgeInsets.symmetric(vertical: 1, horizontal: 8),
valueLabelMargin: const EdgeInsets.only(right: 8),
starOffColor: Colors.yellow.withOpacity(.3),
starColor: Colors.yellow,
),
],
),
),
),
);
} }
} }

View file

@ -22,7 +22,7 @@ class CalendarPage extends StatefulWidget {
class CalendarPageState extends State<CalendarPage> { class CalendarPageState extends State<CalendarPage> {
List<Appointment> appointments = <Appointment>[]; List<Appointment> appointments = <Appointment>[];
List<ItemFilter>? monthFilter = []; Set<ItemFilter>? monthFilter = {};
@override @override
void initState() { void initState() {
@ -62,10 +62,13 @@ class CalendarPageState extends State<CalendarPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: Center( body: Center(
child: Padding( child: Padding(
@ -89,7 +92,7 @@ class CalendarPageState extends State<CalendarPage> {
List<Appointment> appointments = <Appointment>[]; List<Appointment> appointments = <Appointment>[];
appointments.add(Appointment( appointments.add(Appointment(
startTime: DateTime.now(), startTime: DateTime.now(),
endTime: DateTime.now().add(Duration(minutes: 10)), endTime: DateTime.now().add(const Duration(minutes: 10)),
subject: 'Meeting', subject: 'Meeting',
isAllDay: true, isAllDay: true,
color: Colors.blue, color: Colors.blue,

View file

@ -1,10 +1,13 @@
import 'package:ambito/main.dart'; import 'package:ambito/src/config/config.dart';
import 'package:ambito/src/entity/_general/filter/item_filter.dart'; import 'package:ambito/src/entity/_general/filter/item_filter.dart';
import 'package:ambito/src/entity/measure/measure_repository.dart'; import 'package:ambito/src/entity/measure/measure_repository.dart';
import 'package:ambito/src/packages/ambito_notifier/notifier/theme_manager.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../consts/consts.dart'; import '../../consts/consts.dart';
import '../../packages/ambito_theme/ambito_theme.dart';
import '../../widgets/appbar/ambito_appbar.dart'; import '../../widgets/appbar/ambito_appbar.dart';
class CalendarPageYear extends StatefulWidget { class CalendarPageYear extends StatefulWidget {
@ -25,11 +28,16 @@ class CalendarPageYearState extends State<CalendarPageYear> {
@override @override
void initState() { void initState() {
initDataSource(); ThemeManager().addListener(_updateState);
super.initState(); super.initState();
} }
initDataSource() { void _updateState() {
setState(() {});
}
initDataSource(BuildContext context, AmbitoTheme theme) {
List<TableCell> cells = [ List<TableCell> cells = [
TableCell( TableCell(
child: Padding( child: Padding(
@ -48,15 +56,20 @@ class CalendarPageYearState extends State<CalendarPageYear> {
verticalAlignment: TableCellVerticalAlignment.middle, verticalAlignment: TableCellVerticalAlignment.middle,
child: Text( child: Text(
textAlign: TextAlign.center, textAlign: TextAlign.center,
month, (context.breakpoint.breakpoint == myBreakpoints.sm!.breakpoint)
style: largeTheme.currentThemeData.textTheme.titleMedium ? month.substring(0, 1)
: (context.breakpoint.breakpoint ==
myBreakpoints.md!.breakpoint)
? month.substring(0, 3)
: month,
style: theme.titleMedium
?.copyWith(fontWeight: FontWeight.bold, color: Colors.white), ?.copyWith(fontWeight: FontWeight.bold, color: Colors.white),
), ),
), ),
); );
} }
rowsHeader.add(TableRow( rowsHeader.add(TableRow(
decoration: const BoxDecoration(color: Color(0xFF60845E)), decoration: BoxDecoration(color: theme.currentColorScheme.secondary),
children: cells)); children: cells));
var massnahmen = MeasureRepository().getAllOrdered(); var massnahmen = MeasureRepository().getAllOrdered();
for (var massnahme in massnahmen) { for (var massnahme in massnahmen) {
@ -65,8 +78,18 @@ class CalendarPageYearState extends State<CalendarPageYear> {
TableCell( TableCell(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Text( child: TextButton(
massnahme.name!, onPressed: () {
Get.toNamed('/massnahme/${massnahme.id}');
},
child: Align(
alignment: Alignment.centerLeft,
child: Text(
textAlign: TextAlign.start,
massnahme.name!,
style: theme.bodySmall,
),
),
), ),
), ),
), ),
@ -80,7 +103,7 @@ class CalendarPageYearState extends State<CalendarPageYear> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: 44, height: 44,
color: largeTheme.currentColorScheme.primary, color: theme.currentColorScheme.secondary,
), ),
), ),
); );
@ -107,52 +130,23 @@ class CalendarPageYearState extends State<CalendarPageYear> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
rowsHeader = [];
rowsBody = [];
initDataSource(context, theme);
double fixedWidth = 120; double fixedWidth = 120;
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: Card( body: Card(
child: Column( child: Column(
children: [ children: [
/*Padding(
padding: const EdgeInsets.only(top: 32, left: 32, right: 32),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FilterChip(
label: const Text('Zeitraum der Anlage'),
selected: displayFilterSet.contains('creation'),
selectedColor: baseTheme.currentColorScheme.primary,
onSelected: (bool selected) {
setState(() {
if (selected) {
displayFilterSet.add('creation');
} else {
displayFilterSet.remove('creation');
}
});
},
),
baseTheme.horizontalSpacerSmall,
FilterChip(
label: const Text('Zeitraum der Pflege'),
selected: displayFilterSet.contains('maintenance'),
selectedColor: baseTheme.currentColorScheme.inversePrimary,
onSelected: (bool selected) {
setState(() {
if (selected) {
displayFilterSet.add('maintenance');
} else {
displayFilterSet.remove('maintenance');
}
});
},
),
],
),
),*/
Padding( Padding(
padding: const EdgeInsets.only(top: 32, left: 32, right: 32), padding: const EdgeInsets.only(top: 32, left: 32, right: 32),
child: _buildTableHeader(fixedWidth), child: _buildTableHeader(fixedWidth),

View file

@ -62,10 +62,12 @@ class CalendarPageState extends State<CalendarPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: Center( body: Center(
child: Padding( child: Padding(
@ -89,7 +91,7 @@ class CalendarPageState extends State<CalendarPage> {
List<Appointment> appointments = <Appointment>[]; List<Appointment> appointments = <Appointment>[];
appointments.add(Appointment( appointments.add(Appointment(
startTime: DateTime.now(), startTime: DateTime.now(),
endTime: DateTime.now().add(Duration(minutes: 10)), endTime: DateTime.now().add(const Duration(minutes: 10)),
subject: 'Meeting', subject: 'Meeting',
isAllDay: true, isAllDay: true,
color: Colors.blue, color: Colors.blue,

View file

@ -4,7 +4,6 @@ import 'package:get/get.dart';
import 'package:percent_indicator/linear_percent_indicator.dart'; import 'package:percent_indicator/linear_percent_indicator.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../../main.dart';
import '../../widgets/appbar/ambito_appbar.dart'; import '../../widgets/appbar/ambito_appbar.dart';
class DashboardPage extends StatefulWidget { class DashboardPage extends StatefulWidget {
@ -23,6 +22,16 @@ class DashboardPageState extends State<DashboardPage> {
@override @override
void initState() { void initState() {
cards = [];
super.initState();
}
@override
Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
cards = [];
cards.add( cards.add(
_buildCard( _buildCard(
Colors.green, Colors.green,
@ -55,15 +64,12 @@ class DashboardPageState extends State<DashboardPage> {
'/dashboard/stammdaten', '/dashboard/stammdaten',
), ),
); );
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'], links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Align( child: Align(
@ -75,22 +81,21 @@ class DashboardPageState extends State<DashboardPage> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
largeTheme.verticalSpacerMax, theme.verticalSpacerMax,
Text( Text(
'Willkommen, Max Mustermann!', 'Willkommen, Max Mustermann!',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme.currentThemeData.textTheme.headlineLarge style: theme.headlineLarge.copyWith(
?.copyWith( color: theme.currentColorScheme.onSurface,
color: largeTheme.currentColorScheme.onSurface,
), ),
), ),
largeTheme.verticalSpacerMax, theme.verticalSpacerMax,
Wrap( Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
spacing: 32, spacing: 32,
children: cards, children: cards,
), ),
largeTheme.verticalSpacerMax, theme.verticalSpacerMax,
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -103,13 +108,11 @@ class DashboardPageState extends State<DashboardPage> {
Text( Text(
'Biodiversitätsbewertung', 'Biodiversitätsbewertung',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme.headlineMedium.copyWith(
.currentThemeData.textTheme.headlineMedium color: theme.currentColorScheme.onSurface,
?.copyWith(
color: largeTheme.currentColorScheme.onSurface,
), ),
), ),
largeTheme.verticalSpacer, theme.verticalSpacer,
SizedBox( SizedBox(
width: 532, width: 532,
child: Card( child: Card(
@ -123,14 +126,14 @@ class DashboardPageState extends State<DashboardPage> {
Text( Text(
'Fragebögen', 'Fragebögen',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: largeTheme.currentThemeData style: theme.currentThemeData.textTheme
.textTheme.headlineSmall .headlineSmall
?.copyWith( ?.copyWith(
color: orangeColors['primary'], color: orangeColors['primary'],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Row( Row(
children: [ children: [
LinearPercentIndicator( LinearPercentIndicator(
@ -139,8 +142,8 @@ class DashboardPageState extends State<DashboardPage> {
animation: true, animation: true,
percent: 0.8, percent: 0.8,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
backgroundColor: largeTheme backgroundColor:
.currentColorScheme.surface, theme.currentColorScheme.surface,
progressColor: progressColor:
orangeColors['primary'], orangeColors['primary'],
barRadius: const Radius.circular(8), barRadius: const Radius.circular(8),
@ -166,15 +169,15 @@ class DashboardPageState extends State<DashboardPage> {
), ),
], ],
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Text( Text(
'4 / 5 abgeschlossen', '4 / 5 abgeschlossen',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme
.currentThemeData.textTheme.bodyLarge .currentThemeData.textTheme.bodyLarge
?.copyWith( ?.copyWith(
color: largeTheme color:
.currentColorScheme.onSurface, theme.currentColorScheme.onSurface,
), ),
), ),
], ],
@ -182,7 +185,7 @@ class DashboardPageState extends State<DashboardPage> {
), ),
), ),
), ),
largeTheme.verticalSpacer, theme.verticalSpacer,
SizedBox( SizedBox(
width: 532, width: 532,
child: Card( child: Card(
@ -196,14 +199,14 @@ class DashboardPageState extends State<DashboardPage> {
Text( Text(
'Ergebnisse', 'Ergebnisse',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: largeTheme.currentThemeData style: theme.currentThemeData.textTheme
.textTheme.headlineSmall .headlineSmall
?.copyWith( ?.copyWith(
color: greenColors['primary'], color: greenColors['primary'],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Row( Row(
children: [ children: [
LinearPercentIndicator( LinearPercentIndicator(
@ -212,25 +215,25 @@ class DashboardPageState extends State<DashboardPage> {
animation: true, animation: true,
percent: 0.8, percent: 0.8,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
backgroundColor: largeTheme backgroundColor:
.currentColorScheme.surface, theme.currentColorScheme.surface,
progressColor: greenColors['primary'], progressColor: greenColors['primary'],
barRadius: const Radius.circular(8), barRadius: const Radius.circular(8),
), ),
], ],
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Text( Text(
'Weinberg: 80%', 'Weinberg: 80%',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme
.currentThemeData.textTheme.bodyLarge .currentThemeData.textTheme.bodyLarge
?.copyWith( ?.copyWith(
color: largeTheme color:
.currentColorScheme.onSurface, theme.currentColorScheme.onSurface,
), ),
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Row( Row(
children: [ children: [
LinearPercentIndicator( LinearPercentIndicator(
@ -239,25 +242,25 @@ class DashboardPageState extends State<DashboardPage> {
animation: true, animation: true,
percent: 0.52, percent: 0.52,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
backgroundColor: largeTheme backgroundColor:
.currentColorScheme.surface, theme.currentColorScheme.surface,
progressColor: greenColors['primary'], progressColor: greenColors['primary'],
barRadius: const Radius.circular(8), barRadius: const Radius.circular(8),
), ),
], ],
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Text( Text(
'Landschaft: 52%', 'Landschaft: 52%',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme
.currentThemeData.textTheme.bodyLarge .currentThemeData.textTheme.bodyLarge
?.copyWith( ?.copyWith(
color: largeTheme color:
.currentColorScheme.onSurface, theme.currentColorScheme.onSurface,
), ),
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Row( Row(
children: [ children: [
LinearPercentIndicator( LinearPercentIndicator(
@ -266,22 +269,22 @@ class DashboardPageState extends State<DashboardPage> {
animation: true, animation: true,
percent: 0.27, percent: 0.27,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
backgroundColor: largeTheme backgroundColor:
.currentColorScheme.surface, theme.currentColorScheme.surface,
progressColor: greenColors['primary'], progressColor: greenColors['primary'],
barRadius: const Radius.circular(8), barRadius: const Radius.circular(8),
), ),
], ],
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Text( Text(
'Betriebsstätte: 27%', 'Betriebsstätte: 27%',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme
.currentThemeData.textTheme.bodyLarge .currentThemeData.textTheme.bodyLarge
?.copyWith( ?.copyWith(
color: largeTheme color:
.currentColorScheme.onSurface, theme.currentColorScheme.onSurface,
), ),
), ),
], ],
@ -302,28 +305,27 @@ class DashboardPageState extends State<DashboardPage> {
Text( Text(
'Förderungen', 'Förderungen',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme
.currentThemeData.textTheme.headlineMedium .currentThemeData.textTheme.headlineMedium
?.copyWith( ?.copyWith(
color: largeTheme.currentColorScheme.onSurface, color: theme.currentColorScheme.onSurface,
), ),
), ),
largeTheme.verticalSpacer, theme.verticalSpacer,
Text( Text(
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme style: theme.currentThemeData.textTheme.bodyLarge
.currentThemeData.textTheme.bodyLarge
?.copyWith( ?.copyWith(
color: largeTheme.currentColorScheme.onSurface, color: theme.currentColorScheme.onSurface,
), ),
), ),
largeTheme.verticalSpacer, theme.verticalSpacer,
_buildProjectCard( _buildProjectCard(
'Projekt A', 'Projekt A',
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
), ),
largeTheme.verticalSpacer, theme.verticalSpacer,
_buildProjectCard( _buildProjectCard(
'Projekt B', 'Projekt B',
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
@ -342,6 +344,8 @@ class DashboardPageState extends State<DashboardPage> {
} }
Widget _buildCard(Color background, String image, String title, String link) { Widget _buildCard(Color background, String image, String title, String link) {
final AmbitoTheme theme = getTheme(context);
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.toNamed(link); Get.toNamed(link);
@ -365,7 +369,7 @@ class DashboardPageState extends State<DashboardPage> {
child: Text( child: Text(
title, title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: largeTheme.currentThemeData.textTheme.headlineSmall style: theme.currentThemeData.textTheme.headlineSmall
?.copyWith( ?.copyWith(
color: const Color(0xFF666666), color: const Color(0xFF666666),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -381,6 +385,8 @@ class DashboardPageState extends State<DashboardPage> {
} }
Widget _buildProjectCard(String title, String text) { Widget _buildProjectCard(String title, String text) {
final AmbitoTheme theme = getTheme(context);
return SizedBox( return SizedBox(
width: 532, width: 532,
child: Card( child: Card(
@ -394,13 +400,12 @@ class DashboardPageState extends State<DashboardPage> {
Text( Text(
title, title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: largeTheme.currentThemeData.textTheme.headlineSmall style: theme.currentThemeData.textTheme.headlineSmall?.copyWith(
?.copyWith(
color: greenColors['primary'], color: greenColors['primary'],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
largeTheme.verticalSpacerSmall, theme.verticalSpacerSmall,
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -411,9 +416,9 @@ class DashboardPageState extends State<DashboardPage> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 3, maxLines: 3,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme.currentThemeData.textTheme.bodyLarge style:
?.copyWith( theme.currentThemeData.textTheme.bodyLarge?.copyWith(
color: largeTheme.currentColorScheme.onSurface, color: theme.currentColorScheme.onSurface,
), ),
), ),
), ),

View file

@ -8,7 +8,8 @@ import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../../main.dart'; import '../../consts/consts.dart';
import '../../packages/ambito_theme/ambito_theme.dart';
class StartPage extends StatefulWidget { class StartPage extends StatefulWidget {
const StartPage({super.key, required this.activeLink}); const StartPage({super.key, required this.activeLink});
@ -36,9 +37,11 @@ class StartPageState extends State<StartPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return Scaffold( return Scaffold(
appBar: AmbitoAppbar( appBar: AmbitoAppbar(
breakpoint: Breakpoint.fromContext(context), breakpoint: Breakpoint.fromContext(context),
theme: theme,
), ),
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,

View file

@ -1,12 +1,17 @@
import 'package:ambito/main.dart';
import 'package:ambito/src/extensions/extensions.dart'; import 'package:ambito/src/extensions/extensions.dart';
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart'; import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart'; import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../config/config.dart';
class AmbitoAppbar extends AppBar { class AmbitoAppbar extends AppBar {
AmbitoAppbar({super.key, List<String>? links, required Breakpoint breakpoint}) AmbitoAppbar(
{super.key,
List<String>? links,
required Breakpoint breakpoint,
required AmbitoTheme theme})
: super( : super(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
leading: Padding( leading: Padding(
@ -31,7 +36,7 @@ class AmbitoAppbar extends AppBar {
builder: (context) => _links(context, links), builder: (context) => _links(context, links),
), ),
toolbarHeight: 80, toolbarHeight: 80,
backgroundColor: largeTheme.currentColorScheme.primaryContainer, backgroundColor: theme.currentColorScheme.primaryContainer,
actions: [ actions: [
Text(breakpoint.breakpoint.toString()), Text(breakpoint.breakpoint.toString()),
IconButton( IconButton(
@ -40,7 +45,7 @@ class AmbitoAppbar extends AppBar {
}, },
icon: Icon( icon: Icon(
Icons.notifications, Icons.notifications,
color: largeTheme.currentColorScheme.primary, color: theme.currentColorScheme.primary,
), ),
), ),
if (breakpoint >= myBreakpoints.md) if (breakpoint >= myBreakpoints.md)
@ -50,7 +55,7 @@ class AmbitoAppbar extends AppBar {
}, },
icon: Icon( icon: Icon(
Icons.calendar_view_month, Icons.calendar_view_month,
color: largeTheme.currentColorScheme.primary, color: theme.currentColorScheme.primary,
), ),
), ),
if (breakpoint >= myBreakpoints.md) if (breakpoint >= myBreakpoints.md)
@ -60,7 +65,7 @@ class AmbitoAppbar extends AppBar {
}, },
icon: Icon( icon: Icon(
Icons.calendar_month, Icons.calendar_month,
color: largeTheme.currentColorScheme.primary, color: theme.currentColorScheme.primary,
), ),
), ),
if (breakpoint >= myBreakpoints.md) if (breakpoint >= myBreakpoints.md)
@ -68,7 +73,7 @@ class AmbitoAppbar extends AppBar {
onSelected: (item) {}, onSelected: (item) {},
icon: Icon( icon: Icon(
Icons.person, Icons.person,
color: largeTheme.currentColorScheme.primary, color: theme.currentColorScheme.primary,
), ),
itemBuilder: ( itemBuilder: (
BuildContext context, BuildContext context,

View file

@ -20,7 +20,7 @@ class FieldDaterangepicker extends FormWidgetField {
final List<String> entries; final List<String> entries;
@override @override
FormBuilderField get() { FormBuilderField get(theme) {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
return FormBuilderDateRangePicker( return FormBuilderDateRangePicker(

View file

@ -20,7 +20,7 @@ class FieldDropdown extends FormWidgetField {
final List<String> entries; final List<String> entries;
@override @override
FormBuilderField get() { FormBuilderField get(theme) {
return FormBuilderDropdown<String>( return FormBuilderDropdown<String>(
name: name, name: name,
initialValue: filterValue, initialValue: filterValue,

View file

@ -21,7 +21,7 @@ class FieldMonthsRangepicker extends FormWidgetField {
final List<String> entries; final List<String> entries;
@override @override
Widget get() { Widget get(theme) {
return SfDateRangePicker( return SfDateRangePicker(
minDate: DateTime(2024, 1), minDate: DateTime(2024, 1),
maxDate: DateTime(2024, 12, 31), maxDate: DateTime(2024, 12, 31),

View file

@ -1,4 +1,3 @@
import 'package:ambito/main.dart';
import 'package:ambito/src/widgets/form/form_widget.dart'; import 'package:ambito/src/widgets/form/form_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -10,13 +9,13 @@ class FieldTitle extends FormWidgetField {
final String text; final String text;
@override @override
Widget get() { Widget get(theme) {
return Align( return Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
text, text,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: largeTheme.currentThemeData.textTheme.titleLarge, style: theme.titleLarge,
), ),
); );
} }

View file

@ -2,8 +2,10 @@ import 'package:ambito/src/widgets/form/form_widget_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import '../../packages/ambito_theme/ambito_theme.dart';
abstract class FormWidgetField { abstract class FormWidgetField {
Widget get() { Widget get(AmbitoTheme theme) {
return FormBuilderTextField(name: ''); return FormBuilderTextField(name: '');
} }
} }
@ -18,25 +20,27 @@ class FormWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return SizedBox( return SizedBox(
child: FormBuilder( child: FormBuilder(
key: _formKey, key: _formKey,
child: (type == FormWidgetType.vertical) child: (type == FormWidgetType.vertical)
? Column( ? Column(
children: fields children: fields
.map((element) => _getElementVertical(element)) .map((element) => _getElementVertical(element, theme))
.toList(), .toList(),
) )
: Row( : Row(
children: fields.map((element) => element.get()).toList(), children: fields.map((element) => element.get(theme)).toList(),
), ),
)); ));
} }
Widget _getElementVertical(FormWidgetField element) { Widget _getElementVertical(FormWidgetField element, AmbitoTheme theme) {
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 16), padding: const EdgeInsets.only(bottom: 16),
child: element.get(), child: element.get(theme),
); );
} }
} }

View file

@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../packages/ambito_theme/ambito_theme.dart';
import '../appbar/ambito_appbar.dart';
class BasePage {
Widget getPage(BuildContext context, Widget body) {
final AmbitoTheme theme = getTheme(context);
return Scaffold(
appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
theme: theme,
),
body: body,
);
}
}