Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ea5c510cb | ||
|
|
bb264b7362 | ||
|
|
17ae855ffb | ||
|
|
b38fea130f | ||
|
|
e3776259df | ||
|
|
371cc33e3a | ||
|
|
3cbc268dea | ||
|
|
99b6a0a335 | ||
|
|
88719576b7 | ||
|
|
d191afad33 | ||
|
|
7e433fc0dd | ||
|
|
27015b63d9 | ||
|
|
703e3deeaf | ||
|
|
b6b42f9366 | ||
|
|
793b304c1d | ||
|
|
9c7ea4adfd | ||
|
|
ae731f5877 | ||
|
|
aa2b51f3da | ||
|
|
27d60c9aa3 |
@@ -3,6 +3,104 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2022-04-20
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`wyatt_crud_bloc` - `v0.0.2`](#wyatt_crud_bloc---v002)
|
||||
- [`wyatt_analysis` - `v2.0.1`](#wyatt_analysis---v201)
|
||||
|
||||
---
|
||||
|
||||
#### `wyatt_crud_bloc` - `v0.0.2`
|
||||
|
||||
- Migrate crud_package in monorepo
|
||||
|
||||
- **DOCS**: add example app.
|
||||
|
||||
#### `wyatt_analysis` - `v2.0.1`
|
||||
|
||||
- **DOCS**: Update readme with new version.
|
||||
|
||||
|
||||
## 2022-04-20
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`wyatt_authentication_bloc` - `v0.2.0`](#wyatt_authentication_bloc---v020)
|
||||
|
||||
Packages graduated to a stable release (see pre-releases prior to the stable version for changelog entries):
|
||||
|
||||
- `wyatt_authentication_bloc` - `v0.2.0`
|
||||
|
||||
---
|
||||
|
||||
#### `wyatt_authentication_bloc` - `v0.2.0`
|
||||
|
||||
|
||||
## 2022-04-20
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`wyatt_form_bloc` - `v0.0.1`](#wyatt_form_bloc---v001)
|
||||
|
||||
Packages graduated to a stable release (see pre-releases prior to the stable version for changelog entries):
|
||||
|
||||
- `wyatt_form_bloc` - `v0.0.1`
|
||||
|
||||
---
|
||||
|
||||
#### `wyatt_form_bloc` - `v0.0.1`
|
||||
|
||||
|
||||
## 2022-04-20
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`wyatt_form_bloc` - `v0.0.1-dev.0`](#wyatt_form_bloc---v001-dev0)
|
||||
|
||||
---
|
||||
|
||||
#### `wyatt_form_bloc` - `v0.0.1-dev.0`
|
||||
|
||||
- **REFACTOR**: all package structure/documentation.
|
||||
- **FEAT**: new utility package for forms and bloc.
|
||||
- **DOCS**: add example app.
|
||||
- **DOCS**: add few project files.
|
||||
|
||||
|
||||
## 2022-04-19
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt_analysis">
|
||||
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square"" alt="Style: Wyatt Analysis" />
|
||||
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis">
|
||||
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" />
|
||||
</a>
|
||||
<a href="https://github.com/invertase/melos">
|
||||
<img src="https://img.shields.io/badge/Maintained%20with-melos-f700ff.svg?style=flat-square" alt="Maintained with Melos" />
|
||||
@@ -63,22 +63,55 @@ dart pub global activate melos
|
||||
|
||||
Then bootstrap with `melos bs`.
|
||||
|
||||
---
|
||||
### Create a new package
|
||||
|
||||
## Usage
|
||||
Create a new package in `packages/` folder.
|
||||
|
||||
You can add any package of the `packages/` sub directory in your project.
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
wyatt_analysis:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||
ref: wyatt_analysis-v2.0.0
|
||||
path: packages/wyatt_analysis
|
||||
```shell
|
||||
dart create -t package-simple wyatt_<name>
|
||||
```
|
||||
|
||||
Here you can change `package name` and `package version`.
|
||||
Remove any `example/` subfolder. Then create a new sample project.
|
||||
|
||||
```shell
|
||||
flutter create --platforms android --project-name <name>_example example
|
||||
```
|
||||
|
||||
Then bootstrap project with `melos bs` command.
|
||||
|
||||
### Convention
|
||||
|
||||
#### Naming
|
||||
|
||||
In the previous instructions `<name>` variable is important.
|
||||
It have to be clear and intelligible.
|
||||
|
||||
You **MUST** use underscores.
|
||||
|
||||
You **MUST** use `wyatt` prefix for package.
|
||||
|
||||
You **MUST** name example with specific name.
|
||||
|
||||
For example, if name is CRUD BLOC
|
||||
- name will be crud_bloc
|
||||
- so the package will be: `wyatt_crud_bloc`
|
||||
- and the example will be: `crud_bloc_example`
|
||||
|
||||
#### Commits
|
||||
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
tl;dr : `type(scope): description` where type can be **feat, fix, docs, chores, ci, perf, refactor, style, test**, and scope is package name.
|
||||
|
||||
examples:
|
||||
|
||||
- `feat(auth): add AWS support.` = add a feature in authentication_bloc package.
|
||||
- `docs: update readme.` = update **this** readme file.
|
||||
- `fix(crud)!: fix bug in awesome() function.` = fix a bug, `!` is important and indicate `BREAKING CHANGES`.
|
||||
|
||||
Conventional commits are important for `melos version` command !
|
||||
|
||||
#### Badging
|
||||
|
||||
In the package `readme.md` file, please specify the supported SDK:
|
||||
|
||||
@@ -97,6 +130,23 @@ or
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
You can add any package of the `packages/` sub directory in your project.
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
wyatt_analysis:
|
||||
git:
|
||||
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
|
||||
ref: wyatt_analysis-v2.0.0
|
||||
path: packages/wyatt_analysis
|
||||
```
|
||||
|
||||
Here you can change `package name` and `package version`.
|
||||
|
||||
---
|
||||
|
||||
## Status
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2022 WYATT GROUP
|
||||
* Please see the AUTHORS file for details.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
{
|
||||
"recommendations": [
|
||||
"psioniq.psi-header",
|
||||
"blaugold.melos-code"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"psi-header.changes-tracking": {
|
||||
"isActive": true
|
||||
},
|
||||
"psi-header.config": {
|
||||
"blankLinesAfter": 1,
|
||||
"forceToTop": true
|
||||
},
|
||||
"psi-header.lang-config": [
|
||||
{
|
||||
"beforeHeader": [
|
||||
"# -*- coding:utf-8 -*-",
|
||||
"#!/usr/bin/env python3"
|
||||
],
|
||||
"begin": "###",
|
||||
"end": "###",
|
||||
"language": "python",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"beforeHeader": [
|
||||
"#!/usr/bin/env sh",
|
||||
""
|
||||
],
|
||||
"language": "shellscript",
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "dart",
|
||||
"prefix": "// "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "yaml",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "<!--",
|
||||
"end": "-->",
|
||||
"language": "markdown",
|
||||
},
|
||||
],
|
||||
"psi-header.templates": [
|
||||
{
|
||||
"language": "*",
|
||||
"template": [
|
||||
"Copyright (C) <<year>> WYATT GROUP",
|
||||
"Please see the AUTHORS file for details.",
|
||||
"",
|
||||
"This program is free software: you can redistribute it and/or modify",
|
||||
"it under the terms of the GNU General Public License as published by",
|
||||
"the Free Software Foundation, either version 3 of the License, or",
|
||||
"any later version.",
|
||||
"",
|
||||
"This program is distributed in the hope that it will be useful,",
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"GNU General Public License for more details.",
|
||||
"",
|
||||
"You should have received a copy of the GNU General Public License",
|
||||
"along with this program. If not, see <https://www.gnu.org/licenses/>."
|
||||
],
|
||||
}
|
||||
],
|
||||
"dart.runPubGetOnPubspecChanges": false,
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
## 2.0.1
|
||||
|
||||
- **DOCS**: Update readme with new version.
|
||||
|
||||
## 2.0.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: wyatt_analysis
|
||||
description: Lint rules for Dart and Flutter used internally at Wyatt and Wyatt Studio.
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis
|
||||
version: 2.0.0
|
||||
version: 2.0.1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2022 WYATT GROUP
|
||||
* Please see the AUTHORS file for details.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
{
|
||||
"recommendations": [
|
||||
"psioniq.psi-header",
|
||||
"blaugold.melos-code"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"psi-header.changes-tracking": {
|
||||
"isActive": true
|
||||
},
|
||||
"psi-header.config": {
|
||||
"blankLinesAfter": 1,
|
||||
"forceToTop": true
|
||||
},
|
||||
"psi-header.lang-config": [
|
||||
{
|
||||
"beforeHeader": [
|
||||
"# -*- coding:utf-8 -*-",
|
||||
"#!/usr/bin/env python3"
|
||||
],
|
||||
"begin": "###",
|
||||
"end": "###",
|
||||
"language": "python",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"beforeHeader": [
|
||||
"#!/usr/bin/env sh",
|
||||
""
|
||||
],
|
||||
"language": "shellscript",
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "dart",
|
||||
"prefix": "// "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "yaml",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "<!--",
|
||||
"end": "-->",
|
||||
"language": "markdown",
|
||||
},
|
||||
],
|
||||
"psi-header.templates": [
|
||||
{
|
||||
"language": "*",
|
||||
"template": [
|
||||
"Copyright (C) <<year>> WYATT GROUP",
|
||||
"Please see the AUTHORS file for details.",
|
||||
"",
|
||||
"This program is free software: you can redistribute it and/or modify",
|
||||
"it under the terms of the GNU General Public License as published by",
|
||||
"the Free Software Foundation, either version 3 of the License, or",
|
||||
"any later version.",
|
||||
"",
|
||||
"This program is distributed in the hope that it will be useful,",
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"GNU General Public License for more details.",
|
||||
"",
|
||||
"You should have received a copy of the GNU General Public License",
|
||||
"along with this program. If not, see <https://www.gnu.org/licenses/>."
|
||||
],
|
||||
}
|
||||
],
|
||||
"dart.runPubGetOnPubspecChanges": false,
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
## 0.2.0
|
||||
|
||||
- Graduate package to a stable release. See pre-releases prior to this version for changelog entries.
|
||||
|
||||
## 0.2.0-dev.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -18,7 +18,12 @@
|
||||
|
||||
# Flutter - Authentication BLoC
|
||||
|
||||
[](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt_analysis)
|
||||
<p align="left">
|
||||
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis">
|
||||
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" />
|
||||
</a>
|
||||
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
|
||||
</p>
|
||||
|
||||
Authentication Bloc for Flutter.
|
||||
|
||||
@@ -40,15 +45,10 @@ Authentication Bloc for Flutter.
|
||||
* Start/Stop listening on demand
|
||||
- `start()` to listen to user changes
|
||||
- `stop()` to cancel listener
|
||||
- Form
|
||||
* FormInput: validation of one input
|
||||
* Form: validation of all form inputs
|
||||
* FormEntry: contains data of one input
|
||||
* FormData: contains all entries
|
||||
- SignUpCubit
|
||||
* Handles email/password validation and password confirmation
|
||||
* Handles register with email/password
|
||||
* Handles custom form fields
|
||||
* Handles custom form fields thanks `wyatt_form_bloc`
|
||||
- Use `entries` to pass a `FormData` object
|
||||
- You can use several pre configured `FormInput` for validation
|
||||
- You can use `updateFormData()` to change FormData and validators during runtime (intersection, union, difference or replace)
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
include: package:wyatt_analysis/analysis_options.flutter.1.1.1.yaml
|
||||
|
||||
linter:
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
include: package:wyatt_analysis/analysis_options.flutter.yaml
|
||||
@@ -44,3 +44,5 @@ app.*.map.json
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
lib/firebase_options.dart
|
||||
@@ -4,7 +4,7 @@
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
|
||||
revision: 5464c5bac742001448fe4fc0597be939379f88ea
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# example
|
||||
# authentication_bloc_example
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ if (flutterVersionName == null) {
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
// START: FlutterFire Configuration
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
// END: FlutterFire Configuration
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
@@ -43,7 +46,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.example"
|
||||
applicationId "com.example.authentication_bloc_example"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "136771801992",
|
||||
"firebase_url": "https://tchat-beta.firebaseio.com",
|
||||
"project_id": "tchat-beta",
|
||||
"storage_bucket": "tchat-beta.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:136771801992:android:4ff419f07afdad6097203d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.authentication_bloc_example"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.example.example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:136771801992:android:d20e0361057e815197203d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.example"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-n2pq8oqutvrqj58e05hbavvc7n1jdfjb.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.example.example",
|
||||
"certificate_hash": "5d8790309e13b68c35e5d4d8437c35c6d15e6131"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-pj9s88ao7d99pnp4ace75nj1abtmoq7e.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.example.example",
|
||||
"certificate_hash": "bc8faf31c0b0085dc358b2319684e10c93f42719"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.example.example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.example">
|
||||
package="com.example.authentication_bloc_example">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.example">
|
||||
package="com.example.authentication_bloc_example">
|
||||
<application
|
||||
android:label="example"
|
||||
android:label="authentication_bloc_example"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.example.authentication_bloc_example
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.example">
|
||||
package="com.example.authentication_bloc_example">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
|
||||
@@ -7,6 +7,9 @@ buildscript {
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
// START: FlutterFire Configuration
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
// END: FlutterFire Configuration
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
@@ -1,2 +0,0 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
@@ -1,41 +0,0 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
platform :ios, '10.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
||||
@@ -1,97 +0,0 @@
|
||||
PODS:
|
||||
- Firebase/Auth (8.10.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseAuth (~> 8.10.0)
|
||||
- Firebase/CoreOnly (8.10.0):
|
||||
- FirebaseCore (= 8.10.0)
|
||||
- firebase_auth (3.3.5):
|
||||
- Firebase/Auth (= 8.10.0)
|
||||
- firebase_core
|
||||
- Flutter
|
||||
- firebase_core (1.11.0):
|
||||
- Firebase/CoreOnly (= 8.10.0)
|
||||
- Flutter
|
||||
- FirebaseAuth (8.10.0):
|
||||
- FirebaseCore (~> 8.0)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.6)
|
||||
- GoogleUtilities/Environment (~> 7.6)
|
||||
- GTMSessionFetcher/Core (~> 1.5)
|
||||
- FirebaseCore (8.10.0):
|
||||
- FirebaseCoreDiagnostics (~> 8.0)
|
||||
- GoogleUtilities/Environment (~> 7.6)
|
||||
- GoogleUtilities/Logger (~> 7.6)
|
||||
- FirebaseCoreDiagnostics (8.10.0):
|
||||
- GoogleDataTransport (~> 9.1)
|
||||
- GoogleUtilities/Environment (~> 7.6)
|
||||
- GoogleUtilities/Logger (~> 7.6)
|
||||
- nanopb (~> 2.30908.0)
|
||||
- Flutter (1.0.0)
|
||||
- GoogleDataTransport (9.1.2):
|
||||
- GoogleUtilities/Environment (~> 7.2)
|
||||
- nanopb (~> 2.30908.0)
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/AppDelegateSwizzler (7.7.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Network
|
||||
- GoogleUtilities/Environment (7.7.0):
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/Logger (7.7.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Network (7.7.0):
|
||||
- GoogleUtilities/Logger
|
||||
- "GoogleUtilities/NSData+zlib"
|
||||
- GoogleUtilities/Reachability
|
||||
- "GoogleUtilities/NSData+zlib (7.7.0)"
|
||||
- GoogleUtilities/Reachability (7.7.0):
|
||||
- GoogleUtilities/Logger
|
||||
- GTMSessionFetcher/Core (1.7.0)
|
||||
- nanopb (2.30908.0):
|
||||
- nanopb/decode (= 2.30908.0)
|
||||
- nanopb/encode (= 2.30908.0)
|
||||
- nanopb/decode (2.30908.0)
|
||||
- nanopb/encode (2.30908.0)
|
||||
- PromisesObjC (2.0.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
|
||||
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Firebase
|
||||
- FirebaseAuth
|
||||
- FirebaseCore
|
||||
- FirebaseCoreDiagnostics
|
||||
- GoogleDataTransport
|
||||
- GoogleUtilities
|
||||
- GTMSessionFetcher
|
||||
- nanopb
|
||||
- PromisesObjC
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
firebase_auth:
|
||||
:path: ".symlinks/plugins/firebase_auth/ios"
|
||||
firebase_core:
|
||||
:path: ".symlinks/plugins/firebase_core/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Firebase: 44213362f1dcc52555b935dc925ed35ac55f1b20
|
||||
firebase_auth: 9d959bddc3b255ddfb67cf630a5bbb6186964356
|
||||
firebase_core: 2ca2d6cc8a11693e701b37126afae4800be5dbac
|
||||
FirebaseAuth: 59a2d2b933b5b79e18fb1e6ad230c6abdaa73d26
|
||||
FirebaseCore: 04186597c095da37d90ff9fd3e53bc61a1ff2440
|
||||
FirebaseCoreDiagnostics: 56fb7216d87e0e6ec2feddefa9d8a392fe8b2c18
|
||||
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
|
||||
GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940
|
||||
GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
|
||||
GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91
|
||||
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
|
||||
PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58
|
||||
|
||||
PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
@@ -14,14 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
import 'package:authentication_bloc_example/home/home_page.dart';
|
||||
import 'package:authentication_bloc_example/login/login_page.dart';
|
||||
import 'package:authentication_bloc_example/model.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:example/home/home_page.dart';
|
||||
import 'package:example/login/login_page.dart';
|
||||
import 'package:example/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class App extends StatelessWidget {
|
||||
const App({Key? key}) : super(key: key);
|
||||
@@ -31,7 +32,8 @@ class App extends StatelessWidget {
|
||||
FormEntry(formFieldName, Name.pure()),
|
||||
FormEntry(formFieldPhone, Phone.pure()),
|
||||
FormEntry(formFieldPro, Boolean.pure()),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(), export: false),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(),
|
||||
export: false),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -42,7 +44,8 @@ class App extends StatelessWidget {
|
||||
FormEntry(formFieldPro, Boolean.pure()),
|
||||
FormEntry(formFieldSiren, Siren.pure()),
|
||||
FormEntry(formFieldIban, Iban.pure()),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(), export: false),
|
||||
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(),
|
||||
export: false),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
// File generated by FlutterFire CLI.
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||
import 'package:flutter/foundation.dart'
|
||||
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||
|
||||
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// import 'firebase_options.dart';
|
||||
/// // ...
|
||||
/// await Firebase.initializeApp(
|
||||
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||
/// );
|
||||
/// ```
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (kIsWeb) {
|
||||
return web;
|
||||
}
|
||||
// ignore: missing_enum_constant_in_switch
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return android;
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
case TargetPlatform.macOS:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for macos - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
}
|
||||
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
|
||||
static const FirebaseOptions web = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCxdDUpkpW7onOicIcIDcIVvPC8ll1twCQ',
|
||||
appId: '1:136771801992:web:e757595ae62e646297203d',
|
||||
messagingSenderId: '136771801992',
|
||||
projectId: 'tchat-beta',
|
||||
authDomain: 'tchat-beta.firebaseapp.com',
|
||||
databaseURL: 'https://tchat-beta.firebaseio.com',
|
||||
storageBucket: 'tchat-beta.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk',
|
||||
appId: '1:136771801992:android:d20e0361057e815197203d',
|
||||
messagingSenderId: '136771801992',
|
||||
projectId: 'tchat-beta',
|
||||
databaseURL: 'https://tchat-beta.firebaseio.com',
|
||||
storageBucket: 'tchat-beta.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCDbbhjbFrQwLXuIANdJzjkDk8uOETnn7w',
|
||||
appId: '1:136771801992:ios:6fe69c0bea08b7b397203d',
|
||||
messagingSenderId: '136771801992',
|
||||
projectId: 'tchat-beta',
|
||||
databaseURL: 'https://tchat-beta.firebaseio.com',
|
||||
storageBucket: 'tchat-beta.appspot.com',
|
||||
iosClientId:
|
||||
'136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.example.example',
|
||||
);
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/forgot_password/widgets/forgot_password_form.dart';
|
||||
import 'package:authentication_bloc_example/forgot_password/widgets/forgot_password_form.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class _EmailInput extends StatelessWidget {
|
||||
@override
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/home/widgets/infos.dart';
|
||||
import 'package:authentication_bloc_example/home/widgets/infos.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import 'package:example/home/widgets/email_verification.dart';
|
||||
import 'package:authentication_bloc_example/home/widgets/email_verification.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/home/widgets/avatar.dart';
|
||||
import 'package:authentication_bloc_example/home/widgets/avatar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
|
||||
class UserInfo extends StatelessWidget {
|
||||
const UserInfo({Key? key}) : super(key: key);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/login/widgets/login_form.dart';
|
||||
import 'package:authentication_bloc_example/login/widgets/login_form.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/app/app.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:example/forgot_password/forgot_password_page.dart';
|
||||
import 'package:example/sign_up/sign_up_page.dart';
|
||||
import 'package:authentication_bloc_example/app/app.dart';
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
import 'package:authentication_bloc_example/forgot_password/forgot_password_page.dart';
|
||||
import 'package:authentication_bloc_example/sign_up/sign_up_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class _EmailInput extends StatelessWidget {
|
||||
@override
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/app/app.dart';
|
||||
import 'package:example/app/bloc_observer.dart';
|
||||
import 'package:example/firebase_options.dart';
|
||||
import 'package:authentication_bloc_example/app/app.dart';
|
||||
import 'package:authentication_bloc_example/app/bloc_observer.dart';
|
||||
import 'package:authentication_bloc_example/firebase_options.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:example/sign_up/widgets/sign_up_form.dart';
|
||||
import 'package:authentication_bloc_example/sign_up/widgets/sign_up_form.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SignUpPage extends StatelessWidget {
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:example/app/app.dart';
|
||||
import 'package:example/constants.dart';
|
||||
import 'package:authentication_bloc_example/app/app.dart';
|
||||
import 'package:authentication_bloc_example/constants.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class _NameInput extends StatelessWidget {
|
||||
@override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: example
|
||||
name: authentication_bloc_example
|
||||
description: A new Flutter project.
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.15.1 <3.0.0"
|
||||
sdk: ">=2.16.2 <3.0.0"
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
@@ -30,15 +30,21 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
firebase_core: ^1.13.1
|
||||
firebase_core: ^1.14.1
|
||||
flutter_bloc: ^8.0.1
|
||||
wyatt_authentication_bloc:
|
||||
path: "../"
|
||||
|
||||
wyatt_form_bloc:
|
||||
git:
|
||||
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
|
||||
ref: wyatt_form_bloc-v0.0.1
|
||||
path: packages/wyatt_form_bloc
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.4
|
||||
cloud_firestore: ^3.1.10
|
||||
cloud_firestore: ^3.1.12
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
@@ -49,7 +55,7 @@ dev_dependencies:
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^1.0.4
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
|
Before Width: | Height: | Size: 917 B |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 20 KiB |
@@ -1,104 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
If you are serving your web app in a path other than the root, change the
|
||||
href value below to reflect the base path you are serving from.
|
||||
|
||||
The path provided below has to start and end with a slash "/" in order for
|
||||
it to work correctly.
|
||||
|
||||
For more details:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="example">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<title>example</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<!-- This script installs service_worker.js to provide PWA functionality to
|
||||
application. For more information, see:
|
||||
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
||||
<script>
|
||||
var serviceWorkerVersion = null;
|
||||
var scriptLoaded = false;
|
||||
function loadMainDartJs() {
|
||||
if (scriptLoaded) {
|
||||
return;
|
||||
}
|
||||
scriptLoaded = true;
|
||||
var scriptTag = document.createElement('script');
|
||||
scriptTag.src = 'main.dart.js';
|
||||
scriptTag.type = 'application/javascript';
|
||||
document.body.append(scriptTag);
|
||||
}
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
// Service workers are supported. Use them.
|
||||
window.addEventListener('load', function () {
|
||||
// Wait for registration to finish before dropping the <script> tag.
|
||||
// Otherwise, the browser will load the script multiple times,
|
||||
// potentially different versions.
|
||||
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
|
||||
navigator.serviceWorker.register(serviceWorkerUrl)
|
||||
.then((reg) => {
|
||||
function waitForActivation(serviceWorker) {
|
||||
serviceWorker.addEventListener('statechange', () => {
|
||||
if (serviceWorker.state == 'activated') {
|
||||
console.log('Installed new service worker.');
|
||||
loadMainDartJs();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!reg.active && (reg.installing || reg.waiting)) {
|
||||
// No active web worker and we have installed or are installing
|
||||
// one for the first time. Simply wait for it to activate.
|
||||
waitForActivation(reg.installing || reg.waiting);
|
||||
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
|
||||
// When the app updates the serviceWorkerVersion changes, so we
|
||||
// need to ask the service worker to update.
|
||||
console.log('New service worker available.');
|
||||
reg.update();
|
||||
waitForActivation(reg.installing);
|
||||
} else {
|
||||
// Existing service worker is still good.
|
||||
console.log('Loading app from service worker.');
|
||||
loadMainDartJs();
|
||||
}
|
||||
});
|
||||
|
||||
// If service worker doesn't succeed in a reasonable amount of time,
|
||||
// fallback to plaint <script> tag.
|
||||
setTimeout(() => {
|
||||
if (!scriptLoaded) {
|
||||
console.warn(
|
||||
'Failed to load app from service worker. Falling back to plain <script> tag.',
|
||||
);
|
||||
loadMainDartJs();
|
||||
}
|
||||
}, 4000);
|
||||
});
|
||||
} else {
|
||||
// Service workers not supported. Just drop the <script> tag.
|
||||
loadMainDartJs();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"name": "example",
|
||||
"short_name": "example",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
"theme_color": "#0175C2",
|
||||
"description": "A new Flutter project.",
|
||||
"orientation": "portrait-primary",
|
||||
"prefer_related_applications": false,
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/Icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -15,9 +15,9 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/authentication/cubit/authentication_cubit.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/user/user_interface.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class AuthenticationBuilder extends StatelessWidget {
|
||||
const AuthenticationBuilder({
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_status.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/exceptions/exceptions_interface.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/repositories/authentication_repository_interface.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart' show FormStatus;
|
||||
|
||||
part 'email_verification_state.dart';
|
||||
|
||||
|
||||
@@ -14,16 +14,5 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'boolean.dart';
|
||||
export 'confirmed_password.dart';
|
||||
export 'email.dart';
|
||||
export 'exceptions/exceptions.dart';
|
||||
export 'iban.dart';
|
||||
export 'name.dart';
|
||||
export 'operations.dart';
|
||||
export 'password.dart';
|
||||
export 'phone.dart';
|
||||
export 'siren.dart';
|
||||
export 'text_string.dart';
|
||||
export 'user/user.dart';
|
||||
export 'validation_error.dart';
|
||||
|
||||
@@ -16,11 +16,9 @@
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_status.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_validator.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/email.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/exceptions/exceptions_interface.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/repositories/authentication_repository_interface.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
part 'password_reset_state.dart';
|
||||
|
||||
@@ -35,7 +33,7 @@ class PasswordResetCubit extends Cubit<PasswordResetState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
email: email,
|
||||
status: FormValidator.validate([email]),
|
||||
status: FormData.validate([email]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,9 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/authentication/cubit/authentication_cubit.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_status.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_validator.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/email.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/exceptions/exceptions_interface.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/password.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/repositories/authentication_repository_interface.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
part 'sign_in_state.dart';
|
||||
|
||||
@@ -42,7 +39,7 @@ class SignInCubit extends Cubit<SignInState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
email: email,
|
||||
status: FormValidator.validate([email, state.password]),
|
||||
status: FormData.validate([email, state.password]),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -52,13 +49,12 @@ class SignInCubit extends Cubit<SignInState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
password: password,
|
||||
status: FormValidator.validate([state.email, password]),
|
||||
status: FormData.validate([state.email, password]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> signInAnonymously() async {
|
||||
// TODO(hpcl): Maybe check this in UI.
|
||||
if (state.status.isSubmissionInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,16 +19,9 @@ import 'dart:async';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/authentication/cubit/authentication_cubit.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_data.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_input.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_status.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/form/form_validator.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/email.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/exceptions/exceptions_interface.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/operations.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/password.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/models/validation_error.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/repositories/authentication_repository_interface.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
part 'sign_up_state.dart';
|
||||
|
||||
@@ -60,7 +53,7 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
email: email,
|
||||
status: FormValidator.validate(inputsToValidate),
|
||||
status: FormData.validate(inputsToValidate),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -77,11 +70,12 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
password: password,
|
||||
status: FormValidator.validate(inputsToValidate),
|
||||
status: FormData.validate(inputsToValidate),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Take from wyatt_form_bloc/wyatt_form_bloc.dart
|
||||
void dataChanged<T>(String field, FormInput dirtyValue) {
|
||||
final _form = state.data.clone();
|
||||
|
||||
@@ -94,13 +88,14 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: _form,
|
||||
status: FormValidator.validate(
|
||||
status: FormData.validate(
|
||||
[state.email, state.password, ..._form.inputs<dynamic>()],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Take from wyatt_form_bloc/wyatt_form_bloc.dart
|
||||
void updateFormData(
|
||||
FormData data, {
|
||||
SetOperation operation = SetOperation.replace,
|
||||
@@ -125,7 +120,7 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: _form,
|
||||
status: FormValidator.validate(
|
||||
status: FormData.validate(
|
||||
[state.email, state.password, ..._form.inputs<dynamic>()],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
export 'authentication/authentication.dart';
|
||||
export 'email_verification/email_verification.dart';
|
||||
export 'form/form.dart';
|
||||
export 'models/models.dart';
|
||||
export 'password_reset/password_reset.dart';
|
||||
export 'repositories/repositories.dart';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: wyatt_authentication_bloc
|
||||
description: Authentication BLoC for Flutter
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_authentication_bloc
|
||||
version: 0.2.0-dev.0
|
||||
version: 0.2.0
|
||||
|
||||
environment:
|
||||
sdk: ">=2.15.1 <3.0.0"
|
||||
@@ -15,6 +15,13 @@ dependencies:
|
||||
equatable: ^2.0.3
|
||||
firebase_auth: ^3.3.14
|
||||
|
||||
wyatt_form_bloc:
|
||||
git:
|
||||
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
|
||||
ref: wyatt_form_bloc-v0.0.1
|
||||
path: packages/wyatt_form_bloc
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
@@ -23,5 +30,5 @@ dev_dependencies:
|
||||
wyatt_analysis:
|
||||
git:
|
||||
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
|
||||
ref: wyatt_analysis-v2.0.0
|
||||
ref: wyatt_analysis-v2.0.1
|
||||
path: packages/wyatt_analysis
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:bloc_test/bloc_test.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
|
||||
class MockAuthenticationRepository extends Mock
|
||||
implements AuthenticationRepositoryInterface {}
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
|
||||
class MockUser extends Mock implements UserInterface {}
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:bloc_test/bloc_test.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class MockAuthenticationRepository extends Mock
|
||||
implements AuthenticationRepositoryInterface {}
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
void main() {
|
||||
const Email email = Email.dirty('email');
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:bloc_test/bloc_test.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class MockAuthenticationRepository extends Mock
|
||||
implements AuthenticationRepositoryInterface {}
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
void main() {
|
||||
const Email email = Email.dirty('email');
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Files and directories created by pub.
|
||||
.dart_tool/
|
||||
.packages
|
||||
|
||||
# Conventional directory for build outputs.
|
||||
build/
|
||||
|
||||
# Omit committing pubspec.lock for library packages; see
|
||||
# https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
pubspec.lock
|
||||
@@ -0,0 +1,9 @@
|
||||
## 0.0.2
|
||||
|
||||
- Migrate crud_package in monorepo
|
||||
|
||||
- **DOCS**: add example app.
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- Initial version.
|
||||
@@ -0,0 +1,39 @@
|
||||
<!--
|
||||
This README describes the package. If you publish this package to pub.dev,
|
||||
this README's contents appear on the landing page for your package.
|
||||
|
||||
For information about how to write a good package README, see the guide for
|
||||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
|
||||
|
||||
For general information about developing packages, see the Dart guide for
|
||||
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
|
||||
and the Flutter guide for
|
||||
[developing packages and plugins](https://flutter.dev/developing-packages).
|
||||
-->
|
||||
|
||||
TODO: Put a short description of the package here that helps potential users
|
||||
know whether this package might be useful for them.
|
||||
|
||||
## Features
|
||||
|
||||
TODO: List what your package can do. Maybe include images, gifs, or videos.
|
||||
|
||||
## Getting started
|
||||
|
||||
TODO: List prerequisites and provide or point to information on how to
|
||||
start using the package.
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Include short and useful examples for package users. Add longer examples
|
||||
to `/example` folder.
|
||||
|
||||
```dart
|
||||
const like = 'sample';
|
||||
```
|
||||
|
||||
## Additional information
|
||||
|
||||
TODO: Tell users more about the package: where to find more information, how to
|
||||
contribute to the package, how to file issues, what response they can expect
|
||||
from the package authors, and more.
|
||||
@@ -0,0 +1 @@
|
||||
include: package:wyatt_analysis/analysis_options.flutter.yaml
|
||||
@@ -0,0 +1,48 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# 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
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# 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
|
||||
|
||||
/lib/firebase_options.dart
|
||||
@@ -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: 5464c5bac742001448fe4fc0597be939379f88ea
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
@@ -0,0 +1,16 @@
|
||||
# crud_bloc_example
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
|
||||
|
||||
For help getting started with Flutter, view our
|
||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
@@ -0,0 +1,29 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at
|
||||
# https://dart-lang.github.io/linter/lints/index.html.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
@@ -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
|
||||
@@ -0,0 +1,71 @@
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
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'
|
||||
// START: FlutterFire Configuration
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
// END: FlutterFire Configuration
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
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.crud_bloc_example"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "136771801992",
|
||||
"firebase_url": "https://tchat-beta.firebaseio.com",
|
||||
"project_id": "tchat-beta",
|
||||
"storage_bucket": "tchat-beta.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:136771801992:android:4ff419f07afdad6097203d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.authentication_bloc_example"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.example.example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:136771801992:android:8482c9b90bc29de697203d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.crud_bloc_example"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.example.example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:136771801992:android:d20e0361057e815197203d",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.example"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-n2pq8oqutvrqj58e05hbavvc7n1jdfjb.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.example.example",
|
||||
"certificate_hash": "5d8790309e13b68c35e5d4d8437c35c6d15e6131"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-pj9s88ao7d99pnp4ace75nj1abtmoq7e.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.example.example",
|
||||
"certificate_hash": "bc8faf31c0b0085dc358b2319684e10c93f42719"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.example.example"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.crud_bloc_example">
|
||||
<!-- 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>
|
||||
@@ -0,0 +1,34 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.crud_bloc_example">
|
||||
<application
|
||||
android:label="crud_bloc_example"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- 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.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<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>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.example
|
||||
package com.example.crud_bloc_example
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
Flutter draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.crud_bloc_example">
|
||||
<!-- 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>
|
||||
@@ -0,0 +1,34 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.6.10'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
// START: FlutterFire Configuration
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
// END: FlutterFire Configuration
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
@@ -0,0 +1,6 @@
|
||||
#Fri Jun 23 08:50:38 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
||||
@@ -0,0 +1,11 @@
|
||||
include ':app'
|
||||
|
||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||
def properties = new Properties()
|
||||
|
||||
assert localPropertiesFile.exists()
|
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:crud_bloc_example/models.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart';
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _userRepository = CrudRepositoryFirestore<UserFirestore>(
|
||||
'users_crud',
|
||||
UserFirestore.parser(),
|
||||
);
|
||||
|
||||
final _userCubit = CrudCubit<UserFirestore>(_userRepository);
|
||||
|
||||
return RepositoryProvider<CrudRepositoryFirestore<UserFirestore>>(
|
||||
create: (context) => _userRepository,
|
||||
child: BlocProvider<CrudCubit<UserFirestore>>(
|
||||
create: (context) => _userCubit,
|
||||
child: MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: const MyHomePage(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatelessWidget {
|
||||
const MyHomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Flutter Demo Home Page'),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
const Text("Data:"),
|
||||
CrudStreamBuilder<UserFirestore>(
|
||||
onError: (context, state) => const SizedBox.shrink(),
|
||||
onLoading: (context, state) => const Text("Loading..."),
|
||||
onStream: (context, data) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: data.length,
|
||||
itemBuilder: (context, index) {
|
||||
final user = data.elementAt(index);
|
||||
return ListTile(
|
||||
title: Text(user?.name ?? 'Error'),
|
||||
subtitle: Text(user?.id ?? 'Error'),
|
||||
onTap: () {
|
||||
context.read<CrudCubit<UserFirestore>>().get(
|
||||
(user?.id)!,
|
||||
);
|
||||
},
|
||||
onLongPress: () {
|
||||
context.read<CrudCubit<UserFirestore>>().delete(
|
||||
(user?.id)!,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
BlocBuilder<CrudCubit<UserFirestore>, CrudState<UserFirestore>>(
|
||||
builder: (context, state) {
|
||||
return Center(
|
||||
child: Text(
|
||||
state.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final r = Random().nextInt(1000);
|
||||
context.read<CrudCubit<UserFirestore>>().create(
|
||||
UserFirestore(
|
||||
name: 'Wyatt $r',
|
||||
email: '$r@wyattapp.io',
|
||||
phone: '06$r'),
|
||||
);
|
||||
},
|
||||
child: const Text("Create"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<CrudCubit<UserFirestore>>().deleteAll();
|
||||
},
|
||||
child: const Text("DeleteAll"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<CrudCubit<UserFirestore>>().getAll();
|
||||
},
|
||||
child: const Text("GetAll"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context
|
||||
.read<CrudCubit<UserFirestore>>()
|
||||
.query([LimitQueryFirestore(1)]);
|
||||
},
|
||||
child: const Text("Query"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<CrudCubit<UserFirestore>>().streamOf();
|
||||
},
|
||||
child: const Text("StreamOf"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context
|
||||
.read<CrudCubit<UserFirestore>>()
|
||||
.updateAll({'updated': DateTime.now()});
|
||||
},
|
||||
child: const Text("UpdateAll"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<CrudCubit<UserFirestore>>().reset();
|
||||
},
|
||||
child: const Text("Reset"),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:crud_bloc_example/app.dart';
|
||||
import 'package:crud_bloc_example/firebase_options.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart';
|
||||
|
||||
class UserFirestore extends Model<DocumentSnapshot, UserFirestore> {
|
||||
@override
|
||||
String? id;
|
||||
|
||||
String? name;
|
||||
String? email;
|
||||
String? phone;
|
||||
|
||||
UserFirestore({
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.phone,
|
||||
this.id,
|
||||
});
|
||||
UserFirestore._();
|
||||
|
||||
factory UserFirestore.parser() {
|
||||
return UserFirestore._();
|
||||
}
|
||||
|
||||
@override
|
||||
UserFirestore? from(DocumentSnapshot? object) {
|
||||
if (object == null) return null;
|
||||
if (object.exists) {
|
||||
return UserFirestore(
|
||||
id: object.id,
|
||||
name: (object.data() as Map<String, dynamic>?)!['name'] as String,
|
||||
email: (object.data() as Map<String, dynamic>?)!['email'] as String,
|
||||
phone: (object.data() as Map<String, dynamic>?)!['phone'] as String,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, Object> toMap() {
|
||||
return {
|
||||
'name': name ?? '',
|
||||
'email': email ?? '',
|
||||
'phone': phone ?? '',
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'UserFirestore(id: $id, name: $name, email: $email, phone: $phone)';
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
name: crud_bloc_example
|
||||
description: A new Flutter project.
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.16.2 <3.0.0"
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
cloud_firestore: ^3.1.12
|
||||
firebase_core: ^1.14.1
|
||||
flutter_bloc: ^8.0.1
|
||||
wyatt_crud_bloc:
|
||||
path: "../"
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'crud_builder.dart';
|
||||
export 'crud_stream_builder.dart';
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_crud_bloc/src/crud/cubit/crud_cubit.dart';
|
||||
import 'package:wyatt_crud_bloc/src/models/model.dart';
|
||||
|
||||
class CrudBuilder<T extends Model<Object?, T>> extends StatelessWidget {
|
||||
const CrudBuilder({
|
||||
Key? key,
|
||||
this.onIdle,
|
||||
required this.onLoading,
|
||||
required this.onError,
|
||||
required this.onSuccess,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget Function(BuildContext, CrudState<T>)? onIdle;
|
||||
final Widget Function(BuildContext, CrudState<T>) onLoading;
|
||||
final Widget Function(BuildContext, CrudState<T>) onError;
|
||||
final Widget Function(BuildContext, CrudState<T>) onSuccess;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<CrudCubit<T>, CrudState<T>>(
|
||||
builder: (context, state) {
|
||||
switch (state.status) {
|
||||
case CrudStatus.idle:
|
||||
return onIdle?.call(context, state) ?? onError.call(context, state);
|
||||
case CrudStatus.loading:
|
||||
return onLoading.call(context, state);
|
||||
case CrudStatus.failure:
|
||||
return onError.call(context, state);
|
||||
case CrudStatus.success:
|
||||
return onSuccess.call(context, state);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_crud_bloc/src/crud/cubit/crud_cubit.dart';
|
||||
import 'package:wyatt_crud_bloc/src/models/model.dart';
|
||||
|
||||
class CrudStreamBuilder<T extends Model<Object?, T>> extends StatelessWidget {
|
||||
const CrudStreamBuilder({
|
||||
Key? key,
|
||||
required this.onLoading,
|
||||
required this.onError,
|
||||
required this.onStream,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget Function(BuildContext, List<T?>) onStream;
|
||||
final Widget Function(BuildContext, CrudState<T>) onLoading;
|
||||
final Widget Function(BuildContext, CrudState<T>) onError;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<CrudCubit<T>, CrudState<T>>(
|
||||
builder: (context, state) {
|
||||
if (state.stream != null) {
|
||||
return StreamBuilder<List<T?>>(
|
||||
stream: state.stream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return onStream(context, snapshot.data!);
|
||||
} else {
|
||||
return onLoading(context, state);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return onError(context, state);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,5 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
enum SetOperation { replace, intersection, difference, union }
|
||||
export 'builder/builder.dart';
|
||||
export 'cubit/crud_cubit.dart';
|
||||
@@ -0,0 +1,219 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:wyatt_crud_bloc/src/models/model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/models/queries/queries_interface.dart';
|
||||
import 'package:wyatt_crud_bloc/src/repositories/crud_repository_interface.dart';
|
||||
|
||||
part 'crud_state.dart';
|
||||
|
||||
class CrudCubit<T extends Model<Object?, T>> extends Cubit<CrudState<T>> {
|
||||
final CrudRepositoryInterface<T> _crudRepository;
|
||||
|
||||
// ignore: prefer_const_constructors
|
||||
CrudCubit(this._crudRepository) : super(CrudState());
|
||||
// Here we can't use `const` because we need the generic type T
|
||||
|
||||
void reset() {
|
||||
// ignore: prefer_const_constructors
|
||||
emit(CrudState());
|
||||
// Same here, because of `const` we can't use T generic type
|
||||
}
|
||||
|
||||
Future<void> create(Model object, {String? id}) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
await _crudRepository.create(object, id: id);
|
||||
final data = state.data..addAll([object].cast<T>());
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: data,
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
// TODO(hpcl): implement Exception
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> delete(String id) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
await _crudRepository.delete(id);
|
||||
final data = state.data
|
||||
..removeWhere((element) => element!.id != null && element.id == id);
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: data,
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteAll() async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
await _crudRepository.deleteAll();
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: [],
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> get(String id) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
final data = await _crudRepository.get(id);
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: [data].cast<T>(),
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getAll() async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
final data = await _crudRepository.getAll();
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: data.cast<T>(),
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> query(List<QueryInterface> conditions) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
final data = await _crudRepository.query(conditions);
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: data.cast<T>(),
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> streamOf({String? id}) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
final Stream<List<T?>> data = _crudRepository.stream(id: id);
|
||||
emit(
|
||||
state.copyWith(
|
||||
stream: data,
|
||||
status: CrudStatus.success,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> update(
|
||||
String id, {
|
||||
Model? object,
|
||||
Map<String, dynamic>? raw,
|
||||
}) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
await _crudRepository.update(
|
||||
id,
|
||||
object: object,
|
||||
raw: raw,
|
||||
);
|
||||
emit(state.copyWith(status: CrudStatus.success));
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateAll(Map<String, Object?> raw) async {
|
||||
emit(state.copyWith(status: CrudStatus.loading));
|
||||
try {
|
||||
await _crudRepository.updateAll(raw);
|
||||
emit(state.copyWith(status: CrudStatus.success));
|
||||
} catch (e) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: CrudStatus.failure,
|
||||
errorMessage: e.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
part of 'crud_cubit.dart';
|
||||
|
||||
enum CrudStatus {
|
||||
idle,
|
||||
loading,
|
||||
success,
|
||||
failure,
|
||||
}
|
||||
|
||||
class CrudState<T> extends Equatable {
|
||||
final CrudStatus status;
|
||||
final List<T?> data;
|
||||
final Stream<List<T?>>? stream;
|
||||
final String? errorMessage;
|
||||
|
||||
const CrudState({
|
||||
this.status = CrudStatus.idle,
|
||||
this.data = const [],
|
||||
this.stream,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, data];
|
||||
|
||||
CrudState<T> copyWith({
|
||||
CrudStatus? status,
|
||||
List<T?>? data,
|
||||
Stream<List<T?>>? stream,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return CrudState<T>(
|
||||
status: status ?? this.status,
|
||||
data: data ?? this.data,
|
||||
stream: stream ?? this.stream,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
// ignore: lines_longer_than_80_chars
|
||||
'CrudState(status: $status, data: $data, stream: ${stream != null ? 'listening' : 'null'}, errorMessage: $errorMessage)';
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
abstract class Model<O, T> {
|
||||
String? get id;
|
||||
Map<String, Object> toMap();
|
||||
T? from(O? object);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'model.dart';
|
||||
export 'queries/queries.dart';
|
||||