An animated widget that displays atom with a three electrons revolving around a nucleus at its center.
size: 200 |
size: 100 |
size: 50 |
- Can be scaled upto any size within parent widget boundaries
- Smooth animations with mathematically pre-derived ellipse path equation
- Transparent background for flexible usage with colors
- 3 electron orbits (support for more may come later)
- Orbits angle can be changed
- Orbits color can be changed (support for individual color may come later)
- Orbits width can be changed
- Nucleus size can be changed
- Nucleus color can be changed
- Electrons color can be changed (support for individual color may come later)
- Individual electron's revolution duration can be changed
- Any widget can be added in the center instead of nucleus
In the pubspec.yaml
of your flutter project, add the following dependency:
dependencies:
...
create_atom: ^2.1.0-nullsafety
In your library add the following import:
import 'package:create_atom/create_atom.dart';
After that run flutter pub get
For help getting started with Flutter, view the online documentation.
...
child: Atom(
size: 100.0,
),
...
Yeah, just like that.
- All properties are optional except
size
property. - You will get a black atom by default.
Assign centerWidget
with any widget to display that Widget instead of nucleus.
...
child: Atom(
size: 100.0,
centerWidget: Text("At Center"),
),
...
Note: If both nucleusColor
and centerWidget
are set then the centerWidget
will get preference.
Property | Definition |
---|---|
size | Defines size of the atom's container |
nucleusRadiusFactor | Defines radius size factor of nucleus |
orbitsWidthFactor | Defines width factor of the orbits |
orbit1angle | Defines 1st orbit's angle in radians |
orbit2angle | Defines 2nd orbit's angle in radians |
orbit3angle | Defines 3rd orbit's angle in radians |
nucleusColor | Defines Nucleus Color |
orbitsColor | Defines Orbits Color |
electronsColor | Defines Electrons Color |
animDuration1 | Defines Animation Duration of 1st electron |
animDuration2 | Defines Animation Duration of 2nd electron |
animDuration3 | Defines Animation Duration of 3rd electron |
centerWidget | Defines a widget to display at center |
Property | Type | Initial Value |
---|---|---|
size | double |
null (required) |
nucleusRadiusFactor | double |
1.0 |
orbitsWidthFactor | double |
1.0 |
orbit1angle | double |
0.0 (Radians), 0.0 (Degrees) |
orbit2angle | double |
pi/3 (Radians), 60.0 (Degrees) |
orbit3angle | double |
-pi/3 (Radians), -60.0 (Degrees) |
nucleusColor | Color |
Colors.black |
orbitsColor | Color |
Colors.black |
electronsColor | Color |
Colors.black |
animDuration1 | Duration |
Duration(seconds: 1) |
animDuration2 | Duration |
Duration(seconds: 2) |
animDuration3 | Duration |
Duration(seconds: 3) |
centerWidget | Widget |
null |
Checkout here - https://abhi011999.github.io/create_atom_flutter/
Breaking Changes after the nullsafety migration from v2.0.0-nullsafety.0, see changelog for more info -
See CHANGELOG.md for recent changes.
You can be of great help if you want to improve or add anything !
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Package and all code within licensed under MIT License.