fake_store_client 1.0.0 copy "fake_store_client: ^1.0.0" to clipboard
fake_store_client: ^1.0.0 copied to clipboard

A Dart/Flutter package to easily interact with the Fake Store API. Includes models and services to fetch products, users, and cart data.

example/lib/main.dart

import 'package:example/screen/enriched_cart_screen.dart';
import 'package:example/screen/product_screen.dart';
import 'package:example/screen/user_screen.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const FakeStoreExampleApp());
}

class FakeStoreExampleApp extends StatelessWidget {
  const FakeStoreExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Fake Store Example',
      theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  int _selectedIndex = 0;

  final List<Widget> _pages = const [
    ProductScreen(),
    UserScreen(),
    EnrichedCartScreen(),
  ];

  final List<String> _titles = const ['Detalle del Producto', 'Detalle del usuario', 'Carrito'];

  void _onItemTapped(int index) {
    setState(() => _selectedIndex = index);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(_titles[_selectedIndex])),
      body: _pages[_selectedIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _selectedIndex,
        onTap: _onItemTapped,
        selectedItemColor: Colors.deepPurple,
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.shopping_bag),
            label: 'Producto',
          ),
          BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Usuario'),
          BottomNavigationBarItem(
            icon: Icon(Icons.shopping_cart),
            label: 'Carrito',
          ),
        ],
      ),
    );
  }
}
0
likes
0
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart/Flutter package to easily interact with the Fake Store API. Includes models and services to fetch products, users, and cart data.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dartz, http

More

Packages that depend on fake_store_client