Skip to content

Commit 924735f

Browse files
author
Christoph Bühler
committed
chore: previous code
1 parent 54418e6 commit 924735f

File tree

160 files changed

+5988
-57
lines changed

Some content is hidden

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

160 files changed

+5988
-57
lines changed

.gitignore

Lines changed: 69 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,77 @@
1-
# See https://www.dartlang.org/guides/libraries/private-files
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/
222

3-
# Files and directories created by pub
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
425
.dart_tool/
26+
.flutter-plugins
27+
.flutter-plugins-dependencies
528
.packages
29+
.pub-cache/
30+
.pub/
631
build/
7-
832
pubspec.lock
933

10-
# Generated Dart Files
11-
*.g.dart
34+
# Android related
35+
**/android/**/gradle-wrapper.jar
36+
**/android/.gradle
37+
**/android/captures/
38+
**/android/gradlew
39+
**/android/gradlew.bat
40+
**/android/local.properties
41+
**/android/**/GeneratedPluginRegistrant.java
1242

13-
# Directory created by dartdoc
14-
# If you don't generate documentation locally you can remove this line.
15-
doc/api/
43+
# iOS/XCode related
44+
**/ios/**/*.mode1v3
45+
**/ios/**/*.mode2v3
46+
**/ios/**/*.moved-aside
47+
**/ios/**/*.pbxuser
48+
**/ios/**/*.perspectivev3
49+
**/ios/**/*sync/
50+
**/ios/**/.sconsign.dblite
51+
**/ios/**/.tags*
52+
**/ios/**/.vagrant/
53+
**/ios/**/DerivedData/
54+
**/ios/**/Icon?
55+
**/ios/**/Pods/
56+
**/ios/**/.symlinks/
57+
**/ios/**/profile
58+
**/ios/**/xcuserdata
59+
**/ios/.generated/
60+
**/ios/Flutter/App.framework
61+
**/ios/Flutter/Flutter.framework
62+
**/ios/Flutter/Flutter.podspec
63+
**/ios/Flutter/Generated.xcconfig
64+
**/ios/Flutter/app.flx
65+
**/ios/Flutter/app.zip
66+
**/ios/Flutter/flutter_assets/
67+
**/ios/Flutter/flutter_export_environment.sh
68+
**/ios/ServiceDefinitions.json
69+
**/ios/Runner/GeneratedPluginRegistrant.*
1670

17-
# Avoid committing generated Javascript files:
18-
*.dart.js
19-
*.info.json # Produced by the --dump-info flag.
20-
*.js # When generated by dart2js. Don't specify *.js if your
21-
# project includes source files written in JavaScript.
22-
*.js_
23-
*.js.deps
24-
*.js.map
25-
26-
# OS Files
27-
.DS_Store
28-
Thumbs.db
29-
30-
# IDEs
31-
.idea/
32-
*.iml
33-
.vscode/
34-
.vs/
71+
# Exceptions to above rules.
72+
!**/ios/**/default.mode1v3
73+
!**/ios/**/default.mode2v3
74+
!**/ios/**/default.pbxuser
75+
!**/ios/**/default.perspectivev3
76+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
77+
pubspec.lock

.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: f139b11009aeb8ed2a3a3aa8b0066e482709dde3
8+
channel: stable
9+
10+
project_type: package

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
## 0.2.3
2+
- Completes the revert to the `HookViewModelWidget` to remove breaking changes
3+
- Reverts breaking change and instead deprecates the `HookViewModelWidget`
4+
- Replaced HookViewModelWidget with StackedHookView
5+
- Updated example app
6+
- Updated README
7+
- HookViewModelWidget -> StackedHookView
8+
9+
## 0.2.2
10+
11+
- Updated flutter_hooks to 0.18.2+1
12+
13+
## 0.2.1+2
14+
15+
- Updates Example's kotlin version to 1.4.10
16+
- Updates Example's Android Embedding to Version 2
17+
18+
## 0.2.1+1
19+
20+
- Upgraded the dependency on `provider` to 6.0.0
21+
22+
## 0.2.1
23+
24+
- `flutter_hooks`: ^0.16.0 -> ^0.17.0
25+
26+
## 0.1.4
27+
28+
- `flutter_hooks`: ^0.15.0 -> ^0.16.0
29+
- `provider`: ^4.3.1 -> ^5.0.0
30+
31+
## 0.1.3+2
32+
33+
- Update flutter_hooks 0.15.0
34+
35+
## 0.1.3+1
36+
37+
- Update flutter_hooks
38+
39+
## 0.1.3
40+
41+
- Update flutter_hooks and provider
42+
43+
## 0.1.2
44+
45+
- Hook widget has a const constructor
46+
47+
## 0.1.1+3
48+
49+
- Changelog style updates
50+
51+
## 0.1.1+2
52+
53+
- Added key to HookViewModelWidget constructor
54+
55+
## 0.1.1+1
56+
57+
- Updates webpage for package
58+
59+
## 0.1.1
60+
61+
- Export Hooks file
62+
63+
## 0.1.0
64+
65+
- Adds HookViewModelWidget

README.md

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,51 @@
1-
# New Package for Stacked
2-
3-
Created from the `package-template`.
4-
5-
After creating the repository, proceed with the following instructions:
6-
7-
- Update the repository settings to adhere to the conventions:
8-
- General:
9-
- No Wikis
10-
- No Issues
11-
- No Sponsorships
12-
- Preserve this repository
13-
- No Discussions
14-
- No Projects
15-
- Don't allow merge commits
16-
- Allow squash merging with default commit message set to "Default to pull request title and commit details"
17-
- Don't allow rebase merging
18-
- Always suggest updating pull requests
19-
- Allow auto-merge
20-
- Automatically delete head branches
21-
- Branch protection rule (`main`):
22-
- Require a pull request before merging
23-
- Dismiss stale pull request approvals when new commits are pushed
24-
- Allow specified actors to bypass required pull requests -> `Dane Mackier` (or whoever is the current owner of the personal access token in the organization secrets `REPO_DEPLOYMENT_TOKEN`)
25-
- Require status checks to pass before merging
26-
- Require branches to be up to date before merging
27-
- Add status check `Linting and Testing` (to select this, the workflow must have been run at least once. This can be done manually since the workflow has "workflow_dispatch" as a trigger)
28-
- Require conversation resolution before merging
29-
- Require linear history
30-
- Create the flutter package with `flutter create -t package --project-name NAME .`
31-
- Update the content in the `README` file.
1+
# Stacked Hooks
2+
3+
This package contains widgets that allow you to use the Flutter Hooks package with the `StackedView` in the Stacked architecture.
4+
5+
## StackedHookView
6+
7+
The `StackedView` is an implementation of a widget class that returns a value provided by `Provider` as a parameter in the build function of the widget. This allows for easier consumption and use of ViewModel without boilerplate. The `StackedHookView` allows you to use this widget and make use of Flutter Hooks inside the build function. This is very useful when you want to use `TextEditing` controllers and you're implementing this architecture.
8+
9+
```dart
10+
// View that creates and provides the viewmodel
11+
class StackedHookViewExample extends StackedView<HomeViewModel> {
12+
const StackedHookViewExample({Key key}) : super(key: key);
13+
14+
@override
15+
Widget builder(BuildContext context, HomeViewModel model, Widget? child) {
16+
return Scaffold(
17+
body: Center(child: _HookForm()),
18+
);
19+
}
20+
21+
@override
22+
HomeViewModel modelBuilder(BuildContext context) {
23+
return HomeViewModel();
24+
}
25+
}
26+
27+
// Form that makes use of the ViewModel provided above but also makes use of hooks
28+
class _HookForm extends StackedHookView<HomeViewModel> {
29+
@override
30+
Widget buildStackedView(BuildContext context, HomeViewModel model) {
31+
final title = useTextEditingController();
32+
return Column(
33+
mainAxisSize: MainAxisSize.min,
34+
children: <Widget>[
35+
Text(model.title),
36+
TextField(controller: title, onChanged: model.updateTitle),
37+
],
38+
);
39+
}
40+
}
41+
42+
// ViewModel
43+
class HomeViewModel extends BaseViewModel {
44+
String title = 'default';
45+
46+
void updateTitle(String value) {
47+
title = value;
48+
notifyListeners();
49+
}
50+
}
51+
```

analysis_options.yaml

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

example/.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
.packages
31+
.pub-cache/
32+
.pub/
33+
/build/
34+
35+
# Symbolication related
36+
app.*.symbols
37+
38+
# Obfuscation related
39+
app.*.map.json
40+
41+
# Android Studio will place build artifacts here
42+
/android/app/debug
43+
/android/app/profile
44+
/android/app/release

example/.metadata

Lines changed: 45 additions & 0 deletions
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.
5+
6+
version:
7+
revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
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: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
17+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
18+
- platform: android
19+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
20+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
21+
- platform: ios
22+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
23+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
24+
- platform: linux
25+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
26+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
27+
- platform: macos
28+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
29+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
30+
- platform: web
31+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
32+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
33+
- platform: windows
34+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
35+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
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'

0 commit comments

Comments
 (0)