cpd_app_gruppe_finanzplaner/lib/saving_tips.dart

124 lines
4.4 KiB
Dart
Raw Normal View History

2023-06-14 04:29:28 +02:00
import 'package:carousel_slider/carousel_slider.dart';
2023-06-16 04:27:34 +02:00
import 'package:easy_localization/easy_localization.dart';
2023-06-14 04:29:28 +02:00
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
2023-06-17 03:09:31 +02:00
import 'package:tests/theme/theme_constants.dart';
2023-06-14 04:29:28 +02:00
class SavingsTipsDialog extends StatelessWidget {
final List<String> savingsTips = [
2023-06-17 03:09:31 +02:00
'tip1'.tr(),
'tip2'.tr(),
'tip3'.tr(),
'tip4'.tr(),
'tip5'.tr(),
'tip6'.tr(),
'tip7'.tr(),
'tip8'.tr(),
'tip9'.tr(),
'tip10'.tr(),
'tip11'.tr(),
'tip12'.tr(),
'tip13'.tr(),
'tip14'.tr(),
'tip15'.tr(),
2023-06-14 04:29:28 +02:00
];
2023-06-15 00:55:02 +02:00
SavingsTipsDialog({super.key});
2023-06-14 04:29:28 +02:00
@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) {
2023-06-15 00:55:02 +02:00
return Neumorphic(
2023-06-17 03:09:31 +02:00
margin: const EdgeInsets.fromLTRB(0, 11, 0, 7),
style: NeumorphicStyle(
shadowLightColor:
Theme.of(context).brightness == Brightness.light
? const NeumorphicStyle().shadowLightColor
: Theme.of(context).shadowColor,
shadowDarkColor:
Theme.of(context).brightness == Brightness.dark
? const NeumorphicStyle().shadowDarkColor
: grey400,
color: Theme.of(context).brightness == Brightness.light
? grey200
: grey800,
boxShape: NeumorphicBoxShape.roundRect(
BorderRadius.circular(13.0)),
),
child: Container(
decoration: BoxDecoration(
2023-06-14 04:29:28 +02:00
borderRadius: BorderRadius.circular(10.0),
2023-06-17 03:09:31 +02:00
color: Theme.of(context).brightness == Brightness.dark
? grey700
: grey200),
padding: const EdgeInsets.all(14.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
savingsTips[index],
style: const TextStyle(fontSize: 18.0),
textAlign: TextAlign.center,
),
],
2023-06-14 04:29:28 +02:00
),
2023-06-17 03:09:31 +02:00
),
2023-06-14 04:29:28 +02:00
);
},
options: CarouselOptions(
height: 250.0,
enlargeCenterPage: true,
2023-06-15 00:55:02 +02:00
viewportFraction: 0.76,
2023-06-14 04:29:28 +02:00
initialPage: 0,
enableInfiniteScroll: true,
autoPlay: true,
autoPlayInterval: const Duration(seconds: 3),
2023-06-15 00:55:02 +02:00
autoPlayAnimationDuration: const Duration(milliseconds: 700),
2023-06-14 04:29:28 +02:00
autoPlayCurve: Curves.fastOutSlowIn,
pauseAutoPlayOnTouch: true,
),
),
2023-06-15 00:55:02 +02:00
const SizedBox(height: 16.0),
2023-06-14 04:29:28 +02:00
NeumorphicButton(
onPressed: () {
Navigator.of(context).pop();
},
style: NeumorphicStyle(
2023-06-17 03:09:31 +02:00
shadowLightColor:
Theme.of(context).brightness == Brightness.light
? const NeumorphicStyle().shadowLightColor
: Theme.of(context).shadowColor,
shadowDarkColor: Theme.of(context).brightness == Brightness.dark
? const NeumorphicStyle().shadowDarkColor
: grey400,
color: Theme.of(context).brightness == Brightness.light
? grey200
: grey800,
2023-06-14 04:29:28 +02:00
depth: 10,
intensity: 0.9,
shape: NeumorphicShape.flat,
2023-06-15 00:55:02 +02:00
boxShape:
NeumorphicBoxShape.roundRect(BorderRadius.circular(15.0)),
2023-06-14 04:29:28 +02:00
),
2023-06-17 03:09:31 +02:00
child: Text(
'close'.tr(),
style: TextStyle(color: Theme.of(context).cardColor),
),
2023-06-14 04:29:28 +02:00
),
],
),
),
);
}
2023-06-15 00:55:02 +02:00
}