Skip to content

Commit eb478fd

Browse files
committed
feat: initial structure
0 parents  commit eb478fd

File tree

107 files changed

+3116
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3116
-0
lines changed

.gitattributes

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Always perform LF normalization on these files
5+
*.dart text
6+
*.gradle text
7+
*.html text
8+
*.java text
9+
*.json text
10+
*.md text
11+
*.py text
12+
*.sh text
13+
*.txt text
14+
*.xml text
15+
*.yaml text
16+
17+
# Make sure that these Windows files always have CRLF line endings in checkout
18+
*.bat text eol=crlf
19+
*.ps1 text eol=crlf
20+
*.rc text eol=crlf
21+
*.sln text eol=crlf
22+
*.props text eol=crlf
23+
*.vcxproj text eol=crlf
24+
*.vcxproj.filters text eol=crlf
25+
# Including templatized versions.
26+
*.sln.tmpl text eol=crlf
27+
*.props.tmpl text eol=crlf
28+
*.vcxproj.tmpl text eol=crlf
29+
30+
# Never perform LF normalization on these files
31+
*.ico binary
32+
*.jar binary
33+
*.png binary
34+
*.zip binary

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Automates the process of testing, analyzing, checking the code format,
2+
# building, and deploying using Github Actions.
3+
name: Flutter CI
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the main branch
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
runs-on: ubuntu-latest
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v2
27+
# Java environment.
28+
- uses: actions/setup-java@v1
29+
with:
30+
java-version: '12.x'
31+
# Setup the flutter environment.
32+
- uses: subosito/flutter-action@v1
33+
with:
34+
channel: 'stable'
35+
36+
# Get flutter dependencies.
37+
- run: flutter pub get
38+
39+
# Check for any formatting issues in the code.
40+
- run: flutter format --set-exit-if-changed lib/ test/
41+
42+
# Statically analyze the Dart code for any errors.
43+
- run: flutter analyze --no-current-package lib/ test/
44+
45+
# Run widget tests for our flutter project.
46+
- run: flutter test --no-pub --coverage
47+
48+
- name: Upload coverage to Codecov
49+
uses: codecov/codecov-action@v1
50+
with:
51+
token: ${{ secrets.CODECOV_TOKEN }}
52+
file: ./coverage/lcov.info

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
**/ios/Flutter/.last_build_id
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
43+
# Android Studio will place build artifacts here
44+
/android/app/debug
45+
/android/app/profile
46+
/android/app/release

.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
8+
channel: stable
9+
10+
project_type: app

.rultor.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
docker:
2+
image: cirrusci/flutter:stable
3+
as_root: true
4+
architect:
5+
- rafamizes
6+
assets:
7+
credentials.json: rafamizes/secret#assets/publishing/flutter/credentials.json
8+
merge:
9+
rebase: true
10+
script: |
11+
flutter clean
12+
flutter pub get
13+
flutter format --set-exit-if-changed lib/ test/
14+
flutter analyze --no-current-package lib/ test/
15+
flutter test --no-pub --coverage
16+
bash <(curl -s https://codecov.io/bash)
17+
flutter pub publish --dry-run
18+
release:
19+
# updates pubspec.yaml's version attribute to $tag;
20+
# in CHANGELOG, places section '[$tag] - YYYY-mm-dd' under [Unreleaded];
21+
# commits the $tag version and publishes to pub.dev;
22+
# Rultor tags the lastest commit as $tag and push the new tag to the
23+
# repository.
24+
script: |-
25+
sed -i "s/^\(version:\).*/\1 $tag/" pubspec.yaml
26+
sed -i "/\[Unreleased\]/a\\\n## [$tag] - $(date '+%F')" CHANGELOG.md
27+
mkdir -p ~/.pub-cache
28+
mv ../credentials.json ~/.pub-cache/credentials.json
29+
flutter pub publish -f
30+
git commit -am "version $tag"
31+
git checkout master
32+
git merge __rultor
33+
git checkout __rultor

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Dart Package Versioning](https://dart.dev/tools/pub/versioning).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Initial structure
13+
- set lint 1.8.2 as the linting package.
14+
- set linting rules.
15+
- scaffold code of MainPage, NewsPage, NotesPage, SettingsPage.
16+
- README
17+
- CHANGELOG
18+
- .rultor.yml file for configuring the DevOps assistant [Rultor](https://doc.rultor.com/).
19+
- build.yml file in .github/workflow to set up [GitHub Actions CI/CD](https://github.com/features/actions).
20+
21+
## [0.0.1] - 2022-01-09

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# state_man_examples
2+
3+
[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4+
[![DevOps By Rultor.com](https://www.rultor.com/b/dartoos-dev/state_man_examples)](https://www.rultor.com/p/dartoos-dev/state_man_examples)
5+
6+
[![pub](https://img.shields.io/pub/v/state_man_examples)](https://pub.dev/packages/state_man_examples)
7+
[![license](https://img.shields.io/badge/license-mit-green.svg)](https://github.com/dartoos-dev/state_man_examples/blob/master/LICENSE)
8+
[![build](https://github.com/dartoos-dev/state_man_examples/actions/workflows/build.yml/badge.svg)](https://github.com/dartoos-dev/state_man_examples/actions/)
9+
[![codecov](https://codecov.io/gh/dartoos-dev/state_man_examples/branch/master/graph/badge.svg?token=jYfO55O22s)](https://codecov.io/gh/dartoos-dev/state_man_examples)
10+
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/rafamizes/state_man_examples)](https://www.codefactor.io/repository/github/rafamizes/state_man_examples)
11+
[![style: lint](https://img.shields.io/badge/style-lint-4BC0F5.svg)](https://pub.dev/packages/lint)
12+
[![Hits-of-Code](https://hitsofcode.com/github/dartoos-dev/state_man_examples?branch=master)](https://hitsofcode.com/github/dartoos-dev/state_man_examples/view?branch=master)
13+
14+
## Overview
15+
16+
State Management Examples
17+
18+
Simple application with several state managements approaches.
19+
20+
This project is heavily inspired by the Bachelor's thesis of [Dmitrii Slepnev](https://github.com/sdim2016/flutter-state-management)
21+
22+
## Getting Started
23+
24+
The application has 3 features:
25+
26+
- Some pages with bottom navigation; the Settings page allows us to
27+
see the immediate effect of a state change, which affects the entire
28+
application.
29+
- Local persistence.
30+
- Simple remote API calls — GET requests are enough for the showcase.
31+
32+
In this way, the application does not need to solve any real-world problems, it
33+
aims to demonstrate how some state management approaches work from a technical
34+
point of view.
35+
36+
The UI is created once for all apps, as well as the classes from the data access
37+
layer (local persistence, remote API calls). The only thing that will change is
38+
the state management approach.
39+
40+
## References
41+
42+
[State Management in Flutter — Dmitrii Slepnev](https://www.theseus.fi/handle/10024/355086).

analysis_options.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include: package:lint/analysis_options_package.yaml
2+
analyzer:
3+
strong-mode:
4+
# A value of false ensures that the type inference engine never implicitly casts
5+
# from dynamic to a more specific type.
6+
implicit-casts: false
7+
# A value of false ensures that the type inference engine never chooses the
8+
# dynamic type when it can’t determine a static type.
9+
# implicit-dynamic: false
10+
linter:
11+
rules:
12+
# Make constructors the first thing in every class
13+
sort_constructors_first: true
14+
# Good packages document everything
15+
public_member_api_docs: true
16+
# Always await.
17+
# unawaited_futures: true
18+
# It's a good practice to expose the ability to provide a key when creating public widgets.
19+
use_key_in_widget_constructors: true
20+
always_declare_return_types: true
21+
cancel_subscriptions: true
22+
close_sinks: true
23+
only_throw_errors: true
24+
package_api_docs: true

android/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
key.properties
12+
**/*.keystore
13+
**/*.jks

android/app/build.gradle

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
def localProperties = new Properties()
2+
def localPropertiesFile = rootProject.file('local.properties')
3+
if (localPropertiesFile.exists()) {
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
6+
}
7+
}
8+
9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
24+
apply plugin: 'com.android.application'
25+
apply plugin: 'kotlin-android'
26+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27+
28+
android {
29+
compileSdkVersion flutter.compileSdkVersion
30+
31+
compileOptions {
32+
sourceCompatibility JavaVersion.VERSION_1_8
33+
targetCompatibility JavaVersion.VERSION_1_8
34+
}
35+
36+
kotlinOptions {
37+
jvmTarget = '1.8'
38+
}
39+
40+
sourceSets {
41+
main.java.srcDirs += 'src/main/kotlin'
42+
}
43+
44+
defaultConfig {
45+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
46+
applicationId "dev.dartoos.state_man_examples"
47+
minSdkVersion flutter.minSdkVersion
48+
targetSdkVersion flutter.targetSdkVersion
49+
versionCode flutterVersionCode.toInteger()
50+
versionName flutterVersionName
51+
}
52+
53+
buildTypes {
54+
release {
55+
// TODO: Add your own signing config for the release build.
56+
// Signing with the debug keys for now, so `flutter run --release` works.
57+
signingConfig signingConfigs.debug
58+
}
59+
}
60+
}
61+
62+
flutter {
63+
source '../..'
64+
}
65+
66+
dependencies {
67+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
68+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="dev.dartoos.state_man_examples">
3+
<!-- Flutter needs it to communicate with the running application
4+
to allow setting breakpoints, to provide hot reload, etc.
5+
-->
6+
<uses-permission android:name="android.permission.INTERNET"/>
7+
</manifest>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="dev.dartoos.state_man_examples">
3+
<application
4+
android:label="state_man_examples"
5+
android:name="${applicationName}"
6+
android:icon="@mipmap/ic_launcher">
7+
<activity
8+
android:name=".MainActivity"
9+
android:exported="true"
10+
android:launchMode="singleTop"
11+
android:theme="@style/LaunchTheme"
12+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
13+
android:hardwareAccelerated="true"
14+
android:windowSoftInputMode="adjustResize">
15+
<!-- Specifies an Android theme to apply to this Activity as soon as
16+
the Android process has started. This theme is visible to the user
17+
while the Flutter UI initializes. After that, this theme continues
18+
to determine the Window background behind the Flutter UI. -->
19+
<meta-data
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme"
22+
/>
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN"/>
25+
<category android:name="android.intent.category.LAUNCHER"/>
26+
</intent-filter>
27+
</activity>
28+
<!-- Don't delete the meta-data below.
29+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
30+
<meta-data
31+
android:name="flutterEmbedding"
32+
android:value="2" />
33+
</application>
34+
</manifest>

0 commit comments

Comments
 (0)