twitcasting_kit 0.0.12 copy "twitcasting_kit: ^0.0.12" to clipboard
twitcasting_kit: ^0.0.12 copied to clipboard

outdated

A new flutter package project.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:twitcasting_kit/twitcasting_kit.dart';

void main() {
  final clientId =
      "2504719675.3eff254ff10a67e8fee58c47d914d5f9ea5bdfb1bf159ece836511e6ba09e118";
  final clientSecret =
      "2cf4720f0bdedf40c7272629ca2e2ec9ea0d3029e168be7028ad0fcaff2d893e";
  Twitcasting.initialize(TwitcastingConfig(clientId, clientSecret));
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

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

class _MyHomePageState extends State<MyHomePage> {
  final _liveService = Twitcasting.getInstance().apiClient.liveService;
  List<Live> lives = [];

  @override
  void initState() {
    super.initState();
    _liveService.findByCategory("_system_screen_cast").then((lives) {
      setState(() => this.lives = lives);
    });
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(
          title: new Text("Recommended List"),
        ),
        body: new ListView.builder(
          itemBuilder: (context, index) {
            final live = lives[index];
            return Container(
                margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
                child: Row(
                  children: <Widget>[
                    Image(
                      width: 80.0,
                      height: 45.0,
                      image: NetworkImage(live.movie.smallThumbnailUrl),
                    ),
                    Flexible(
                      child: Text(
                        "${live.movie.title}",
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ));
          },
          itemCount: lives.length,
        ));
  }
}
0
likes
25
pub points
0%
popularity

Publisher

unverified uploader

A new flutter package project.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on twitcasting_kit