kasy-cli 1.12.1 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/kasy.js +21 -0
- package/lib/commands/splash.js +220 -0
- package/lib/scaffold/CHANGELOG.json +9 -0
- package/lib/scaffold/backends/api/patch/lib/main.dart +29 -10
- package/lib/scaffold/backends/supabase/patch/lib/main.dart +29 -10
- package/lib/scaffold/features/README.md +15 -139
- package/lib/scaffold/shared/generator-utils.js +16 -15
- package/lib/utils/i18n.js +78 -0
- package/package.json +2 -2
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night/background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night/launch_background.xml +9 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-hdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-hdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-mdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-mdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-v21/background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-v21/launch_background.xml +9 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xxxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/values-night-v31/styles.xml +2 -1
- package/templates/firebase/android/app/src/main/res/values-v31/styles.xml +1 -0
- package/templates/firebase/assets/images/splash_logo_dark.png +0 -0
- package/templates/firebase/assets/images/splash_logo_light.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json +9 -8
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchBackground.imageset/darkbackground.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +33 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImageDark.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImageDark@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImageDark@3x.png +0 -0
- package/templates/firebase/ios/Runner/Base.lproj/LaunchScreen.storyboard +1 -1
- package/templates/firebase/lib/core/theme/providers/theme_provider.dart +48 -24
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_features.dart +4 -0
- package/templates/firebase/lib/features/onboarding/ui/onboarding_page.dart +1 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_feature.dart +13 -0
- package/templates/firebase/lib/features/settings/settings_page.dart +158 -18
- package/templates/firebase/lib/i18n/en.i18n.json +6 -2
- package/templates/firebase/lib/i18n/es.i18n.json +6 -2
- package/templates/firebase/lib/i18n/pt.i18n.json +6 -2
- package/templates/firebase/lib/main.dart +29 -10
- package/templates/firebase/pubspec.yaml +4 -5
- package/templates/firebase/test/core/data/repositories/user_repository_test.dart +1 -1
- package/templates/firebase/web/index.html +47 -39
- package/templates/firebase/web/splash/img/dark-1x.png +0 -0
- package/templates/firebase/web/splash/img/dark-2x.png +0 -0
- package/templates/firebase/web/splash/img/dark-3x.png +0 -0
- package/templates/firebase/web/splash/img/dark-4x.png +0 -0
- package/templates/firebase/web/splash/img/light-1x.png +0 -0
- package/templates/firebase/web/splash/img/light-2x.png +0 -0
- package/templates/firebase/web/splash/img/light-3x.png +0 -0
- package/templates/firebase/web/splash/img/light-4x.png +0 -0
- package/lib/scaffold/features/analytics/lib/core/data/api/analytics_api.dart +0 -124
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.es.md +0 -35
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.md +0 -35
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.pt.md +0 -35
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.es.md +0 -12
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.md +0 -12
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.pt.md +0 -12
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.es.md +0 -17
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.md +0 -17
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.pt.md +0 -17
- package/lib/scaffold/features/ci/.github/dependabot.yml +0 -16
- package/lib/scaffold/features/ci/.github/workflows/app.yml +0 -20
- package/lib/scaffold/features/ci/.gitlab/templates/deploy.yaml +0 -14
- package/lib/scaffold/features/ci/.gitlab/templates/dropbox.yaml +0 -19
- package/lib/scaffold/features/ci/.gitlab/templates/flutter.yaml +0 -163
- package/lib/scaffold/features/ci/.gitlab/templates/mailgun.yaml +0 -28
- package/lib/scaffold/features/ci/.gitlab-ci.yml +0 -37
- package/lib/scaffold/features/ci/codemagic.yaml +0 -157
- package/lib/scaffold/features/facebook/lib/core/data/api/tracking_api.dart +0 -111
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/entities/feature_request_entity.dart +0 -27
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/entities/feature_vote_entity.dart +0 -27
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/feature_request_api.dart +0 -50
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/feature_vote_api.dart +0 -79
- package/lib/scaffold/features/feedback/lib/features/feedbacks/models/feature_requests.dart +0 -48
- package/lib/scaffold/features/feedback/lib/features/feedbacks/models/feedback_state.dart +0 -42
- package/lib/scaffold/features/feedback/lib/features/feedbacks/providers/feedback_page_notifier.dart +0 -147
- package/lib/scaffold/features/feedback/lib/features/feedbacks/repositories/feature_request_repository.dart +0 -95
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/component/add_feature_form.dart +0 -199
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/feedback_page.dart +0 -175
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/widgets/add_feature_button.dart +0 -76
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/widgets/feature_card.dart +0 -279
- package/lib/scaffold/features/ios-release/.kasy/apple.env.example +0 -8
- package/lib/scaffold/features/ios-release/.kasy/codemagic.env.example +0 -7
- package/lib/scaffold/features/ios-release/docs/codemagic-release.en.md +0 -50
- package/lib/scaffold/features/ios-release/docs/codemagic-release.es.md +0 -50
- package/lib/scaffold/features/ios-release/docs/codemagic-release.pt.md +0 -50
- package/lib/scaffold/features/ios-release/docs/ios-release.en.md +0 -41
- package/lib/scaffold/features/ios-release/docs/ios-release.es.md +0 -41
- package/lib/scaffold/features/ios-release/docs/ios-release.pt.md +0 -41
- package/lib/scaffold/features/ios-release/scripts/bump-ios-version.js +0 -38
- package/lib/scaffold/features/ios-release/scripts/release-ios.sh +0 -137
- package/lib/scaffold/features/llm_chat/lib/features/llm_chat/llm_chat_page.dart +0 -301
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/providers/reminder_notifier.dart +0 -81
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/repositories/reminder_preferences.dart +0 -76
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/ui/reminder_page.dart +0 -282
- package/lib/scaffold/features/onboarding/lib/features/onboarding/api/entities/user_info_entity.dart +0 -24
- package/lib/scaffold/features/onboarding/lib/features/onboarding/api/user_infos_api.dart +0 -71
- package/lib/scaffold/features/onboarding/lib/features/onboarding/models/user_info.dart +0 -92
- package/lib/scaffold/features/onboarding/lib/features/onboarding/providers/onboarding_model.dart +0 -15
- package/lib/scaffold/features/onboarding/lib/features/onboarding/providers/onboarding_provider.dart +0 -78
- package/lib/scaffold/features/onboarding/lib/features/onboarding/repositories/user_infos_repository.dart +0 -29
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/animations/page_transitions.dart +0 -30
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_att_setup.dart +0 -66
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_features.dart +0 -72
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_loader.dart +0 -92
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +0 -73
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_questions.dart +0 -89
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/onboarding_page.dart +0 -94
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_background.dart +0 -80
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_feature.dart +0 -139
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_illustration_scaffold.dart +0 -110
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_progress.dart +0 -84
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +0 -173
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_reassurance.dart +0 -45
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_sticky_footer.dart +0 -77
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/selectable_row_tile.dart +0 -392
- package/lib/scaffold/features/revenuecat/lib/core/data/api/tracking_api.dart +0 -116
- package/lib/scaffold/features/revenuecat/lib/core/data/models/subscription.dart +0 -322
- package/lib/scaffold/features/revenuecat/lib/core/home_widgets/home_widget_background_task.dart +0 -41
- package/lib/scaffold/features/revenuecat/lib/core/states/user_state_notifier.dart +0 -305
- package/templates/firebase/assets/images/splashscreen.png +0 -0
package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/selectable_row_tile.dart
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import 'package:flutter/material.dart';
|
|
2
|
-
import 'package:kasy_kit/core/theme/theme.dart';
|
|
3
|
-
|
|
4
|
-
typedef OnSelectRow = void Function(int index, bool selected);
|
|
5
|
-
|
|
6
|
-
/// Ex of usage
|
|
7
|
-
/// SelectableRowGroup(
|
|
8
|
-
/// onSelect: (index, selected) => onSelect(snapshot.data![index]),
|
|
9
|
-
/// options: snapshot.data!
|
|
10
|
-
/// .map(
|
|
11
|
-
/// (e) => SelectableOption(
|
|
12
|
-
/// title: e.name,
|
|
13
|
-
/// subtitle: "Created on ${e.formattedCreationDate}",
|
|
14
|
-
/// ),
|
|
15
|
-
/// )
|
|
16
|
-
/// .toList(),
|
|
17
|
-
/// )
|
|
18
|
-
class OnboardingSelectableRowGroup extends StatefulWidget {
|
|
19
|
-
final List<Widget> options;
|
|
20
|
-
final List<Widget?>? onSelectInfoWidget;
|
|
21
|
-
final OnSelectRow? onSelect;
|
|
22
|
-
final int? initialSelectedIndex;
|
|
23
|
-
final ScrollPhysics? physics;
|
|
24
|
-
|
|
25
|
-
const OnboardingSelectableRowGroup({
|
|
26
|
-
super.key,
|
|
27
|
-
required this.options,
|
|
28
|
-
this.onSelect,
|
|
29
|
-
this.initialSelectedIndex,
|
|
30
|
-
this.onSelectInfoWidget,
|
|
31
|
-
this.physics,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
@override
|
|
35
|
-
State<OnboardingSelectableRowGroup> createState() =>
|
|
36
|
-
_OnboardingSelectableRowGroupState();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class _OnboardingSelectableRowGroupState
|
|
40
|
-
extends State<OnboardingSelectableRowGroup> {
|
|
41
|
-
int? _selectedIndex;
|
|
42
|
-
|
|
43
|
-
@override
|
|
44
|
-
void initState() {
|
|
45
|
-
_selectedIndex = widget.initialSelectedIndex;
|
|
46
|
-
super.initState();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@override
|
|
50
|
-
Widget build(BuildContext context) {
|
|
51
|
-
return ListView.separated(
|
|
52
|
-
physics: widget.physics,
|
|
53
|
-
shrinkWrap: true,
|
|
54
|
-
separatorBuilder: (context, index) => const SizedBox(height: KasySpacing.sm),
|
|
55
|
-
itemCount: widget.options.length,
|
|
56
|
-
itemBuilder: (context, index) {
|
|
57
|
-
final hasOnSelectInfo = widget.onSelectInfoWidget != null &&
|
|
58
|
-
widget.onSelectInfoWidget!.length > index &&
|
|
59
|
-
widget.onSelectInfoWidget![index] != null;
|
|
60
|
-
return Column(
|
|
61
|
-
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
62
|
-
children: [
|
|
63
|
-
Material(
|
|
64
|
-
color: Colors.transparent,
|
|
65
|
-
borderRadius: KasyRadius.mdBorderRadius,
|
|
66
|
-
child: InkWell(
|
|
67
|
-
onTap: () {
|
|
68
|
-
if (_selectedIndex == index) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
setState(() {
|
|
72
|
-
_selectedIndex = index;
|
|
73
|
-
});
|
|
74
|
-
widget.onSelect?.call(index, true);
|
|
75
|
-
},
|
|
76
|
-
child: switch (hasOnSelectInfo && _selectedIndex == index) {
|
|
77
|
-
false => widget.options[index],
|
|
78
|
-
true => widget.options[index],
|
|
79
|
-
},
|
|
80
|
-
),
|
|
81
|
-
),
|
|
82
|
-
if (hasOnSelectInfo && _selectedIndex == index)
|
|
83
|
-
Padding(
|
|
84
|
-
padding: const EdgeInsets.only(top: KasySpacing.sm, bottom: KasySpacing.md),
|
|
85
|
-
child: widget.onSelectInfoWidget![index],
|
|
86
|
-
),
|
|
87
|
-
],
|
|
88
|
-
);
|
|
89
|
-
},
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
class OnboardingMultiSelectableRowGroup extends StatefulWidget {
|
|
95
|
-
final List<SelectableOption> options;
|
|
96
|
-
final OnSelectRow? onSelect;
|
|
97
|
-
final ScrollPhysics? physics;
|
|
98
|
-
// final int? initialSelectedIndex;
|
|
99
|
-
|
|
100
|
-
const OnboardingMultiSelectableRowGroup({
|
|
101
|
-
super.key,
|
|
102
|
-
required this.options,
|
|
103
|
-
this.onSelect,
|
|
104
|
-
this.physics,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
@override
|
|
108
|
-
State<OnboardingMultiSelectableRowGroup> createState() =>
|
|
109
|
-
_OnboardingMultiSelectableRowGroupState();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
class _OnboardingMultiSelectableRowGroupState
|
|
113
|
-
extends State<OnboardingMultiSelectableRowGroup> {
|
|
114
|
-
final Set<int> _selectedIndex = {};
|
|
115
|
-
|
|
116
|
-
@override
|
|
117
|
-
void initState() {
|
|
118
|
-
super.initState();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@override
|
|
122
|
-
Widget build(BuildContext context) {
|
|
123
|
-
return Wrap(
|
|
124
|
-
spacing: KasySpacing.sm,
|
|
125
|
-
runSpacing: KasySpacing.sm,
|
|
126
|
-
children: widget.options.map((option) {
|
|
127
|
-
final index = widget.options.indexOf(option);
|
|
128
|
-
return Material(
|
|
129
|
-
color: Colors.transparent,
|
|
130
|
-
borderRadius: KasyRadius.mdBorderRadius,
|
|
131
|
-
child: InkWell(
|
|
132
|
-
splashColor: context.colors.primary.withValues(alpha:.1),
|
|
133
|
-
onTap: () {
|
|
134
|
-
if (_selectedIndex.contains(index)) {
|
|
135
|
-
_selectedIndex.remove(index);
|
|
136
|
-
widget.onSelect?.call(index, false);
|
|
137
|
-
} else {
|
|
138
|
-
_selectedIndex.add(index);
|
|
139
|
-
widget.onSelect?.call(index, true);
|
|
140
|
-
}
|
|
141
|
-
setState(() {});
|
|
142
|
-
},
|
|
143
|
-
child: SelectableRowTile(
|
|
144
|
-
title: option.title,
|
|
145
|
-
subtitle: option.subtitle,
|
|
146
|
-
selected: _selectedIndex.contains(index),
|
|
147
|
-
emoj: option.emoj,
|
|
148
|
-
),
|
|
149
|
-
),
|
|
150
|
-
);
|
|
151
|
-
}).toList(),
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
class SelectableOption {
|
|
157
|
-
final String title;
|
|
158
|
-
final String? subtitle;
|
|
159
|
-
final String? emoj;
|
|
160
|
-
final bool selected;
|
|
161
|
-
|
|
162
|
-
const SelectableOption({
|
|
163
|
-
required this.title,
|
|
164
|
-
this.subtitle,
|
|
165
|
-
this.selected = false,
|
|
166
|
-
this.emoj,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/// Single row tile with a selectable radio box
|
|
171
|
-
class SelectableRowTile extends StatefulWidget {
|
|
172
|
-
final String? title;
|
|
173
|
-
final String? subtitle;
|
|
174
|
-
final String? emoj;
|
|
175
|
-
final bool selected;
|
|
176
|
-
final VoidCallback? onTap;
|
|
177
|
-
|
|
178
|
-
const SelectableRowTile({
|
|
179
|
-
super.key,
|
|
180
|
-
this.title,
|
|
181
|
-
this.subtitle,
|
|
182
|
-
this.selected = false,
|
|
183
|
-
this.onTap,
|
|
184
|
-
this.emoj,
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
@override
|
|
188
|
-
State<SelectableRowTile> createState() => _SelectableRowTileState();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
class _SelectableRowTileState extends State<SelectableRowTile>
|
|
192
|
-
with SingleTickerProviderStateMixin {
|
|
193
|
-
late final AnimationController _controller;
|
|
194
|
-
late final Animation<double> _opacityAnimation;
|
|
195
|
-
late final Animation<double> _iconSizeAnimation;
|
|
196
|
-
|
|
197
|
-
@override
|
|
198
|
-
void initState() {
|
|
199
|
-
super.initState();
|
|
200
|
-
_controller = AnimationController(
|
|
201
|
-
duration: const Duration(milliseconds: 500),
|
|
202
|
-
vsync: this,
|
|
203
|
-
);
|
|
204
|
-
_opacityAnimation = Tween(
|
|
205
|
-
begin: 0.0,
|
|
206
|
-
end: 1.0,
|
|
207
|
-
).animate(
|
|
208
|
-
CurvedAnimation(parent: _controller, curve: Curves.ease),
|
|
209
|
-
);
|
|
210
|
-
_iconSizeAnimation = Tween(
|
|
211
|
-
begin: 0.0,
|
|
212
|
-
end: 1.0,
|
|
213
|
-
).animate(
|
|
214
|
-
CurvedAnimation(parent: _controller, curve: Curves.elasticOut),
|
|
215
|
-
);
|
|
216
|
-
if (widget.selected) {
|
|
217
|
-
_controller.forward();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
@override
|
|
222
|
-
void dispose() {
|
|
223
|
-
_controller.dispose();
|
|
224
|
-
super.dispose();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@override
|
|
228
|
-
void didChangeDependencies() {
|
|
229
|
-
super.didChangeDependencies();
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
@override
|
|
233
|
-
void didUpdateWidget(covariant SelectableRowTile oldWidget) {
|
|
234
|
-
super.didUpdateWidget(oldWidget);
|
|
235
|
-
if (oldWidget.selected != widget.selected && widget.selected) {
|
|
236
|
-
_controller.forward();
|
|
237
|
-
} else if (oldWidget.selected != widget.selected && !widget.selected) {
|
|
238
|
-
_controller.reverse();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
@override
|
|
243
|
-
Widget build(BuildContext context) {
|
|
244
|
-
return Ink(
|
|
245
|
-
decoration: BoxDecoration(
|
|
246
|
-
border: Border.all(
|
|
247
|
-
color: widget.selected //
|
|
248
|
-
? context.colors.primary.withValues(alpha:.6)
|
|
249
|
-
: context.colors.primary.withValues(alpha:.1),
|
|
250
|
-
width: widget.selected ? 2 : 1,
|
|
251
|
-
),
|
|
252
|
-
borderRadius: KasyRadius.mdBorderRadius,
|
|
253
|
-
color: widget.selected
|
|
254
|
-
? context.colors.primary.withValues(alpha:.3)
|
|
255
|
-
: context.colors.surface,
|
|
256
|
-
),
|
|
257
|
-
padding: const EdgeInsets.symmetric(horizontal: KasySpacing.lg, vertical: KasySpacing.md),
|
|
258
|
-
child: Row(
|
|
259
|
-
children: [
|
|
260
|
-
if (widget.emoj != null)
|
|
261
|
-
Flexible(
|
|
262
|
-
flex: 0,
|
|
263
|
-
child: Padding(
|
|
264
|
-
padding: const EdgeInsets.only(right: KasySpacing.md),
|
|
265
|
-
child: Text(
|
|
266
|
-
widget.emoj!,
|
|
267
|
-
style: context.textTheme.titleMedium?.copyWith(
|
|
268
|
-
fontSize: 28,
|
|
269
|
-
),
|
|
270
|
-
),
|
|
271
|
-
),
|
|
272
|
-
),
|
|
273
|
-
Expanded(
|
|
274
|
-
child: Column(
|
|
275
|
-
crossAxisAlignment: CrossAxisAlignment.start,
|
|
276
|
-
children: [
|
|
277
|
-
if (widget.title != null)
|
|
278
|
-
Text(
|
|
279
|
-
widget.title!,
|
|
280
|
-
style: context.textTheme.bodyLarge?.copyWith(
|
|
281
|
-
fontWeight: FontWeight.w400,
|
|
282
|
-
),
|
|
283
|
-
),
|
|
284
|
-
if (widget.subtitle != null)
|
|
285
|
-
Padding(
|
|
286
|
-
padding: const EdgeInsets.only(top: KasySpacing.xs),
|
|
287
|
-
child: Text(
|
|
288
|
-
widget.subtitle!,
|
|
289
|
-
style: context.textTheme.bodySmall?.copyWith(
|
|
290
|
-
color: context.colors.muted,
|
|
291
|
-
),
|
|
292
|
-
),
|
|
293
|
-
),
|
|
294
|
-
],
|
|
295
|
-
),
|
|
296
|
-
),
|
|
297
|
-
const SizedBox(width: KasySpacing.sm),
|
|
298
|
-
if (!widget.selected)
|
|
299
|
-
Flexible(
|
|
300
|
-
flex: 0,
|
|
301
|
-
child: RoundRadioBox.unselected(context),
|
|
302
|
-
),
|
|
303
|
-
if (widget.selected)
|
|
304
|
-
Flexible(
|
|
305
|
-
flex: 0,
|
|
306
|
-
child: AnimatedBuilder(
|
|
307
|
-
animation: _controller,
|
|
308
|
-
builder: (context, child) {
|
|
309
|
-
return RoundRadioBox.selected(
|
|
310
|
-
context,
|
|
311
|
-
iconOpacity: _opacityAnimation.value,
|
|
312
|
-
iconSize: _iconSizeAnimation.value,
|
|
313
|
-
);
|
|
314
|
-
},
|
|
315
|
-
),
|
|
316
|
-
),
|
|
317
|
-
],
|
|
318
|
-
),
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
class RoundRadioBox extends StatelessWidget {
|
|
324
|
-
final Color bgColor;
|
|
325
|
-
final Color borderColor;
|
|
326
|
-
final IconData? icon;
|
|
327
|
-
final double iconOpacity;
|
|
328
|
-
final double iconSize;
|
|
329
|
-
|
|
330
|
-
const RoundRadioBox({
|
|
331
|
-
super.key,
|
|
332
|
-
required this.bgColor,
|
|
333
|
-
required this.borderColor,
|
|
334
|
-
this.iconOpacity = 1,
|
|
335
|
-
this.iconSize = 1,
|
|
336
|
-
this.icon,
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
factory RoundRadioBox.selected(
|
|
340
|
-
BuildContext context, {
|
|
341
|
-
double iconOpacity = 1,
|
|
342
|
-
double iconSize = 1,
|
|
343
|
-
}) {
|
|
344
|
-
return RoundRadioBox(
|
|
345
|
-
bgColor: context.colors.background.withValues(alpha:.3),
|
|
346
|
-
borderColor: context.colors.onPrimary.withValues(alpha:.3),
|
|
347
|
-
icon: Icons.check,
|
|
348
|
-
iconOpacity: iconOpacity,
|
|
349
|
-
iconSize: iconSize,
|
|
350
|
-
);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// ignore: avoid_unused_constructor_parameters
|
|
354
|
-
factory RoundRadioBox.unselected(BuildContext context) {
|
|
355
|
-
return RoundRadioBox(
|
|
356
|
-
bgColor: context.colors.outline,
|
|
357
|
-
borderColor: context.colors.surface.withValues(alpha:.1),
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
@override
|
|
362
|
-
Widget build(BuildContext context) {
|
|
363
|
-
return Container(
|
|
364
|
-
width: 28,
|
|
365
|
-
height: 28,
|
|
366
|
-
decoration: BoxDecoration(
|
|
367
|
-
color: bgColor,
|
|
368
|
-
shape: BoxShape.circle,
|
|
369
|
-
border: Border.all(
|
|
370
|
-
color: borderColor,
|
|
371
|
-
width: 4,
|
|
372
|
-
strokeAlign: BorderSide.strokeAlignOutside,
|
|
373
|
-
),
|
|
374
|
-
),
|
|
375
|
-
child: Center(
|
|
376
|
-
child: icon != null
|
|
377
|
-
? Opacity(
|
|
378
|
-
opacity: iconOpacity,
|
|
379
|
-
child: Transform.scale(
|
|
380
|
-
scale: iconSize,
|
|
381
|
-
child: Icon(
|
|
382
|
-
icon,
|
|
383
|
-
color: context.colors.muted,
|
|
384
|
-
size: 21,
|
|
385
|
-
),
|
|
386
|
-
),
|
|
387
|
-
)
|
|
388
|
-
: const SizedBox.shrink(),
|
|
389
|
-
),
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import 'dart:async';
|
|
2
|
-
|
|
3
|
-
import 'package:facebook_app_events/facebook_app_events.dart';
|
|
4
|
-
import 'package:flutter/foundation.dart';
|
|
5
|
-
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
6
|
-
import 'package:logger/logger.dart';
|
|
7
|
-
import 'package:permission_handler/permission_handler.dart';
|
|
8
|
-
import 'package:kasy_kit/core/initializer/onstart_service.dart';
|
|
9
|
-
import 'package:kasy_kit/core/states/models/user_state.dart';
|
|
10
|
-
import 'package:kasy_kit/core/states/user_state_notifier.dart';
|
|
11
|
-
import 'package:kasy_kit/features/notifications/repositories/device_repository.dart';
|
|
12
|
-
import 'package:purchases_flutter/purchases_flutter.dart';
|
|
13
|
-
import 'package:sentry_flutter/sentry_flutter.dart';
|
|
14
|
-
|
|
15
|
-
final facebookEventApiProvider = Provider(
|
|
16
|
-
(ref) => FacebookEventApi(
|
|
17
|
-
deviceRepository: ref.watch(deviceRepositoryProvider),
|
|
18
|
-
userState: ref.watch(userStateNotifierProvider),
|
|
19
|
-
),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
class FacebookEventApi implements OnStartService {
|
|
23
|
-
final DeviceRepository deviceRepository;
|
|
24
|
-
final UserState userState;
|
|
25
|
-
|
|
26
|
-
FacebookEventApi({
|
|
27
|
-
required this.deviceRepository,
|
|
28
|
-
required this.userState,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
@override
|
|
32
|
-
Future<void> init() async {
|
|
33
|
-
if (kIsWeb) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
// We must init the facebook app events
|
|
37
|
-
final facebookAppEvents = FacebookAppEvents();
|
|
38
|
-
// This is required by RevenueCat
|
|
39
|
-
await facebookAppEvents.setAutoLogAppEventsEnabled(false);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Future<void> initUser(String userId) async {
|
|
43
|
-
if (kIsWeb) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
final facebookAppEvents = FacebookAppEvents();
|
|
47
|
-
await facebookAppEvents.setUserID(userId);
|
|
48
|
-
|
|
49
|
-
if (defaultTargetPlatform != TargetPlatform.iOS) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
final isGranted = await Permission.appTrackingTransparency.isGranted;
|
|
53
|
-
if (!isGranted) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
await facebookAppEvents.setAdvertiserTracking(enabled: true);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
Future<void> requestIDFA() async {
|
|
60
|
-
if (kIsWeb) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
final facebookAppEvents = FacebookAppEvents();
|
|
64
|
-
if (defaultTargetPlatform == TargetPlatform.iOS) {
|
|
65
|
-
final status = await Permission.appTrackingTransparency.request();
|
|
66
|
-
|
|
67
|
-
debugPrint("IDFA status: $status");
|
|
68
|
-
if (status.isGranted) {
|
|
69
|
-
// collect identifiers for RevenueCat
|
|
70
|
-
await Purchases.collectDeviceIdentifiers();
|
|
71
|
-
await facebookAppEvents.setAdvertiserTracking(enabled: true);
|
|
72
|
-
await _initMetaUser();
|
|
73
|
-
unawaited(facebookAppEvents.flush());
|
|
74
|
-
await deviceRepository.refreshExtraData();
|
|
75
|
-
} else {
|
|
76
|
-
await facebookAppEvents.setAdvertiserTracking(enabled: false);
|
|
77
|
-
}
|
|
78
|
-
} else if (defaultTargetPlatform == TargetPlatform.android) {
|
|
79
|
-
await _initMetaUser();
|
|
80
|
-
await facebookAppEvents.setAutoLogAppEventsEnabled(true);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
Future<void> _initMetaUser() async {
|
|
85
|
-
final facebookAppEvents = FacebookAppEvents();
|
|
86
|
-
final userId = userState.user.idOrNull;
|
|
87
|
-
if (userId != null) {
|
|
88
|
-
await facebookAppEvents.setUserID(userId);
|
|
89
|
-
}
|
|
90
|
-
final userAnonId = await facebookAppEvents.getAnonymousId();
|
|
91
|
-
|
|
92
|
-
if (userAnonId != null) {
|
|
93
|
-
await Purchases.setFBAnonymousID(userAnonId);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
Future<void> logMetaStartTrial(String orderId, double price, String currency) async {
|
|
98
|
-
try {
|
|
99
|
-
final facebookAppEvents = FacebookAppEvents();
|
|
100
|
-
await facebookAppEvents.logStartTrial(orderId: orderId, price: price, currency: currency);
|
|
101
|
-
} catch (e) {
|
|
102
|
-
Logger().e("Error logging StartTrial (facebook): $e");
|
|
103
|
-
Sentry.captureException(e, stackTrace: StackTrace.current);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
Future<void> logMetaSubscribe(String orderId, double price, String currency) async {
|
|
108
|
-
try {
|
|
109
|
-
final facebookAppEvents = FacebookAppEvents();
|
|
110
|
-
await facebookAppEvents.logSubscribe(orderId: orderId, price: price, currency: currency);
|
|
111
|
-
} catch (e) {
|
|
112
|
-
Logger().e("Error logging Subscribe (facebook): $e");
|
|
113
|
-
Sentry.captureException(e, stackTrace: StackTrace.current);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|