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

A Flutter Package that allows you to Jiggle your Widgets.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:jiggle/jiggle.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: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final JiggleController controller = JiggleController();

  void _jiggleStuff() {
    controller.toggle();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Jiggle Demo"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Jiggle(
              jiggleController: controller,
              // extent: 9,
              child: Text(
                'You have pushed the button this many times:',
              ),
            ),
            Jiggle(
              jiggleController: controller,
              extent: 8,
              duration: Duration(milliseconds: 500),
              child: Text(
                '😂',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
            Jiggle(
              jiggleController: controller,
              useGestures: true,
              extent: 3,
              child: Container(
                height: 200,
                margin: EdgeInsets.all(20),
                decoration: BoxDecoration(
                    color: Colors.blueAccent,
                    borderRadius: BorderRadius.circular(20)),
              ),
            ),
            JiggleBuilder(
              controller: controller,
              builder: (context, state) {
                return Text(state.toString());
              },
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: _jiggleStuff,
        icon: Icon(Icons.vibration),
        label: Text("Jiggle"),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
3
likes
30
pub points
42%
popularity

Publisher

unverified uploader

A Flutter Package that allows you to Jiggle your Widgets.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

basics, equatable, flutter, rxdart, vector_math

More

Packages that depend on jiggle