Skip to content

Commit

Permalink
Merge pull request #1 from MadBrains/initial_release
Browse files Browse the repository at this point in the history
initial release
  • Loading branch information
KolasikOmetov authored Nov 20, 2024
2 parents 74124fb + 727acda commit c544090
Show file tree
Hide file tree
Showing 93 changed files with 3,001 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "pub"
directory: "/"
schedule:
interval: "weekly"
24 changes: 24 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pull_request

on:
pull_request:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: 'Git Checkout'
uses: actions/checkout@v3
- name: 'Install Flutter'
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: 'Install Tools'
run: flutter pub global activate fvm; make init;
- name: 'Format Code'
run: make fix
- name: 'Validate Formatting'
run: ./tool/validate-formatting.sh
17 changes: 17 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: push

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jacopocarlini/action-autotag@master
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
package_root: "/"
tag_prefix: "v"
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
build/
.flutter-plugins
.flutter-plugins-dependencies

# FVM
.fvm/
.fvmrc
10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a"
channel: "stable"

project_type: package
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

* Initial release.
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.PHONY: version doctor

PANA_SCRIPT = ./tool/verify_pub_score.sh 100
VALIDATE_SCRIPT = ./tool/validate-formatting.sh
BUMPV_VERSION_SCRIPT = ./tool/bump-version.sh

EXAMPLE_PATH = example

FVM = fvm
FVM_FLUTTER = $(FVM) flutter
DART = dart
FVM_DART = $(FVM) ${DART}


init:
make activate_fvm; $(FVM) use 3.24.3 --force; $(FVM_DART) pub global activate pana;

activate_fvm:
${DART} pub global activate ${FVM}

version:
$(FVM_FLUTTER) --version; $(FVM_DART) --version;

doctor:
$(FVM_FLUTTER) doctor;

ifeq (bump, $(firstword $(MAKECMDGOALS)))
runargs := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(runargs):;@true)
endif
bump:
./tool/bump-version.sh $(filter-out $@,$(MAKECMDGOALS))

pub_get:
$(FVM_FLUTTER) packages get;

clean:
$(FVM_FLUTTER) clean;

fix:
$(FVM_DART) format .;

analyze:
$(FVM_FLUTTER) analyze . --fatal-infos;

pana:
$(PANA_SCRIPT);

validate:
$(VALIDATE_SCRIPT)
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# gravity_box

A Flutter library that provides a GravityBox widget for simulating gravity inside of it.

This widget uses the [GravitySensor](https://pub.dev/packages/gravity_sensor) package to get the device's gravity sensor data.

## Features

- **Gravity Simulation**: Simulate gravity for widgets using the `GravityBox` widget.
- **Collision Detection**: Simple collision system between `GravityObject` and other children widgets.

## Usage

Import the package

```dart
import 'package:gravity_box/gravity_box.dart';
```


Use the widget.

```dart
GravityBox(
gravityObjects: [
GravityObject(
size: 100,
widget: Container(
width: 42,
height: 42,
color: Colors.purple,
),
),
],
);
```


Provide a list of `GravityObject`s to the `gravityObjects` property. The `GravityBox` will automatically update the `GravityObject`s position and velocity based on the device's gravity sensor data.\
The `size` used to calculate bounding box of the object. Keep in mind that the size of the object is not the same as the size of the widget.\
The `position` is the top-left corner of the object in the `GravityBox` coordinate system (its layout contraints).\
If you want to add rolling ability (e.g. for circle-shaped widgets), set `canRoll: true` in the `GravityObject`.\
The `angle` is the current rotation degrees of the object.\
The `widget` is the widget that will be displayed as the object.\

```dart
GravityBox(
gravityObjects: [
GravityObject(
size: 100,
position: Vector2(50, 100),
canRoll: true,
angle: 90,
widget: Container(
width: 42,
height: 42,
color: Colors.purple,
),
),
],
);
```


To display debug info for the `GravityObject`, such as its position and borders, set `debugShowObjectsPosition: true` in the `GravityBox`.

```dart
GravityBox(
debugShowObjectsPosition: true,
gravityObjects: [
GravityObject(
child: Container(
width: 42,
height: 42,
color: Colors.purple,
),
),
],
);
```


To display additional widgets in `GravityBox`, provide them in the `children` property if you want them to collide with `GravityObject`s and in the `notCollidableChildren` property if you want them to not collide with `GravityObject`s.

```dart
const GravityBox(
notCollidableChildren: [
Positioned.fill(
child: ColoredBox(color: Color(0x80000000)),
),
],
children: [FlutterLogo()],
);
```

## Example

See full [Example][example] in the corresponding folder

[example]: https://github.com/MadBrains/Gravity-Box-Flutter/tree/main/example
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
44 changes: 44 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
/pubspec.lock
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: android
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: ios
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: linux
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: macos
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: web
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: windows
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# example

A new Flutter project.
1 change: 1 addition & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml
13 changes: 13 additions & 0 deletions example/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
Loading

0 comments on commit c544090

Please sign in to comment.