finished personality card style

This commit is contained in:
kima 2023-06-22 23:33:28 +02:00
parent 1f46a0509f
commit 87842de421
3 changed files with 58 additions and 14 deletions

View File

@ -1,3 +1,4 @@
import 'package:dotted_border/dotted_border.dart';
import 'package:filcnaplo/api/providers/user_provider.dart'; import 'package:filcnaplo/api/providers/user_provider.dart';
import 'package:filcnaplo/helpers/average_helper.dart'; import 'package:filcnaplo/helpers/average_helper.dart';
import 'package:filcnaplo/models/settings.dart'; import 'package:filcnaplo/models/settings.dart';
@ -43,6 +44,8 @@ class _PersonalityCardState extends State<PersonalityCard> {
late PersonalityType finalPersonality; late PersonalityType finalPersonality;
bool hold = false;
List<Grade> getSubjectGrades(Subject subject, {int days = 0}) => gradeProvider List<Grade> getSubjectGrades(Subject subject, {int days = 0}) => gradeProvider
.grades .grades
.where((e) => .where((e) =>
@ -282,30 +285,49 @@ class _PersonalityCardState extends State<PersonalityCard> {
Text( Text(
personality[i]?['emoji'] ?? '', personality[i]?['emoji'] ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 128.0), style: const TextStyle(
fontSize: 128.0,
height: 1.2,
),
), ),
Text( Text(
personality[i]?['title'] ?? '???', personality[i]?['title'] ?? '???',
textAlign: TextAlign.center, 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( Text(
personality[i]?['description'] ?? 'Ismeretlen személyiség...', personality[i]?['description'] ?? 'Ismeretlen személyiség...',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
height: 1.2,
color: Colors.white.withOpacity(0.8), color: Colors.white.withOpacity(0.8),
), ),
), ),
const SizedBox(height: 25),
Text( Text(
personality[i]?['subtitle'] ?? '???', personality[i]?['subtitle'] ?? '???',
textAlign: TextAlign.center, 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( Text(
personality[i]?['subvalue'] ?? '0', personality[i]?['subvalue'] ?? '0',
textAlign: TextAlign.center, 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<PersonalityCard> {
doEverything(); doEverything();
getPersonality(); getPersonality();
return Container( return GestureDetector(
decoration: const BoxDecoration(color: Color(0x600008FF)), onLongPressDown: (_) => setState(() => hold = true),
child: Container( onLongPressEnd: (_) => setState(() => hold = false),
padding: const EdgeInsets.all(5), onLongPressCancel: () => setState(() => hold = false),
decoration: const BoxDecoration( child: AnimatedScale(
image: DecorationImage( scale: hold ? 1.018 : 1.0,
image: AssetImage('images/card_border.png'), 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(),
), ),
); );
} }

View File

@ -21,11 +21,11 @@ class _PersonalityBodyState extends State<PersonalityBody> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
const SizedBox(height: 40), const SizedBox(height: 60),
PersonalityCard( PersonalityCard(
user: user, user: user,
), ),
const SizedBox(height: 40), const SizedBox(height: 60),
]); ]);
} }
} }

View File

@ -40,6 +40,7 @@ dependencies:
background_fetch: ^1.1.5 background_fetch: ^1.1.5
wtf_sliding_sheet: ^1.0.0 wtf_sliding_sheet: ^1.0.0
package_info_plus: ^4.0.2 package_info_plus: ^4.0.2
dotted_border: ^2.0.0+3
dev_dependencies: dev_dependencies:
flutter_lints: ^1.0.0 flutter_lints: ^1.0.0