storyly_flutter 1.9.0 storyly_flutter: ^1.9.0 copied to clipboard
storyly_flutter is the official flutter package of Storyly. You can easily add stories to your Flutter app with this package.
import 'package:flutter/material.dart';
import 'package:storyly_flutter/storyly_flutter.dart';
import 'dart:async';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
StorylyViewController storylyViewController;
@override
void initState() {
super.initState();
}
void onStorylyViewCreated(StorylyViewController storylyViewController) {
this.storylyViewController = storylyViewController;
// You can call any function after this.
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Container(
// margin: const EdgeInsets.only(top: 5.0),
height: 120,
child: StorylyView(
onStorylyViewCreated: onStorylyViewCreated,
androidParam: StorylyParam()
..storylyId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjg0NiwiYXBwX2lkIjo0NzAsImluc19pZCI6NDY2fQ.5Ag5dqOxAWzKwYnuM1Voo_bTl7RMXFRh2S1EzVeI01w"
// ..storyGroupTextColor = Color.fromARGB(255, 255, 128, 0),
..storyGroupTextColor = Color.fromRGBO(0, 0, 0, 0),
iosParam: StorylyParam()
..storylyId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjg0NiwiYXBwX2lkIjo0NzAsImluc19pZCI6NDY2fQ.5Ag5dqOxAWzKwYnuM1Voo_bTl7RMXFRh2S1EzVeI01w"
..storyGroupTextColor = Color.fromRGBO(0, 0, 0, 0),
storylyLoaded: (storyGroupList) => print("storylyLoaded"),
storylyLoadFailed: (errorMessage) => print("storylyLoadFailed"),
storylyActionClicked: (story) {
print("storylyActionClicked");
this.storylyViewController.storyDismiss();
},
storylyEvent: (event) => print("storylyEvent"),
storylyStoryShown: () => print("storylyStoryShown"),
storylyStoryDismissed: () => print("storylyStoryDismissed"),
storylyUserInteracted: (eventPayload) => print("storylyUserInteracted")
),
),
),
);
}
}