dad_joke 0.0.3 copy "dad_joke: ^0.0.3" to clipboard
dad_joke: ^0.0.3 copied to clipboard

A package to get random dad jokes from the internet and display them in your app.

example/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Get Dad Joke',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: [
          IconButton(
            onPressed: () {},
            icon: const Icon(Icons.share),
          ),
          IconButton(
            onPressed: () {},
            icon: const Icon(Icons.favorite_border),
          ),
        ],
      ),
      body: const SizedBox(
        child: DadJoke(
          // all fields are optional
          backgroundColor: Colors.white, // get Background Color
          reloadIcon: Icons.replay_outlined, // get Icon to show
          reloadIconColor: Colors.red, // get Icon Color
          onLoadView: CircularProgressIndicator(), // get Loader to show
          onLoadViewColor: Colors.red, // get loader color
        ),
      ),
    );
  }
}
1
likes
150
pub points
0%
popularity

Publisher

unverified uploader

A package to get random dad jokes from the internet and display them in your app.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on dad_joke