From 5901774fc7e409302747508a6e3ebb388f34051e Mon Sep 17 00:00:00 2001 From: Arlind <56867496+Lindi31@users.noreply.github.com> Date: Wed, 14 Jun 2023 04:29:28 +0200 Subject: [PATCH] saving tips --- lib/assets/savings_icon.svg | 3 ++ lib/main.dart | 15 ++++++ lib/saving_tips.dart | 101 ++++++++++++++++++++++++++++++++++++ pubspec.lock | 66 ++++++++++++++++++++++- pubspec.yaml | 4 ++ 5 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 lib/assets/savings_icon.svg create mode 100644 lib/saving_tips.dart diff --git a/lib/assets/savings_icon.svg b/lib/assets/savings_icon.svg new file mode 100644 index 0000000..3db78b9 --- /dev/null +++ b/lib/assets/savings_icon.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 43e6da1..69dfe38 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,6 +6,7 @@ import 'package:intl/intl.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; import 'package:tests/preferences.dart'; +import 'package:tests/saving_tips.dart'; import 'package:tests/theme/theme_constants.dart'; import 'package:tests/theme/theme_manager.dart'; import "package:easy_localization/easy_localization.dart"; @@ -507,6 +508,20 @@ class AccountDetailPageState extends State with SingleTickerP appBar: AppBar( backgroundColor: Colors.transparent, elevation: 0, + actions: [ + Padding( + padding: EdgeInsets.only(right: 10.0), + child: IconButton( + icon: Icon(Icons.info,color: Colors.grey,), + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) => SavingsTipsDialog(), + ); + }, + ), + ), + ], toolbarHeight: 80, title: Text( widget.account.name, diff --git a/lib/saving_tips.dart b/lib/saving_tips.dart new file mode 100644 index 0000000..2e7c5f7 --- /dev/null +++ b/lib/saving_tips.dart @@ -0,0 +1,101 @@ +import 'package:flutter/material.dart'; +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:flutter_neumorphic/flutter_neumorphic.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter/cupertino.dart'; + + +class SavingsTipsDialog extends StatelessWidget { + final List savingsTips = [ + 'Spare jeden Monat einen festen Betrag.', + 'Vergleiche Preise, bevor du etwas kaufst.', + 'Vermeide unnötige Ausgaben.', + 'Setze dir konkrete Sparziele.', + 'Überprüfe regelmäßig deine Ausgaben.', + 'Verkaufe Dinge, die du nicht mehr brauchst.', + 'Nutze Cashback-Programme beim Einkaufen.', + 'Koche selbst anstatt auswärts zu essen.', + 'Nutze kostenlose Angebote und Gutscheine.', + 'Vermeide Impulskäufe und schlafe vor größeren Ausgaben eine Nacht darüber.', + 'Fahre mit dem Fahrrad oder öffentlichen Verkehrsmitteln anstatt mit dem Auto.', + 'Plane deine Mahlzeiten im Voraus, um Lebensmittelverschwendung zu vermeiden.', + 'Vergleiche Versicherungen und Verträge, um Geld zu sparen.', + 'Mache deine eigenen Reinigungsmittel statt teure Produkte zu kaufen.', + 'Nutze kostenlose Online-Ressourcen für Weiterbildung und Hobbys.', + ]; + + @override + Widget build(BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), + child: Container( + padding: const EdgeInsets.all(25.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CarouselSlider.builder( + itemCount: savingsTips.length, + itemBuilder: (BuildContext context, int index, int realIndex) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Neumorphic( + style: NeumorphicStyle( + + boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(13.0)), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: Colors.grey.shade100, // Setze die Hintergrundfarbe auf rot + ), + padding: const EdgeInsets.all(16.0), + child: Column( mainAxisAlignment: MainAxisAlignment.center, + children: [ + + Text( + savingsTips[index], + style: TextStyle(fontSize: 18.0), + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ); + }, + options: CarouselOptions( + height: 250.0, + enlargeCenterPage: true, + viewportFraction: 0.85, + initialPage: 0, + enableInfiniteScroll: true, + autoPlay: true, + autoPlayInterval: Duration(seconds: 4), + autoPlayAnimationDuration: Duration(milliseconds: 700), + autoPlayCurve: Curves.fastOutSlowIn, + pauseAutoPlayOnTouch: true, + ), + ), + SizedBox(height: 16.0), + NeumorphicButton( + child: Text('Close'), + onPressed: () { + Navigator.of(context).pop(); + }, + style: NeumorphicStyle( + color: Colors.grey.shade100, + depth: 10, + intensity: 0.9, + shape: NeumorphicShape.flat, + boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(15.0)), + ), + ), + + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 8766b72..33044db 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -33,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + carousel_slider: + dependency: "direct main" + description: + name: carousel_slider + sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42" + url: "https://pub.dev" + source: hosted + version: "4.2.1" characters: dependency: transitive description: @@ -147,6 +155,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: f991fdb1533c3caeee0cdc14b04f50f0c3916f0dbcbc05237ccbe4e3c6b93f3f + url: "https://pub.dev" + source: hosted + version: "2.0.5" flutter_test: dependency: "direct dev" description: flutter @@ -245,6 +261,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.2" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" path_provider_linux: dependency: transitive description: @@ -269,6 +293,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.7" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + url: "https://pub.dev" + source: hosted + version: "5.1.0" platform: dependency: transitive description: @@ -442,6 +474,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: ea8d3fc7b2e0f35de38a7465063ecfcf03d8217f7962aa2a6717132cb5d43a79 + url: "https://pub.dev" + source: hosted + version: "1.1.5" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: a5eaa5d19e123ad4f61c3718ca1ed921c4e6254238d9145f82aa214955d9aced + url: "https://pub.dev" + source: hosted + version: "1.1.5" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "15edc42f7eaa478ce854eaf1fbb9062a899c0e4e56e775dd73b7f4709c97c4ca" + url: "https://pub.dev" + source: hosted + version: "1.1.5" vector_math: dependency: transitive description: @@ -466,6 +522,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + xml: + dependency: transitive + description: + name: xml + sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + url: "https://pub.dev" + source: hosted + version: "6.2.2" sdks: dart: ">=2.19.6 <3.0.0" - flutter: ">=3.3.0" + flutter: ">=3.7.0-0" diff --git a/pubspec.yaml b/pubspec.yaml index 123fc11..1c15353 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,6 +40,9 @@ dependencies: flutter_neumorphic: ^3.2.0 awesome_dialog: ^3.1.0 easy_localization: ^3.0.2 + carousel_slider: ^4.2.1 + flutter_svg: ^2.0.0 + dev_dependencies: flutter_test: @@ -65,6 +68,7 @@ flutter: assets: - lib/assets/translations/ + - lib/assets/savings_icon.svg fonts: - family: Montserrat