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
linter:
# The lint rules applied to this project can be customized in the
# 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
rules:

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_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/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_pre_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_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:isar/isar.dart';
import 'package:logger/logger.dart';
import 'package:provider/provider.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart';
import 'package:shared_preferences/shared_preferences.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 {
WidgetsFlutterBinding.ensureInitialized();
//await dotenv.load(fileName: '.env');
await AmbitoSharedPrefs.start();
await AmbitoIsarDB.init();
await Future.wait([
@ -113,11 +38,8 @@ void main() async {
//BaseApi().getContent('material'),
//BaseApi().getContent('source'),
]);
await MeasureRepository().buildMeasureFilters();
await MeasureRepository().downloadImages();
//await MeasureRepository().downloadImages();
runApp(const Ambito());
}
@ -151,8 +73,8 @@ class Ambito extends StatelessWidget {
SfGlobalLocalizations.delegate,
],
title: 'AmBiTo',
supportedLocales: const [Locale('de')],
locale: const Locale('de'),
supportedLocales: supportedLocales,
locale: ThemeManager().locale,
builder: FlutterI18n.rootAppBuilder(),
theme: ThemeManager().themeData?.lightThemeData,
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 = [
'Januar',
'Februar',
@ -12,3 +21,13 @@ const List<String> months = [
'November',
'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:isar/isar.dart';
import '../../../../main.dart';
import '../../../consts/consts.dart';
import '../../../widgets/form/fields/field_dropdown.dart';
class ItemFilterRepository extends BaseDB {
@override
IsarCollection collection = isar.itemFilters;
List<ItemFilter>? getByType(String type) {
return isar.itemFilters.where().typeEqualTo(type).findAll();
Set<ItemFilter>? getByType(String type) {
return isar.itemFilters.where().typeEqualTo(type).findAll().toSet();
}
List<dynamic>? getIdsByType(String type) {
@ -41,7 +41,7 @@ class ItemFilterRepository extends BaseDB {
FieldDropdown getDropDown(String type, String label) {
if (type == 'month') {}
List<ItemFilter> filterItems = getByType(type)!;
Set<ItemFilter> filterItems = getByType(type)!;
return FieldDropdown(
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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class ApprovalRequirementRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class BusinessRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class ExperienceReportRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class FundingProgramRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class LocationRequirementsRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class MaterialRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class MeasureRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class MeasureCombinationRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class NumberFactsheetRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class OrganismRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class ReferenceImplementationRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class ServiceProviderContactPersonRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class ServiceProviderRepository extends BaseDB {
@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:isar/isar.dart';
import '../../../../main.dart';
import '../../consts/consts.dart';
class SourceRepository extends BaseDB {
@override

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
import '../../../main.dart';
import '../../consts/consts.dart';
class AmbitoDownloader {
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:isar/isar.dart';
import '../../../main.dart';
import '../../consts/consts.dart';
class AmbitoFormBuilder {
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:flutter/cupertino.dart';
import '../../../consts/consts.dart';
AmbitoFilterNotifier ambitoFilterNotifier = AmbitoFilterNotifier();
class AmbitoFilterNotifier extends ChangeNotifier {
@ -30,7 +31,9 @@ class AmbitoFilterNotifier extends ChangeNotifier {
});
}
List<int>? getMergedIds() {}
List<int>? getMergedIds() {
return null;
}
String? getFilter(String type) {
return activeFilters[type];

View file

@ -5,15 +5,28 @@ import 'package:flutter/cupertino.dart';
class ThemeManager with ChangeNotifier {
AmbitoTheme? _themeData;
Locale? _locale;
/// Use this method on UI to get selected theme.
AmbitoTheme? get themeData {
_themeData ??= AmbitoThemeMedium();
return _themeData;
}
Locale? get locale {
_locale ??= const Locale('de');
return _locale;
}
/// Sets theme and notifies listeners about change.
setTheme(AmbitoTheme theme) async {
_themeData = theme;
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 '../../../main.dart';
import '../../consts/consts.dart';
class AmbitoSharedPrefs {
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:screen_breakpoints/screen_breakpoints.dart';
import '../../../main.dart';
import '../../config/config.dart';
import '../../consts/consts.dart';
final orangeColors = {
'primary': const Color(0xffeebb4b),
@ -56,10 +57,10 @@ AmbitoTheme getTheme(BuildContext context) {
return largeTheme;
}
if (breakpoint >= myBreakpoints.sm) {
ThemeManager().setTheme(smallTheme);
ThemeManager().setTheme(mediumTheme);
return mediumTheme;
}
ThemeManager().setTheme(mediumTheme);
ThemeManager().setTheme(smallTheme);
return smallTheme;
}

View file

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

View file

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

View file

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

View file

@ -210,10 +210,13 @@ class ActionsPageState extends State<ActionsPage> {
return getCard(context, massnahme);
}).toList();
final AmbitoTheme theme = getTheme(context);
return Scaffold(
appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
theme: theme,
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
@ -357,7 +360,7 @@ class ActionsPageState extends State<ActionsPage> {
),
Expanded(
child: Padding(
padding: EdgeInsets.all(10),
padding: const EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
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/entities.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 '../../../main.dart';
import '../../consts/consts.dart';
import '../../packages/ambito_theme/ambito_theme.dart';
import '../../widgets/appbar/ambito_appbar.dart';
class ActionsPrePage extends AmbitoPage {
const ActionsPrePage({super.key});
@ -23,91 +25,17 @@ class ActionsPrePage extends AmbitoPage {
}
class ActionsPrePageState extends State<ActionsPrePage> {
List<Widget> cards = [];
Set<Widget> cards = {};
Map<String, int> counter = {};
Map<String, int> ids = {};
int counterComplete = 0;
Set<ItemFilter>? filters;
@override
void initState() {
List<ItemFilter>? filters = ItemFilterRepository().getByType('areaType');
cards = {};
filters = ItemFilterRepository().getByType('areaType');
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();
}
@ -115,12 +43,19 @@ class ActionsPrePageState extends State<ActionsPrePage> {
Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return Scaffold(
appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
),
body: BreakpointBuilder(builder: (
setState(() {
cards = {};
});
for (ItemFilter filter in filters!) {
setState(() {
cards.add(_buildCard(context, filter));
});
}
return BasePage().getPage(
context,
BreakpointBuilder(builder: (
context,
breakpoint,
configuration,
@ -135,20 +70,22 @@ class ActionsPrePageState extends State<ActionsPrePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(breakpoint.toString()),
theme.verticalSpacerMax,
theme.verticalSpacer,
Text(
'Maßnahmenkategorien',
context.translate('page.general.links.massnahmen.title'),
textAlign: TextAlign.start,
style: theme.currentThemeData.textTheme.headlineLarge
?.copyWith(
style: theme.headlineLarge.copyWith(
color: theme.currentColorScheme.onSurface,
),
),
theme.verticalSpacerMax,
Wrap(
alignment: WrapAlignment.center,
spacing: 32,
children: cards,
Align(
alignment: Alignment.center,
child: Wrap(
alignment: WrapAlignment.center,
spacing: 32,
children: cards.toList(),
),
),
theme.verticalSpacerMax,
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(
appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
),
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
theme: theme),
body: BreakpointBuilder(builder: (
context,
breakpoint,

View file

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

View file

@ -1,7 +1,5 @@
import 'package:ambito/src/extensions/extensions.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating/flutter_rating.dart';
import 'package:flutter_rating_stars/flutter_rating_stars.dart';
import '../../../../entity/entities.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> {
List<Appointment> appointments = <Appointment>[];
List<ItemFilter>? monthFilter = [];
Set<ItemFilter>? monthFilter = {};
@override
void initState() {
@ -62,10 +62,13 @@ class CalendarPageState extends State<CalendarPage> {
@override
Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return Scaffold(
appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
theme: theme,
),
body: Center(
child: Padding(
@ -89,7 +92,7 @@ class CalendarPageState extends State<CalendarPage> {
List<Appointment> appointments = <Appointment>[];
appointments.add(Appointment(
startTime: DateTime.now(),
endTime: DateTime.now().add(Duration(minutes: 10)),
endTime: DateTime.now().add(const Duration(minutes: 10)),
subject: 'Meeting',
isAllDay: true,
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/measure/measure_repository.dart';
import 'package:ambito/src/packages/ambito_notifier/notifier/theme_manager.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';
import '../../widgets/appbar/ambito_appbar.dart';
class CalendarPageYear extends StatefulWidget {
@ -25,11 +28,16 @@ class CalendarPageYearState extends State<CalendarPageYear> {
@override
void initState() {
initDataSource();
ThemeManager().addListener(_updateState);
super.initState();
}
initDataSource() {
void _updateState() {
setState(() {});
}
initDataSource(BuildContext context, AmbitoTheme theme) {
List<TableCell> cells = [
TableCell(
child: Padding(
@ -48,15 +56,20 @@ class CalendarPageYearState extends State<CalendarPageYear> {
verticalAlignment: TableCellVerticalAlignment.middle,
child: Text(
textAlign: TextAlign.center,
month,
style: largeTheme.currentThemeData.textTheme.titleMedium
(context.breakpoint.breakpoint == myBreakpoints.sm!.breakpoint)
? 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),
),
),
);
}
rowsHeader.add(TableRow(
decoration: const BoxDecoration(color: Color(0xFF60845E)),
decoration: BoxDecoration(color: theme.currentColorScheme.secondary),
children: cells));
var massnahmen = MeasureRepository().getAllOrdered();
for (var massnahme in massnahmen) {
@ -65,8 +78,18 @@ class CalendarPageYearState extends State<CalendarPageYear> {
TableCell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
massnahme.name!,
child: TextButton(
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(
width: double.infinity,
height: 44,
color: largeTheme.currentColorScheme.primary,
color: theme.currentColorScheme.secondary,
),
),
);
@ -107,52 +130,23 @@ class CalendarPageYearState extends State<CalendarPageYear> {
@override
Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
rowsHeader = [];
rowsBody = [];
initDataSource(context, theme);
double fixedWidth = 120;
return Scaffold(
appBar: AmbitoAppbar(
links: const ['dashboard', 'massnahmen'],
breakpoint: Breakpoint.fromContext(context),
theme: theme,
),
body: Card(
child: Column(
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: const EdgeInsets.only(top: 32, left: 32, right: 32),
child: _buildTableHeader(fixedWidth),

View file

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

View file

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

View file

@ -8,7 +8,8 @@ import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:get/get.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 {
const StartPage({super.key, required this.activeLink});
@ -36,9 +37,11 @@ class StartPageState extends State<StartPage> {
@override
Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return Scaffold(
appBar: AmbitoAppbar(
breakpoint: Breakpoint.fromContext(context),
theme: theme,
),
body: Column(
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/packages/ambito_theme/ambito_theme.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:screen_breakpoints/screen_breakpoints.dart';
import '../../config/config.dart';
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(
automaticallyImplyLeading: false,
leading: Padding(
@ -31,7 +36,7 @@ class AmbitoAppbar extends AppBar {
builder: (context) => _links(context, links),
),
toolbarHeight: 80,
backgroundColor: largeTheme.currentColorScheme.primaryContainer,
backgroundColor: theme.currentColorScheme.primaryContainer,
actions: [
Text(breakpoint.breakpoint.toString()),
IconButton(
@ -40,7 +45,7 @@ class AmbitoAppbar extends AppBar {
},
icon: Icon(
Icons.notifications,
color: largeTheme.currentColorScheme.primary,
color: theme.currentColorScheme.primary,
),
),
if (breakpoint >= myBreakpoints.md)
@ -50,7 +55,7 @@ class AmbitoAppbar extends AppBar {
},
icon: Icon(
Icons.calendar_view_month,
color: largeTheme.currentColorScheme.primary,
color: theme.currentColorScheme.primary,
),
),
if (breakpoint >= myBreakpoints.md)
@ -60,7 +65,7 @@ class AmbitoAppbar extends AppBar {
},
icon: Icon(
Icons.calendar_month,
color: largeTheme.currentColorScheme.primary,
color: theme.currentColorScheme.primary,
),
),
if (breakpoint >= myBreakpoints.md)
@ -68,7 +73,7 @@ class AmbitoAppbar extends AppBar {
onSelected: (item) {},
icon: Icon(
Icons.person,
color: largeTheme.currentColorScheme.primary,
color: theme.currentColorScheme.primary,
),
itemBuilder: (
BuildContext context,

View file

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

View file

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

View file

@ -21,7 +21,7 @@ class FieldMonthsRangepicker extends FormWidgetField {
final List<String> entries;
@override
Widget get() {
Widget get(theme) {
return SfDateRangePicker(
minDate: DateTime(2024, 1),
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:flutter/material.dart';
@ -10,13 +9,13 @@ class FieldTitle extends FormWidgetField {
final String text;
@override
Widget get() {
Widget get(theme) {
return Align(
alignment: Alignment.centerLeft,
child: Text(
text,
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_form_builder/flutter_form_builder.dart';
import '../../packages/ambito_theme/ambito_theme.dart';
abstract class FormWidgetField {
Widget get() {
Widget get(AmbitoTheme theme) {
return FormBuilderTextField(name: '');
}
}
@ -18,25 +20,27 @@ class FormWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final AmbitoTheme theme = getTheme(context);
return SizedBox(
child: FormBuilder(
key: _formKey,
child: (type == FormWidgetType.vertical)
? Column(
children: fields
.map((element) => _getElementVertical(element))
.map((element) => _getElementVertical(element, theme))
.toList(),
)
: 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(
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,
);
}
}