Skip to content

Commit 3ef671d

Browse files
committed
Initial commit
0 parents  commit 3ef671d

File tree

158 files changed

+7429
-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.

158 files changed

+7429
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
build/

.metadata

+10
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: "41456452f29d64e8deb623a3c927524bcf9f111b"
8+
channel: "stable"
9+
10+
project_type: package

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
* TODO: Describe initial release.

LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MIT

README.md

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
[![pub package](https://img.shields.io/pub/v/june.svg)](https://pub.dartlang.org/packages/june)
2+
3+
4+
5+
# June
6+
[![Discord Server Invite](https://img.shields.io/badge/DISCORD-JOIN%20SERVER-5663F7?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/zXXHvAXCug)
7+
[![Kakao_Talk](https://img.shields.io/badge/KakaoTalk-Join%20Room-FEE500?style=for-the-badge&logo=kakao)](https://open.kakao.com/o/gEwrffbg)
8+
9+
The main reason you need a state management library in Flutter is because managing state changes or sharing states from the outside is difficult with the native Flutter state management. However, many state management libraries deviate from their original purpose and end up containing much more code, attempting to control the app development pattern itself. We need a state management library that stays true to its original purpose without straying too far from the native Flutter state management.
10+
11+
June is a lightweight and modern state management library that focuses on providing a pattern very similar to Flutter's native state management.
12+
13+
## Features
14+
15+
-**Native Flutter State Pattern**: By adopting the native Flutter state management pattern, you can declare variables and manage them with setState, facilitating an easy transition to app-level scalability.
16+
- 🦄 **No Widget Modification Required**: Use MaterialApp, StatelessWidget, and StatefulWidget as is, with no changes needed for enhanced state management.
17+
- 🚀 **No State Initialization**: Simplifies Flutter app development by automatically setting up state management, eliminating manual initialization, and reducing boilerplate. This approach ensures a cleaner, more maintainable codebase and a quicker start to development.
18+
19+
## Usage
20+
1. Declare the states.
21+
```dart
22+
class CounterVM extends JuneState {
23+
int count = 0;
24+
}
25+
```
26+
2. The state management wraps the widget(or page) to be managed with JuneBuilder.(You can place it in multiple locations.)
27+
```dart
28+
JuneBuilder(
29+
() => CounterVM(),
30+
builder: (vm) => Column(
31+
mainAxisAlignment: MainAxisAlignment.center,
32+
children: <Widget>[
33+
Text('${vm.count}'
34+
),
35+
],
36+
),
37+
)
38+
```
39+
40+
3. Update the states using the setState method.
41+
```dart
42+
// You can call state from anywhere.
43+
var state = June.getState(CounterVM());
44+
state.count++;
45+
46+
state.setState();
47+
```
48+
49+
4. That's All!
50+
51+
52+
53+
#### Example
54+
```dart
55+
import 'package:flutter/material.dart';
56+
import 'package:june/june.dart';
57+
58+
void main() => runApp(const MyApp());
59+
60+
class MyApp extends StatelessWidget {
61+
const MyApp({super.key});
62+
63+
@override
64+
Widget build(BuildContext context) {
65+
return MaterialApp(
66+
home: Scaffold(
67+
body: Center(
68+
child: JuneBuilder(
69+
() => CounterVM(),
70+
builder: (vm) => Column(
71+
mainAxisAlignment: MainAxisAlignment.center,
72+
children: <Widget>[
73+
const Text('You have pushed the button this many times:'),
74+
Text(
75+
'${vm.count}',
76+
style: Theme.of(context).textTheme.headlineMedium,
77+
),
78+
],
79+
),
80+
),
81+
),
82+
floatingActionButton: const FloatingActionButton(
83+
onPressed: incrementCounter,
84+
tooltip: 'Increment',
85+
child: Icon(Icons.add),
86+
),
87+
),
88+
);
89+
}
90+
}
91+
92+
void incrementCounter() {
93+
// You can call state from anywhere.
94+
var state = June.getState(CounterVM());
95+
state.count++;
96+
97+
state.setState();
98+
}
99+
100+
class CounterVM extends JuneState {
101+
int count = 0;
102+
}
103+
104+
```
105+
106+
## Advance
107+
### Object State Management
108+
June offers the ability to create multiple instances of declared states as objects. This feature is extremely useful for managing different data in repetitive formats, such as feed content.
109+
110+
Simply add a tag to JuneBuilder and June.getState to utilize this functionality.
111+
112+
#### Example
113+
```dart
114+
import 'package:flutter/material.dart';
115+
import 'package:june/june.dart';
116+
117+
void main() => runApp(const MyApp());
118+
119+
class MyApp extends StatelessWidget {
120+
const MyApp({super.key});
121+
122+
@override
123+
Widget build(BuildContext context) {
124+
return MaterialApp(
125+
home: Scaffold(
126+
body: Center(
127+
child: Column(
128+
mainAxisAlignment: MainAxisAlignment.center,
129+
children: <Widget>[
130+
JuneBuilder(
131+
() => CounterVM(),
132+
builder: (vm) => Column(
133+
children: [
134+
const Text('Basic instance counter'),
135+
Text(
136+
'${vm.count}',
137+
style: Theme.of(context).textTheme.headlineMedium,
138+
),
139+
],
140+
),
141+
),
142+
JuneBuilder(
143+
() => CounterVM(),
144+
tag: "SomeId",
145+
builder: (vm) => Column(
146+
children: [
147+
const Text('Object instance counter created with tags'),
148+
Text(
149+
'${vm.count}',
150+
style: Theme.of(context).textTheme.headlineMedium,
151+
),
152+
],
153+
),
154+
),
155+
],
156+
),
157+
),
158+
floatingActionButton: const Stack(
159+
children: <Widget>[
160+
Positioned(
161+
right: 0,
162+
bottom: 80,
163+
child: FloatingActionButton.extended(
164+
onPressed: increaseBasicInstance, label: Text("Increase basic instance"))),
165+
Positioned(
166+
right: 0,
167+
bottom: 10,
168+
child: FloatingActionButton.extended(
169+
onPressed: increaseObjectInstanceCreatedWithTags, label: Text("Increase object instance created with tags"))),
170+
],
171+
),
172+
),
173+
);
174+
}
175+
}
176+
177+
void increaseBasicInstance() {
178+
var state = June.getState(CounterVM());
179+
state.count++;
180+
state.setState();
181+
}
182+
183+
void increaseObjectInstanceCreatedWithTags() {
184+
var state = June.getState(CounterVM(), tag: "SomeId");
185+
state.count++;
186+
state.setState();
187+
}
188+
189+
class CounterVM extends JuneState {
190+
int count = 0;
191+
}
192+
```
193+
194+
195+
196+
197+
198+
199+
200+
201+

analysis_options.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options

example/.gitignore

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

example/.metadata

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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: "41456452f29d64e8deb623a3c927524bcf9f111b"
8+
channel: "stable"
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
17+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
18+
- platform: android
19+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
20+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
21+
- platform: ios
22+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
23+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
24+
- platform: linux
25+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
26+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
27+
- platform: macos
28+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
29+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
30+
- platform: web
31+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
32+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
33+
- platform: windows
34+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
35+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# example
2+
3+
A new Flutter project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13+
14+
For help getting started with Flutter development, view the
15+
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.

example/analysis_options.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options

0 commit comments

Comments
 (0)