storyly_flutter 1.8.6 copy "storyly_flutter: ^1.8.6" to clipboard
storyly_flutter: ^1.8.6 copied to clipboard

outdated

Storyly for flutter.

example/lib/main.dart

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: 130,
          child: StorylyView(
            onStorylyViewCreated: onStorylyViewCreated,
            androidParam: StorylyParam()
            ..storylyId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjg0NiwiYXBwX2lkIjo0NzAsImluc19pZCI6NDY2fQ.5Ag5dqOxAWzKwYnuM1Voo_bTl7RMXFRh2S1EzVeI01w",
            iosParam: StorylyParam()
            ..storylyId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjg0NiwiYXBwX2lkIjo0NzAsImluc19pZCI6NDY2fQ.5Ag5dqOxAWzKwYnuM1Voo_bTl7RMXFRh2S1EzVeI01w",
            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")
          ),
        ),
      ),
    );
  }
}