From 201444ce30f8cfad3561b81dde94ef26189a3a6d Mon Sep 17 00:00:00 2001 From: reinjens Date: Wed, 9 Oct 2024 01:14:07 +0200 Subject: [PATCH] changed the layout to the first wireframes --- assets/i18n/de.json | 2 +- lib/main.dart | 7 ++ lib/src/packages/ambito_api/base.dart | 4 +- lib/src/pages/actions/actions_page.dart | 46 ++++++++++--- lib/src/pages/start/start_page.dart | 64 +++++++++++-------- macos/Flutter/GeneratedPluginRegistrant.swift | 2 +- pubspec.lock | 58 +++++++++++++---- pubspec.yaml | 3 + 8 files changed, 134 insertions(+), 52 deletions(-) diff --git a/assets/i18n/de.json b/assets/i18n/de.json index badc68a..f423c50 100644 --- a/assets/i18n/de.json +++ b/assets/i18n/de.json @@ -8,7 +8,7 @@ "title": "Start" }, "database": { - "title": "Datenbank" + "title": "Maßnahmen" }, "designer": { "title": "Designer" diff --git a/lib/main.dart b/lib/main.dart index 1186768..6d2dbc4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,9 +5,11 @@ import 'package:ambito/src/pages/start/start_page.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_i18n/flutter_i18n.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:get/get_navigation/src/root/get_material_app.dart'; import 'package:isar/isar.dart'; import 'package:logger/logger.dart'; +import 'package:syncfusion_localizations/syncfusion_localizations.dart'; const String ambitoToken = 'TFxO7vzBLVRCu9I3VMoHmTuCvSu8aCDi'; @@ -56,8 +58,13 @@ class Ambito extends StatelessWidget { } }, ), + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + SfGlobalLocalizations.delegate, ], title: 'Flutter Demo', + supportedLocales: [Locale('de')], locale: const Locale('de'), builder: FlutterI18n.rootAppBuilder(), theme: ThemeData( diff --git a/lib/src/packages/ambito_api/base.dart b/lib/src/packages/ambito_api/base.dart index 29c08e7..47dcab6 100644 --- a/lib/src/packages/ambito_api/base.dart +++ b/lib/src/packages/ambito_api/base.dart @@ -37,15 +37,13 @@ class BaseApi { case 'baumarten': for (var baumart in json['results']) { BaseDB.put(Baumarten.fromJson(baumart)); - Baumarten art = Baumarten.fromJson(baumart); isar.write((isar) { - isar.baumartens.put(art); + isar.baumartens.put(Baumarten.fromJson(baumart)); }); } break; case 'massnahmen': for (var massnahme in json['results']) { - logger.d(massnahme); BaseDB.put(Massnahme.fromJson(massnahme)); isar.write((isar) { isar.massnahmes.put(Massnahme.fromJson(massnahme)); diff --git a/lib/src/pages/actions/actions_page.dart b/lib/src/pages/actions/actions_page.dart index e78d424..f944174 100644 --- a/lib/src/pages/actions/actions_page.dart +++ b/lib/src/pages/actions/actions_page.dart @@ -9,6 +9,7 @@ import 'package:ambito/src/widgets/form/form_widget_type.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:expandable_text/expandable_text.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_i18n/flutter_i18n.dart'; import '../../../main.dart'; @@ -67,12 +68,15 @@ class ActionsPageState extends State { } } if (massnahme.timeFrame != null) { + logger.d(massnahme.timeFrame); for (IdValueColor tfType in massnahme.timeFrame!) { updatedMonths.add(tfType.value!); } } } + logger.d(updatedMonths); + setState(() { type.addAll(updatedTypes); areaType.addAll(updatedAreaTypes); @@ -119,15 +123,30 @@ class ActionsPageState extends State { style: Theme.of(context).textTheme.titleLarge, ), getSpacer(), - getFilter(context), - getSpacer(), Expanded( - child: SingleChildScrollView( - child: Wrap( - children: actionCards, - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + width: 300, + child: getFilter(context), + ), + const SizedBox( + width: 16, + ), + Expanded( + child: SingleChildScrollView( + child: Wrap( + direction: Axis.horizontal, + children: actionCards, + ), + ), + ), + ], ), ), + getSpacer(), ], ), ); @@ -199,8 +218,15 @@ class ActionsPageState extends State { ), ); - var monthsSorted = months.toList(); - monthsSorted.sort((a, b) => a.toLowerCase().compareTo(b.toLowerCase())); + List monthsSorted = []; + + for (int i = 1; i <= 12; i++) { + monthsSorted + .add(FlutterI18n.translate(context, 'general.lists.months.$i')); + } + + /*var monthsSorted = months.toList(); + monthsSorted.sort((a, b) => a.toLowerCase().compareTo(b.toLowerCase()));*/ /*fields.add( FieldDropdown( @@ -220,6 +246,8 @@ class ActionsPageState extends State { entries: monthsSorted, ), );*/ + + logger.d(monthsSorted); fields.add( FieldMonthsRangepicker( name: 'months', @@ -227,7 +255,7 @@ class ActionsPageState extends State { filterValue: filterMonths, onClear: () {}, onSelected: (String? value) {}, - entries: months.toList(), + entries: monthsSorted, ), ); diff --git a/lib/src/pages/start/start_page.dart b/lib/src/pages/start/start_page.dart index 031888b..14b1dbd 100644 --- a/lib/src/pages/start/start_page.dart +++ b/lib/src/pages/start/start_page.dart @@ -12,41 +12,55 @@ class StartPage extends StatefulWidget { class StartPageState extends State { String activeLink = ''; + Widget content = const SizedBox(); @override void initState() { - activeLink = 'start'; + setState(() { + activeLink = 'database'; + content = const ActionsPage(); + }); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( - body: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - _linkButton('start'), - _linkButton('database'), - _linkButton('designer'), - Image.asset( - 'images/logo.png', - scale: 1.3, - ), - _linkButton('service'), - _linkButton('network'), - _linkButton('contact'), + appBar: AppBar( + leading: Row( + children: [ + const SizedBox( + width: 30, + ), + Image.asset( + 'images/logo.png', + scale: .8, + ), + const SizedBox( + width: 30, + ), + _linkButton('database'), + ], + ), + leadingWidth: 400, + toolbarHeight: 100, + backgroundColor: Colors.white, + actions: [ + IconButton(onPressed: () {}, icon: const Icon(Icons.person)), + const SizedBox( + width: 30, + ) ], ), - const SizedBox(height: 50), - Expanded( - child: getContent(), - ), - ], - )); + body: const Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 50), + Expanded( + child: ActionsPage(), + ), + ], + )); } Widget getContent() { @@ -57,7 +71,7 @@ class StartPageState extends State { } Widget _linkButton(String link) { - double fontSize = 16; + double fontSize = 24; return TextButton( style: ButtonStyle( overlayColor: diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index e670f6b..efa0599 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,7 +8,7 @@ import Foundation import geolocator_apple import isar_flutter_libs import path_provider_foundation -import sqflite +import sqflite_darwin func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 3436775..b880e8a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -290,10 +290,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" fixnum: dependency: transitive description: @@ -348,7 +348,7 @@ packages: source: hosted version: "4.0.0" flutter_localizations: - dependency: transitive + dependency: "direct main" description: flutter source: sdk version: "0.0.0" @@ -718,10 +718,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: f7544c346a0742aee1450f9e5c0f5269d7c602b9c95fdbcd9fb8f5b1df13b1cc + sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a url: "https://pub.dev" source: hosted - version: "2.2.11" + version: "2.2.12" path_provider_foundation: dependency: transitive description: @@ -939,18 +939,42 @@ packages: dependency: transitive description: name: sqflite - sha256: ff5a2436ef8ebdfda748fbfe957f9981524cb5ff11e7bafa8c42771840e8a788 + sha256: "79a297dc3cc137e758c6a4baf83342b039e5a6d2436fcdf3f96a00adaaf2ad62" url: "https://pub.dev" source: hosted - version: "2.3.3+2" + version: "2.4.0" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" + url: "https://pub.dev" + source: hosted + version: "2.4.0" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "2d8e607db72e9cb7748c9c6e739e2c9618320a5517de693d5a24609c4671b1a4" + sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490" url: "https://pub.dev" source: hosted - version: "2.5.4+4" + version: "2.5.4+5" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "769733dddf94622d5541c73e4ddc6aa7b252d865285914b6fcd54a63c4b4f027" + url: "https://pub.dev" + source: hosted + version: "2.4.1-1" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" stack_trace: dependency: transitive description: @@ -987,18 +1011,26 @@ packages: dependency: transitive description: name: syncfusion_flutter_core - sha256: "95a53df168fd4473bbf23c481db656db97434d18d60f59fbeec97a754794f7b5" + sha256: "7130fc3259247946b59fe9b76ee89500c775c3f7e5c1d0826f3105e1dd0bebf6" url: "https://pub.dev" source: hosted - version: "27.1.51" + version: "27.1.52" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: dcb9da082d2e39c84415a8323287a0714ffd349d5cf3bed93af1ad0b30b7dfd9 + sha256: "61efc09e962d7b7cc3c7d33a2e44ec027112403af49590d5cc1025a255cc34fa" url: "https://pub.dev" source: hosted - version: "27.1.51" + version: "27.1.52" + syncfusion_localizations: + dependency: "direct main" + description: + name: syncfusion_localizations + sha256: d04b86990411e1f0c896e273bbdb312b1ed52d8009010ddc2af9cbea5ed90e09 + url: "https://pub.dev" + source: hosted + version: "27.1.52" synchronized: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5c8447d..e37b603 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,6 +9,8 @@ environment: dependencies: flutter: sdk: flutter + flutter_localizations: + sdk: flutter cupertino_icons: ^1.0.6 intl: ^0.19.0 flutter_map: ^7.0.2 @@ -39,6 +41,7 @@ dependencies: http: ^1.2.2 flutter_form_builder: ^9.4.1 syncfusion_flutter_datepicker: ^27.1.50 + syncfusion_localizations: ^27.1.52 dev_dependencies: