/
main.dart
167 lines (157 loc) · 6.58 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import 'package:flutter/material.dart';
import 'package:storyly_flutter/storyly_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'StorylyDemo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const HomePage(title: 'Storyly Demo Page'),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({
Key? key,
required this.title,
}) : super(key: key);
final String title;
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
static const storylyToken =
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjc2MCwiYXBwX2lkIjo0MDUsImluc19pZCI6NDA0fQ.1AkqOy_lsiownTBNhVOUKc91uc9fDcAxfQZtpm3nj40";
late StorylyViewController storylyViewController;
void onStorylyViewCreated(StorylyViewController storylyViewController) {
this.storylyViewController = storylyViewController;
}
@override
Widget build(BuildContext context) {
double devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter Plugin example app'),
),
body: ListView(
children: [
const Padding(padding: EdgeInsets.all(8.0)),
Container(
height: 90,
color: Colors.cyan,
child: StorylyView(
onStorylyViewCreated: onStorylyViewCreated,
androidParam: StorylyParam()
..storylyId = storylyToken
..storyGroupSize = "small"
..storyHeaderShareIcon = "launch_background"
..storyHeaderCloseIcon = "launch_background"
..storyItemTextTypeface = "Lobster1.4.otf"
..storyInteractiveTextTypeface = "Lobster1.4.otf"
..storyItemProgressBarColor = [Colors.red, Colors.yellow]
..storyItemIconBorderColor = [Colors.red, Colors.red],
iosParam: StorylyParam()
..storylyId = storylyToken
..storyGroupSize = "small"
..storyHeaderShareIcon = "AppIcon"
..storyHeaderCloseIcon = "AppIcon"
..storyItemTextTypeface = "Lobster1.4.otf"
..storyInteractiveTextTypeface = "Lobster1.4.otf"
..storyItemProgressBarColor = [Colors.red, Colors.yellow]
..storyItemIconBorderColor = [Colors.red, Colors.red],
storylyLoaded: (storyGroups, dataSource) {
debugPrint(
"storylyLoaded -> storyGroups: ${storyGroups.length}");
},
)),
const Padding(padding: EdgeInsets.all(8.0)),
Container(
height: 120,
color: Colors.lightGreen,
child: StorylyView(
onStorylyViewCreated: onStorylyViewCreated,
androidParam: StorylyParam()
..storylyId = storylyToken
..storyGroupSize = "large",
iosParam: StorylyParam()
..storylyId = storylyToken
..storyGroupSize = "large",
storylyLoaded: (storyGroups, dataSource) {
debugPrint(
"storylyLoaded -> storyGroups: ${storyGroups.length}");
},
)),
const Padding(padding: EdgeInsets.all(8.0)),
Container(
height: 170,
color: Colors.orange,
child: StorylyView(
onStorylyViewCreated: onStorylyViewCreated,
androidParam: StorylyParam()
..storylyId = storylyToken
..storyGroupSize = "custom"
..storyGroupIconHeight = (80 * devicePixelRatio).round()
..storyGroupIconWidth = (80 * devicePixelRatio).round()
..storyGroupIconCornerRadius =
(20 * devicePixelRatio).round()
..storyGroupListHorizontalEdgePadding =
(20 * devicePixelRatio).round()
..storyGroupListHorizontalPaddingBetweenItems =
(10 * devicePixelRatio).round()
..storyGroupTextTypeface = "Lobster1.4.otf"
..storyGroupTextSize = (20 * devicePixelRatio).round()
..storyGroupTextLines = 3
..storyGroupTextColorSeen = Colors.green
..storyGroupTextColorNotSeen = Colors.red
..storyGroupIconBorderColorNotSeen = [
Colors.red,
Colors.red
]
..storyGroupIconBorderColorSeen = [
Colors.white,
Colors.white
]
..storyGroupIconBackgroundColor = Colors.black
..storyGroupPinIconColor = Colors.black,
iosParam: StorylyParam()
..storylyId = storylyToken
..storyGroupSize = "custom"
..storyGroupIconHeight = 80
..storyGroupIconWidth = 80
..storyGroupIconCornerRadius = 20
..storyGroupListHorizontalEdgePadding = 20
..storyGroupListHorizontalPaddingBetweenItems = 10
..storyGroupTextTypeface = "Lobster1.4.otf"
..storyGroupTextSize = 20
..storyGroupTextLines = 3
..storyGroupTextColorSeen = Colors.green
..storyGroupTextColorNotSeen = Colors.red
..storyGroupIconBorderColorNotSeen = [
Colors.red,
Colors.red
]
..storyGroupIconBorderColorSeen = [
Colors.white,
Colors.white
]
..storyGroupIconBackgroundColor = Colors.black
..storyGroupPinIconColor = Colors.black,
storylyLoaded: (storyGroups, dataSource) {
debugPrint(
"storylyLoaded -> storyGroups: ${storyGroups.length}");
},
)),
],
),
),
);
}
}