floating_bubbles 2.6.2 floating_bubbles: ^2.6.2 copied to clipboard
A Flutter Package for adding Floating bubbles on the Foreground to any Flutter widget.
import 'package:floating_bubbles/floating_bubbles.dart';
import 'package:flutter/material.dart';
import 'fps.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
showPerformanceOverlay: true,
home: Scaffold(
body: HomePage(),
),
);
}
}
// Simple example.
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
eachFrame()
.take(10000)
.transform(const ComputeFps())
// ignore: avoid_print
.listen((fps) => print('fps: $fps'));
return Stack(
children: [
Positioned.fill(
child: Container(
color: Colors.blue,
),
),
Positioned.fill(
child: FloatingBubbles.alwaysRepeating(
noOfBubbles: 50,
colorsOfBubbles: const [
Colors.white,
Colors.red,
],
sizeFactor: 0.2,
opacity: 70,
speed: BubbleSpeed.slow,
paintingStyle: PaintingStyle.fill,
shape: BubbleShape.circle, //This is the default
),
),
],
);
}
}