social_media_widgets 1.0.0+2 copy "social_media_widgets: ^1.0.0+2" to clipboard
social_media_widgets: ^1.0.0+2 copied to clipboard

A new flutter package for collection of common popular social media widgets like instagram story swipe and snapchat screen dismiss

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:social_media_widgets/instagram_story_swipe.dart';
import 'package:social_media_widgets/snapchat_dismissible.dart';

import 'screen.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Container(
        margin: EdgeInsets.symmetric(horizontal: 30),
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              RaisedButton(
                onPressed: _onSnapchatDismissibleWithBlackButtonPressed,
                child: Text('Basic Snapchat dismissible'),
              ),
              SizedBox(height: 16),
              RaisedButton(
                onPressed: _onSnapchatDismissibleWithPreviousScreenPressed,
                child: Text(
                  'Snapchat dismissible with previous screen as background',
                  textAlign: TextAlign.center,
                ),
              ),
              SizedBox(height: 16),
              RaisedButton(
                onPressed: _onSnapchatDismissibleWithCustomHeightPressed,
                child: Text(
                  'Snapchat dismissible with increased custom height',
                  textAlign: TextAlign.center,
                ),
              ),
              SizedBox(height: 16),
              RaisedButton(
                onPressed: _onInstagramStorySwipeClicked,
                child: Text(
                  'Instagram story swipe',
                  textAlign: TextAlign.center,
                ),
              ),
              SizedBox(height: 16),
              RaisedButton(
                onPressed:
                    _onInstagramStorySwipeWithInitialPageSpecifiedClicked,
                child: Text(
                  'Instagram story swipe with initial page as screen 2',
                  textAlign: TextAlign.center,
                ),
              ),
              SizedBox(height: 16),
              RaisedButton(
                onPressed: _onInstagramAndStorySwipeCombined,
                child: Text(
                  'Instagram story swipe and snapchat dismiss combined',
                  textAlign: TextAlign.center,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  _onSnapchatDismissibleWithBlackButtonPressed() {
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => SnapchatDismiss(
          child: Screen('Screen', Colors.redAccent),
        ),
      ),
    );
  }

  _onSnapchatDismissibleWithPreviousScreenPressed() {
    Navigator.push(
      context,
      PageRouteBuilder(
        opaque: false,
        pageBuilder: (_, __, ___) =>
            SnapchatDismiss(child: Screen('Screen', Colors.redAccent)),
      ),
    );
  }

  _onSnapchatDismissibleWithCustomHeightPressed() {
    Navigator.push(
      context,
      PageRouteBuilder(
        opaque: false,
        pageBuilder: (_, __, ___) => SnapchatDismiss(
          dismissHeight: 250,
          child: Screen('Screen', Colors.redAccent),
        ),
      ),
    );
  }

  _onInstagramStorySwipeClicked() {
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => InstagramStorySwipe(
          children: <Widget>[
            Screen('Screen 1', Colors.lightBlueAccent),
            Screen('Screen 2', Colors.redAccent),
            Screen('Screen 3', Colors.greenAccent),
          ],
        ),
      ),
    );
  }

  _onInstagramStorySwipeWithInitialPageSpecifiedClicked() {
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => InstagramStorySwipe(
          initialPage: 1,
          children: <Widget>[
            Screen('Screen 1', Colors.lightBlueAccent),
            Screen('Screen 2', Colors.redAccent),
            Screen('Screen 3', Colors.greenAccent),
          ],
        ),
      ),
    );
  }

  _onInstagramAndStorySwipeCombined() {
    Navigator.push(
      context,
      PageRouteBuilder(
        pageBuilder: (_, __, ___) => SnapchatDismiss(
          child: InstagramStorySwipe(
            initialPage: 1,
            children: <Widget>[
              Screen('Screen 1', Colors.lightBlueAccent),
              Screen('Screen 2', Colors.redAccent),
              Screen('Screen 3', Colors.greenAccent),
            ],
          ),
        ),
      ),
    );
  }
}
84
likes
40
pub points
61%
popularity

Publisher

unverified uploader

A new flutter package for collection of common popular social media widgets like instagram story swipe and snapchat screen dismiss

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on social_media_widgets