这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2f6ee39
Upgraded to null safety and added VGV coverage + analysis
Oct 2, 2021
0cca283
Merge pull request #1 from NaagAlgates/null-safety-upgrade
NaagAlgates Oct 2, 2021
885ec33
Upgraded to v2
Oct 2, 2021
c3f3e77
Upgraded to Flutter v2
Oct 2, 2021
63a2303
Merge pull request #2 from NaagAlgates/null-safety-upgrade
NaagAlgates Oct 2, 2021
8b1c242
Removed test
Oct 2, 2021
41bb6f4
change gh ci
Oct 2, 2021
a124c05
Merge pull request #3 from NaagAlgates/null-safety-upgrade
NaagAlgates Oct 2, 2021
8a8057d
Modified gh ci
Oct 2, 2021
f1b346f
removed vgv coverage
Oct 2, 2021
5147505
Initial setup for upgrade
Oct 2, 2021
0ea6161
Initialize grid
Oct 4, 2021
8c0c5ac
Added left swipe functionality
Oct 9, 2021
b2b009e
Added functionality for right swipe
Oct 9, 2021
a3ce7da
Added functionality for Swipe up
Oct 9, 2021
10d52e8
Added functionality for game over, top down and game won
Oct 9, 2021
ca04658
Storing and emitting of scores done
Oct 9, 2021
3969f8a
Added ui for game won and lost
Oct 10, 2021
7ca35bf
Added functionality for reset and minor animations for score
Oct 10, 2021
5e7deee
Removed old code
Oct 10, 2021
af8d419
Merge pull request #4 from NaagAlgates/upgrade-bloc
NaagAlgates Oct 10, 2021
a2667ab
Added initial test cases
Oct 10, 2021
4f7df43
Added read me
Oct 10, 2021
8f28711
Merge pull request #5 from NaagAlgates/task/test-cases
NaagAlgates Oct 10, 2021
e14e0f7
Merge pull request #6 from NaagAlgates/task/update_readme
NaagAlgates Oct 10, 2021
cf0489b
Updated coveralls badge url
Oct 10, 2021
3c07e9b
Added License
NaagAlgates Oct 10, 2021
c7266f2
Resolved render overflow issue
Oct 10, 2021
db8f68a
Fixed game won condition
Oct 11, 2021
fdbab0d
Added new screenshots
Oct 11, 2021
22c25c9
Update README.md
NaagAlgates Oct 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 2048-ci

on:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'

- uses: subosito/flutter-action@v1
with:
channel: 'stable'

- run: flutter pub get

- run: flutter test

- run: |
echo "repo_token: ${{ secrets.COVERALLS_TOKEN }}" > .coveralls.yml


- run: sudo gem install coveralls-lcov

- run: flutter test --coverage

- run: coveralls-lcov coverage/lcov.info

- uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
path: 'coverage/lcov.info'
min_coverage: 60
exclude: '**/*_observer.dart **/change.dart'

- run: flutter build apk --no-tree-shake-icons
118 changes: 115 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,121 @@
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.dart_tool/
.atom/
.buildlog/
.history
.svn/

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

# Visual Studio Code related
.classpath
.project
.settings/
.vscode/

# Flutter repo-specific
/bin/cache/
/bin/internal/bootstrap.bat
/bin/internal/bootstrap.sh
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/devicelab/ABresults*.json
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
analysis_benchmark.json

# packages file containing multi-root paths
.packages.generated

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
**/generated_plugin_registrant.dart
.packages
.pub-cache/
.pub/

build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds

.flutter-plugins
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
*.jks

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift

# Coverage
coverage/

# Symbols
app.*.symbols

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock

# Coveralls
.coveralls.yml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Nagaraj Alagusundaram

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
[![2048-ci](https://github.com/NaagAlgates/2048/actions/workflows/main.yml/badge.svg)](https://github.com/NaagAlgates/2048/actions/workflows/main.yml)
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
[![Coverage Status](https://coveralls.io/repos/github/NaagAlgates/2048/badge.svg?branch=master)](https://coveralls.io/github/NaagAlgates/2048?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![](https://img.shields.io/badge/Contributions-Welcome-yellow)](https://github.com/NaagAlgates/2048)
[![](https://img.shields.io/badge/Maintained-Yes-blue)](https://github.com/NaagAlgates/2048)



# 2048

Famous 2048 game made in Flutter
Famous 2048 game made in Flutter. This code was originally written by [anuranBarman](https://github.com/anuranBarman/2048) three years ago.

Since there was no activity for this amazing repo, I, [Nagaraj Alagusundaram](https://www.nagaraj.com.au) wished to resolve all the issue that was raised. Along with that I have also

* Upgraded the code to [Flutter 2.0](https://dart.dev/dart-2)
* Migrated the code to [Sound Null Safety](https://dart.dev/null-safety/migration-guide)
* Added [Coveralls](https://coveralls.io/) test coverage
* Followed strict Lint rules. Thanks to [very_good_analysis](https://github.com/VeryGoodOpenSource/very_good_analysis/blob/main/README.md)
* Added [GitHub Action](https://github.com/features/actions). Thanks to [subosito](https://github.com/subosito/flutter-action)
* Added [flutter_bloc](https://github.com/felangel/bloc/tree/master/packages/flutter_bloc) as state management. Thanks to [Felix](https://github.com/felangel)
* Used dart [collections](https://pub.dev/packages/collection) where ever possible

## Features

1. Store High Score
2. Colorful Grid
3. Cute Font
4. State management
5. Flutter tests
6. GitHub Actions
7. 0 errors 0 warnings
8. Minimal Animations
9. Null Safe
10. Flutter 2.0

## TODO

1. Sliding Grid Animation (Contributions are welcome)

## Screenshot

![2048](https://github.com/anuranBarman/2048/blob/master/2048.png "2048 Game")
<img src="https://github.com/NaagAlgates/2048/blob/fdbab0d5534f316f360a88e4b3a6ee5b30308e17/screenshot/game_won.png" width="30%"><img src="https://github.com/NaagAlgates/2048/blob/fdbab0d5534f316f360a88e4b3a6ee5b30308e17/screenshot/game_play.gif" width="30%"><img src="https://github.com/NaagAlgates/2048/blob/fdbab0d5534f316f360a88e4b3a6ee5b30308e17/screenshot/game_lost.png" width="30%">
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:very_good_analysis/analysis_options.2.3.0.yaml
19 changes: 11 additions & 8 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
*.iml
*.class
.gradle
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
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
39 changes: 28 additions & 11 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,43 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 27
compileSdkVersion 30

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

lintOptions {
disable 'InvalidPackage'
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.twozerofoureight"
applicationId "com.example.flutter_application_1"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
Expand All @@ -45,7 +64,5 @@ flutter {
}

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
7 changes: 7 additions & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_application_1">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
50 changes: 26 additions & 24 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.twozerofoureight">

<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="two_zero_four_eight"
package="com.example.flutter_application_1">
<application
android:label="flutter_application_1"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
Loading