pokedex_search 1.0.2 copy "pokedex_search: ^1.0.2" to clipboard
pokedex_search: ^1.0.2 copied to clipboard

Package to introduce all 151 pokemons of the first generation.

Pokedex Search #

Package to introduce all 151 pokemons of the first generation.

image

How To Use #

Import the following package in your dart file

import 'package:pokedex_search/pokedex_search.dart';

Usage #

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

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

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

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: Center(
        child: FutureBuilder<PokedexSearch>(
          future: PokedexSearch.getListPokemons(),
          builder: (context, snapshot) {
            return snapshot.data == null
                ? ''
                : ListView.builder(
                    itemCount: snapshot.data.pokemon.length,
                    itemBuilder: (_, i) {
                      var pokemon = snapshot.data.pokemon[i];
                      return ListTile(
                        tileColor: ConstColors.getColorType('${pokemon.type}'),
                        title: Text('${pokemon.name}'),
                      );
                    },
                  );
          },
        ),
      ),
    );
  }
}

Methods #

FutureBuilder<PokedexSearch> listPokemons = PokedexSearch.getListPokemons();
Color colorbyType = ConstColors.getColorType(listPokemons.pokemon[150].type);
3
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Package to introduce all 151 pokemons of the first generation.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, flutter

More

Packages that depend on pokedex_search