bluesky_cards 0.0.1 copy "bluesky_cards: ^0.0.1" to clipboard
bluesky_cards: ^0.0.1 copied to clipboard

Provide widgets to render Bluesky Social post content beautifully in Flutter app.

example/lib/main.dart

// Copyright 2023 Kato Shinya. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided the conditions.

import 'package:bluesky/bluesky.dart' as bsky;
import 'package:bluesky_cards/bluesky_cards.dart' as bskyc;

import 'package:flutter/material.dart';

void main() {
  runApp(
    const MaterialApp(
      title: 'Bluesky Cards Demo',
      home: BlueskyCards(),
    ),
  );
}

class BlueskyCards extends StatelessWidget {
  const BlueskyCards({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FutureBuilder(
        future: bsky.createSession(
          handle: 'YOUR_HANDLE',
          password: 'YOUR_PASSWORD',
        ),
        builder: (BuildContext context, AsyncSnapshot snapshot) {
          if (!snapshot.hasData) {
            return const CircularProgressIndicator();
          }

          final bsky.Session session = snapshot.data.data;
          final bluesky = bsky.Bluesky.fromSession(session);

          return FutureBuilder(
            future: bluesky.feeds.findFeeds(
              author: session.did,
              limit: 5,
            ),
            builder: (BuildContext context, AsyncSnapshot snapshot) {
              if (!snapshot.hasData) {
                return const CircularProgressIndicator();
              }

              final List<bsky.Feed> feeds = snapshot.data.data.feeds;

              return ListView.builder(
                itemCount: feeds.length,
                itemBuilder: (BuildContext context, int index) {
                  return Card(
                    child: bskyc.EmbeddedCard.fromFeed(feeds[index]),
                  );
                },
              );
            },
          );
        },
      ),
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

verified publisheratprotodart.com

Provide widgets to render Bluesky Social post content beautifully in Flutter app.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com

License

unknown (LICENSE)

Dependencies

bluesky, cached_network_image, flutter, html_unescape, url_launcher

More

Packages that depend on bluesky_cards