From 87842de4218f76fd0c5ba4fbb8f4c2330f8162cd Mon Sep 17 00:00:00 2001 From: kima Date: Thu, 22 Jun 2023 23:33:28 +0200 Subject: [PATCH] finished personality card style --- .../personality_card/personality_card.dart | 67 +++++++++++++++---- .../summary/pages/personality_page.dart | 4 +- filcnaplo_mobile_ui/pubspec.yaml | 1 + 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart b/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart index 8a6f242..31cd4b9 100644 --- a/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart +++ b/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart @@ -1,3 +1,4 @@ +import 'package:dotted_border/dotted_border.dart'; import 'package:filcnaplo/api/providers/user_provider.dart'; import 'package:filcnaplo/helpers/average_helper.dart'; import 'package:filcnaplo/models/settings.dart'; @@ -43,6 +44,8 @@ class _PersonalityCardState extends State { late PersonalityType finalPersonality; + bool hold = false; + List getSubjectGrades(Subject subject, {int days = 0}) => gradeProvider .grades .where((e) => @@ -282,30 +285,49 @@ class _PersonalityCardState extends State { Text( personality[i]?['emoji'] ?? '❓', textAlign: TextAlign.center, - style: const TextStyle(fontSize: 128.0), + style: const TextStyle( + fontSize: 128.0, + height: 1.2, + ), ), Text( personality[i]?['title'] ?? '???', textAlign: TextAlign.center, - style: const TextStyle(fontSize: 38.0, color: Colors.white), + style: const TextStyle( + fontSize: 38.0, + color: Colors.white, + fontWeight: FontWeight.w800, + ), ), + const SizedBox(height: 5), Text( personality[i]?['description'] ?? 'Ismeretlen személyiség...', textAlign: TextAlign.start, style: TextStyle( fontSize: 16, + height: 1.2, color: Colors.white.withOpacity(0.8), ), ), + const SizedBox(height: 25), Text( personality[i]?['subtitle'] ?? '???', textAlign: TextAlign.center, - style: const TextStyle(fontSize: 20.0, color: Colors.white), + style: const TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), ), Text( personality[i]?['subvalue'] ?? '0', textAlign: TextAlign.center, - style: const TextStyle(fontSize: 76.0, color: Colors.white), + style: const TextStyle( + fontSize: 69.0, + height: 1.15, + color: Colors.white, + fontWeight: FontWeight.w800, + ), ), ], ); @@ -321,16 +343,37 @@ class _PersonalityCardState extends State { doEverything(); getPersonality(); - return Container( - decoration: const BoxDecoration(color: Color(0x600008FF)), - child: Container( - padding: const EdgeInsets.all(5), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('images/card_border.png'), + return GestureDetector( + onLongPressDown: (_) => setState(() => hold = true), + onLongPressEnd: (_) => setState(() => hold = false), + onLongPressCancel: () => setState(() => hold = false), + child: AnimatedScale( + scale: hold ? 1.018 : 1.0, + curve: Curves.easeInOutBack, + duration: const Duration(milliseconds: 300), + child: Container( + padding: + const EdgeInsets.only(top: 12, bottom: 12, left: 12, right: 12), + decoration: BoxDecoration( + color: const Color(0x280008FF), + borderRadius: const BorderRadius.all(Radius.circular(5)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.08), + offset: const Offset(0, 5), + blurRadius: 20, + spreadRadius: 10, + ), + ], + ), + child: DottedBorder( + color: Colors.black.withOpacity(0.9), + dashPattern: const [12, 12], + padding: + const EdgeInsets.only(top: 20, bottom: 20, left: 20, right: 20), + child: cardInnerBuilder(), ), ), - child: cardInnerBuilder(), ), ); } diff --git a/filcnaplo_mobile_ui/lib/screens/summary/pages/personality_page.dart b/filcnaplo_mobile_ui/lib/screens/summary/pages/personality_page.dart index d54b69b..41d2bda 100644 --- a/filcnaplo_mobile_ui/lib/screens/summary/pages/personality_page.dart +++ b/filcnaplo_mobile_ui/lib/screens/summary/pages/personality_page.dart @@ -21,11 +21,11 @@ class _PersonalityBodyState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - const SizedBox(height: 40), + const SizedBox(height: 60), PersonalityCard( user: user, ), - const SizedBox(height: 40), + const SizedBox(height: 60), ]); } } diff --git a/filcnaplo_mobile_ui/pubspec.yaml b/filcnaplo_mobile_ui/pubspec.yaml index 197cd6a..eaf87ed 100755 --- a/filcnaplo_mobile_ui/pubspec.yaml +++ b/filcnaplo_mobile_ui/pubspec.yaml @@ -40,6 +40,7 @@ dependencies: background_fetch: ^1.1.5 wtf_sliding_sheet: ^1.0.0 package_info_plus: ^4.0.2 + dotted_border: ^2.0.0+3 dev_dependencies: flutter_lints: ^1.0.0