| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:cake_wallet/src/widgets/primary_button.dart'; |
| 3 | import 'package:cake_wallet/themes/core/theme_extension.dart'; |
| 4 | import 'package:flutter/material.dart'; |
| 5 | import 'package:flutter_svg/flutter_svg.dart'; |
| 6 | |
| 7 | import 'base_bottom_sheet_widget.dart'; |
| 8 | |
| 9 | class InfoStep { |
| 10 | final String iconPath; |
| 11 | final String description; |
| 12 | |
| 13 | const InfoStep(this.iconPath, this.description); |
| 14 | } |
| 15 | |
| 16 | class InfoStepsBottomSheet extends BaseBottomSheet { |
| 17 | final List<InfoStep> steps; |
| 18 | |
| 19 | InfoStepsBottomSheet({ |
| 20 | required String titleText, |
| 21 | required this.steps, |
| 22 | String? titleIconPath, |
| 23 | }) : super( |
| 24 | titleText: titleText, |
| 25 | titleIconPath: titleIconPath, |
| 26 | footerType: FooterType.none, |
| 27 | maxHeight: 900); |
| 28 | |
| 29 | @override |
| 30 | Widget contentWidget(BuildContext context) => SafeArea( |
| 31 | child: Container( |
| 32 | constraints: BoxConstraints( |
| 33 | maxHeight: MediaQuery.of(context).size.height * 0.7, |
| 34 | ), |
| 35 | child: SingleChildScrollView( |
| 36 | child: Column( |
| 37 | children: [ |
| 38 | Padding( |
| 39 | padding: const EdgeInsets.symmetric(horizontal: 28.0), |
| 40 | child: Column( |
| 41 | children: steps |
| 42 | .map((step) => Column( |
| 43 | children: [ |
| 44 | Container( |
| 45 | padding: EdgeInsets.all(10), |
| 46 | alignment: Alignment.center, |
| 47 | decoration: BoxDecoration( |
| 48 | borderRadius: BorderRadius.circular(15), |
| 49 | color: Theme.of(context).colorScheme.surfaceContainer, |
| 50 | ), |
| 51 | child: Row( |
| 52 | mainAxisSize: MainAxisSize.max, |
| 53 | mainAxisAlignment: MainAxisAlignment.center, |
| 54 | crossAxisAlignment: CrossAxisAlignment.start, |
| 55 | children: <Widget>[ |
| 56 | Expanded( |
| 57 | child: Padding( |
| 58 | padding: EdgeInsets.all(10), |
| 59 | child: Column( |
| 60 | spacing: 10.0, |
| 61 | mainAxisSize: MainAxisSize.max, |
| 62 | mainAxisAlignment: MainAxisAlignment.start, |
| 63 | crossAxisAlignment: CrossAxisAlignment.start, |
| 64 | children: <Widget>[ |
| 65 | SvgPicture.asset( |
| 66 | step.iconPath, |
| 67 | colorFilter: ColorFilter.mode( |
| 68 | Theme.of(context).colorScheme.onSurfaceVariant, |
| 69 | BlendMode.srcIn), |
| 70 | ), |
| 71 | Text( |
| 72 | step.description, |
| 73 | style: Theme.of(context) |
| 74 | .textTheme |
| 75 | .bodyMedium! |
| 76 | .copyWith( |
| 77 | color: context |
| 78 | .currentTheme.colorScheme.onSurface, |
| 79 | fontWeight: FontWeight.w400), |
| 80 | ) |
| 81 | ], |
| 82 | ), |
| 83 | ), |
| 84 | ) |
| 85 | ], |
| 86 | ), |
| 87 | ), |
| 88 | if (step != steps.last) |
| 89 | Container( |
| 90 | width: 5, |
| 91 | height: 10, |
| 92 | decoration: BoxDecoration( |
| 93 | color: Theme.of(context).colorScheme.surfaceContainer), |
| 94 | ) |
| 95 | ], |
| 96 | )) |
| 97 | .toList(), |
| 98 | ), |
| 99 | ), |
| 100 | Padding( |
| 101 | padding: const EdgeInsets.all(16), |
| 102 | child: PrimaryButton( |
| 103 | text: S.of(context).close, |
| 104 | color: context.currentTheme.colorScheme.primary, |
| 105 | textColor: context.currentTheme.colorScheme.onPrimary, |
| 106 | onPressed: () => Navigator.of(context).pop(), |
| 107 | ), |
| 108 | ) |
| 109 | ], |
| 110 | ), |
| 111 | ), |
| 112 | ), |
| 113 | ); |
| 114 | |
| 115 | @override |
| 116 | Widget footerWidget(BuildContext context) => SizedBox.shrink(); |
| 117 | } |