Line data Source code
1 : import 'package:flutter/material.dart';
2 : import 'package:pal/src/database/entity/helper/helper_trigger_type.dart';
3 : import 'package:pal/src/database/entity/helper/helper_type.dart';
4 : import 'package:pal/src/ui/editor/pages/helper_editor/helper_editor_viewmodel.dart';
5 :
6 : ///-------------------------------
7 : /// Base helper config
8 : ///-------------------------------
9 : class CreateHelperConfig {
10 : String id;
11 : String route;
12 : String name;
13 : HelperTriggerType triggerType;
14 : HelperType helperType; //remove
15 : int priority;
16 : String minVersion;
17 : String maxVersion;
18 :
19 4 : CreateHelperConfig({
20 : this.id,
21 : @required this.route,
22 : @required this.name,
23 : @required this.triggerType,
24 : @required this.helperType,
25 : this.priority,
26 : this.minVersion,
27 : this.maxVersion,
28 : });
29 :
30 3 : factory CreateHelperConfig.from(String route, HelperViewModel viewModel)
31 3 : => CreateHelperConfig(
32 3 : id: viewModel?.id,
33 : route: route,
34 3 : name: viewModel.name,
35 3 : triggerType: viewModel?.triggerType,
36 3 : helperType: viewModel?.helperType,
37 3 : priority: viewModel?.priority,
38 3 : minVersion: viewModel?.minVersionCode,
39 3 : maxVersion: viewModel?.maxVersionCode,
40 : );
41 : }
42 :
43 : ///-------------------------------
44 : /// Simple helper model
45 : ///-------------------------------
46 : class CreateSimpleHelper {
47 : CreateHelperConfig config;
48 : HelperTextConfig titleText;
49 : HelperBoxConfig boxConfig;
50 :
51 2 : CreateSimpleHelper({
52 : @required this.config,
53 : @required this.titleText,
54 : @required this.boxConfig,
55 : });
56 : }
57 :
58 : ///-------------------------------
59 : /// Fullscreen helper model
60 : ///-------------------------------
61 : class CreateFullScreenHelper {
62 : CreateHelperConfig config;
63 : HelperTextConfig title, description, positivButton, negativButton;
64 : HelperMediaConfig mediaHeader;
65 : HelperBoxConfig bodyBox;
66 :
67 2 : CreateFullScreenHelper({
68 : @required this.config,
69 : @required this.title,
70 : @required this.description,
71 : this.positivButton,
72 : this.negativButton,
73 : @required this.bodyBox,
74 : this.mediaHeader,
75 : });
76 : }
77 :
78 : ///-------------------------------
79 : /// Update helper model
80 : ///-------------------------------
81 : class CreateUpdateHelper {
82 : CreateHelperConfig config;
83 : HelperTextConfig title, positivButton, negativButton;
84 : List<HelperTextConfig> lines;
85 : HelperBoxConfig bodyBox;
86 : HelperMediaConfig headerMedia;
87 :
88 2 : CreateUpdateHelper({
89 : @required this.config,
90 : @required this.title,
91 : @required this.lines,
92 : @required this.headerMedia,
93 : this.positivButton,
94 : this.negativButton,
95 : this.bodyBox,
96 : });
97 : }
98 :
99 : ///-------------------------------
100 : /// Text model for all types
101 : /// use this in helpers with multiple text
102 : ///-------------------------------
103 : class HelperTextConfig {
104 : int id;
105 : String text;
106 : String fontColor;
107 : String fontWeight;
108 : String fontFamily;
109 : int fontSize;
110 :
111 4 : HelperTextConfig(
112 : {this.id,
113 : @required this.text,
114 : @required this.fontColor,
115 : @required this.fontWeight,
116 : @required this.fontFamily,
117 : @required this.fontSize});
118 : }
119 :
120 : class HelperMediaConfig {
121 : int id;
122 : String url;
123 :
124 3 : HelperMediaConfig({
125 : this.id,
126 : this.url,
127 : });
128 : }
129 :
130 : class HelperBoxConfig {
131 : int id;
132 : String color;
133 : // TODO: Missing params ?
134 :
135 4 : HelperBoxConfig({
136 : this.id,
137 : this.color,
138 : });
139 : }
140 :
141 : // TODO: Create config for media
|