temtem_api_wrapper 0.1.1+3 copy "temtem_api_wrapper: ^0.1.1+3" to clipboard
temtem_api_wrapper: ^0.1.1+3 copied to clipboard

discontinued

Wrapper for all the methods of the unofficial Temtem REST API.

example/lib/main.dart

import 'package:example/pages/all_conditions.dart';
import 'package:example/pages/all_rewards.dart';
import 'package:example/pages/all_temtems.dart';
import 'package:example/pages/all_types.dart';
import 'package:example/pages/all_locations.dart';
import 'package:flutter/material.dart';
import 'package:temtem_api_wrapper/temtem_api_wrapper.dart';

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

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

class TabItem {
  final String label;
  final Widget page;

  TabItem(this.label, this.page);
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage>
    with SingleTickerProviderStateMixin {
  final TemTemApi _api = TemTemApi();
  List<TabItem> _items;

  TabController _tabController;

  @override
  void initState() {
    super.initState();
    _items = <TabItem>[
      TabItem('Temtems', AllTemtems(_api)),
      TabItem('Rewards', AllRewards(_api)),
      TabItem('Types', AllTypes(_api)),
      TabItem('Conditions', AllConditions(_api)),
      TabItem('Locations', AllLocations(_api))
    ];
    _tabController = TabController(length: _items.length, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        bottom: TabBar(
          isScrollable: true,
          controller: _tabController,
          tabs: _items.map<Tab>((e) => Tab(text: e.label)).toList(),
        ),
      ),
      body: TabBarView(
        controller: _tabController,
        children: _items.map<Widget>((e) => e.page).toList(),
      ),
    );
  }
}
2
likes
40
pub points
0%
popularity

Publisher

verified publisherrouxguillau.me

Wrapper for all the methods of the unofficial Temtem REST API.

Homepage
Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, http

More

Packages that depend on temtem_api_wrapper