cubef 1.0.3

Flutter CubeF #

A 3D Cube Widget, which simulate animation (roll-up, roll-down, roll-left, and roll-right), and you can also skinning the sides. This widget is inspired by [https://github.com/deven98/flip_box_bar].

Demo #

Install and how to use it. #

Please visit my blog [https://dev.jas-tip.com/flutter-cube-widget].

[1.0.3] - 04-APR-2019.

  • Change 6 childs parameter into List
  • Format the code, (remove unused variable)

[1.0.2] - 04-APR-2019.

  • Intial publish

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Cubef Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Cubef Widget Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  GlobalKey<CubefState> cubefKey = new GlobalKey<CubefState>();
  
  void rollDown() {
    cubefKey.currentState.rollDown();
  }

  void rollUp() {
    cubefKey.currentState.rollUp();
  }

  void rollLeft() {
    cubefKey.currentState.rollLeft();
  }

  void rollRight() {
    cubefKey.currentState.rollRight();
  }

  static double _width = 100.0, _height = 100.0;

  List<Widget> sides = [
    Container(
      height: _height,
      width: _width,
      decoration: BoxDecoration(
        color: Colors.black
      ),
      child: Text("1"),
    ),
    Container(
      height: _height,
      width: _width,
      decoration: BoxDecoration(
        color: Colors.green[500],
      ),
      child: Text("2"),
    ),
    Container(
      height: _height,
      width: _width,
      decoration: BoxDecoration(
        color: Colors.orange[500],
      ),
      child: Text("3"),
    ),
    Container(
      height: _height,
      width: _width,
      decoration: BoxDecoration(
        color: Colors.blue[500],
      ),
      child: Text("4"),
    ),
    Container(
      height: _height,
      width: _width,
      decoration: BoxDecoration(
        color: Colors.pink[500],
      ),
      child: Text("5"),
    ),
    Container(
      height: _height,
      width: _width,
      decoration: BoxDecoration(
        color: Colors.purple[500],
      ),
      child: Text("6"),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Cubef(
            key: cubefKey,
            animationDuration: 2000,
            sides: sides,
            width: _width,
            height: _height,
          ),
          Divider(),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
            RaisedButton(onPressed: rollUp, child: Text('Roll Up')),
            RaisedButton(onPressed: rollDown, child: Text('Roll Down')),
            RaisedButton(onPressed: rollLeft, child: Text('Roll Left')),
            RaisedButton(onPressed: rollRight, child: Text('Roll Right')),
          ],)
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  cubef: ^1.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:cubef/cubef.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
11
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Jul 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/cubef.dart.

Run flutter format to format lib/cubef.dart.

Maintenance issues and suggestions

Homepage URL isn't helpful. (-10 points)

Update the homepage field from pubspec.yaml: link to a website about the package or use the source repository URL.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cupertino_icons ^0.1.2 0.1.2
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin