corner_bouncer

A simple Flutter widget that bounces around the boundaries of its container, ala that classic DVD menu icon.

Getting Started

To use the CornerBouncer widget in your Flutter project, you need only wrap it in a LayoutBuilder and then a Stack. These are excellent for adding a little life to a Scaffold background, or for programming a Pong client.

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Corner Bouncer Demo',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Corner Bouncer'),
        ),
        body: LayoutBuilder(
          builder: (BuildContext context, BoxConstraints constraints) {
            return Stack(
              children: <Widget>[
                CornerBouncer(
                  child: FlutterLogo(
                    size: 100,
                  ),
                  childHeight: 100,
                  childWidth: 100,
                  containerWidth: constraints.maxWidth,
                  containerHeight: constraints.maxHeight,
                ),
              ],
            );
          },
        )
      ),
    );
  }
}
Example

Libraries

corner_bouncer

Dart

VM

dart:ffi
Foreign Function Interface for interoperability with the C programming language. [...]

Web

dart:html
HTML elements and other resources for web-based applications that need to interact with the browser and the DOM (Document Object Model). [...]
dart:js
Low-level support for interoperating with JavaScript. [...]
dart:js_util
Utility methods to efficiently manipulate typed JSInterop objects in cases where the name to call is not known at runtime. You should only use these methods when the same effect cannot be achieved with @JS annotations. These methods would be extension methods on JSObject if Dart supported extension methods.