reactive_bloub 0.1.3 copy "reactive_bloub: ^0.1.3" to clipboard
reactive_bloub: ^0.1.3 copied to clipboard

An animated, procedurally-rendered blob mascot avatar for Flutter — 14 shapes, 16 expressions, and 15 animated states, all cross-fading live.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:reactive_bloub/reactive_bloub.dart';
// Note: The full interactive playground is located in playground.dart. 
// This file is a minimal example for pub.flutter-io.cn to demonstrate basic usage.

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: BloubSimpleExample(),
    );
  }
}

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

  @override
  State<BloubSimpleExample> createState() => _BloubSimpleExampleState();
}

class _BloubSimpleExampleState extends State<BloubSimpleExample> {
  // 1. Initialize the controller
  late final BloubController _controller;

  @override
  void initState() {
    super.initState();
    _controller = BloubController(
      initialShape: BloubShape.circle,
      initialState: BloubState.idle,
      initialExpression: BloubExpression.happy,
      initialPredefinedColor: BloubPredefinedColor.blue,
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFFF0F4F8),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // 2. Drop the BloubAvatar into your UI! (Plug and play)
            BloubAvatar(
              controller: _controller,
              size: 250,
            ),
            const SizedBox(height: 40),
            
            // 3. Control it!
            Wrap(
              spacing: 12,
              children: [
                ElevatedButton(
                  onPressed: () {
                    _controller.setState(BloubState.alert);
                    _controller.setExpression(BloubExpression.surprised);
                  },
                  child: const Text("Alert Reaction"),
                ),
                ElevatedButton(
                  onPressed: () {
                    _controller.setState(BloubState.orbit);
                    _controller.setExpression(BloubExpression.excited);
                  },
                  child: const Text("Orbit!"),
                ),
                ElevatedButton(
                  onPressed: () => _controller.setShape(BloubShape.cloud),
                  child: const Text("Morph to Cloud"),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
9
likes
155
points
167
downloads

Documentation

API reference

Publisher

verified publisherarinbuilds.com

Weekly Downloads

An animated, procedurally-rendered blob mascot avatar for Flutter — 14 shapes, 16 expressions, and 15 animated states, all cross-fading live.

Repository (GitHub)
View/report issues

Topics

#avatar #mascot #animation #character

License

MIT (license)

Dependencies

flutter, meta, path_drawing

More

Packages that depend on reactive_bloub