Compare commits
45 Commits
Author | SHA1 | Date |
---|---|---|
Michael Pfaff | 9956b24eb2 | |
Michael Pfaff | 45949890cc | |
Michael Pfaff | 8e99c535bd | |
Luke | 30ae4378df | |
Luke Freeman | 937afe9757 | |
Luke Pighetti | aca29a1e34 | |
Luke Freeman | 337d864b62 | |
Luke Freeman | 3a1a20e03b | |
Luke Freeman | 53e1c97960 | |
Luke Freeman | 16b09f760c | |
Luke Freeman | 624626c85d | |
Luke Freeman | 2c06f63e19 | |
Luke Freeman | 2676006fe3 | |
Luke Freeman | df3434d599 | |
Luke Freeman | fd792404d3 | |
Luke Freeman | 827ecfcc65 | |
Yusuke Otsuka | 5cce0a4db2 | |
Luke Freeman | 9a3ad8d03f | |
Luke | 1536372360 | |
Luke Freeman | ddb81a6b29 | |
Luke Freeman | 3d5a90de0d | |
Miolin | bf5de991ad | |
Luke Freeman | d3b3470ac2 | |
Luke Freeman | daf1742145 | |
Jon Samwell | a11dd62910 | |
Luke Freeman | 79e35c5768 | |
Luke Freeman | 7ec4b2ed0a | |
Luke Freeman | b39baf4b8c | |
Luke Freeman | a1de0f6283 | |
Luke Freeman | c51031e6e3 | |
Luke | 3932235bfb | |
Luke Freeman | d19e689356 | |
Luke Freeman | 3ec7fbc5d2 | |
Luke Freeman | b70118b5c9 | |
Luke | 5090537969 | |
Luke Freeman | ad93ef6711 | |
Luke Freeman | f72d36bdf0 | |
Luke Freeman | 7cb9ccec56 | |
Luke Freeman | d7e6dc60e0 | |
Luke Freeman | eb7da792bc | |
Luke Freeman | e648217562 | |
Luke | 6b9a1822aa | |
Luke | bcde020404 | |
Jeongbong Seo | 27cf6c648a | |
BC Ko | cd84d8ac0e |
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone6]
|
||||||
|
- OS: [e.g. iOS8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
name: I need help using this library or have a question
|
||||||
|
about: Please, strongly consider posting your question to Stack Overflow or another
|
||||||
|
place. The purpose of this issue tracker is to track bugs and feature requests.
|
||||||
|
title: ''
|
||||||
|
labels: question, stack overflow
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Please, strongly consider posting your question to Stack Overflow. The purpose of this issue tracker is to track bugs and feature requests. Questions on how to use the library should be posted to stack overflow so that everyone can benefit from your question.
|
||||||
|
|
||||||
|
If you really need to post your question here:
|
||||||
|
1. Please be super clear on what you're trying to achieve. What is the expected result?
|
||||||
|
2. Please outline what you've tried. There is no point us suggesting something you've already tried.
|
||||||
|
3. Outline the things that have failed, based on your past attempts. This will help us to diagnose whether we need to add a feature or whether it is a bug.
|
||||||
|
|
||||||
|
Thanks!
|
|
@ -9,3 +9,8 @@
|
||||||
pubspec.lock
|
pubspec.lock
|
||||||
coverage
|
coverage
|
||||||
__temp_coverage*
|
__temp_coverage*
|
||||||
|
.dart_tool/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# iOS
|
||||||
|
**/flutter_export_environment.sh
|
||||||
|
|
29
.travis.yml
|
@ -1,21 +1,30 @@
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
|
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- libstdc++6
|
- libstdc++6
|
||||||
- fonts-droid
|
- fonts-droid
|
||||||
before_script:
|
|
||||||
- ./scripts/travis_setup.sh
|
|
||||||
- ./flutter/bin/flutter doctor
|
|
||||||
script:
|
|
||||||
- ./flutter/bin/flutter test --coverage
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash) -t $CODE_COV_TOKEN
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.pub-cache
|
- $HOME/.pub-cache
|
||||||
|
|
||||||
|
env:
|
||||||
|
- FLUTTER_VERSION=dev
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
- env: FLUTTER_VERSION=dev
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION
|
||||||
|
- $TRAVIS_BUILD_DIR/flutter/bin/flutter doctor
|
||||||
|
script:
|
||||||
|
- ./tool/travis.sh
|
||||||
|
after_success:
|
||||||
|
- bash <(curl -s https://codecov.io/bash) -t $CODE_COV_TOKEN
|
55
CHANGELOG.md
|
@ -1,3 +1,58 @@
|
||||||
|
# 1.6.3
|
||||||
|
- Remove upper bounds on Flutter SDK checks because Flutter releases are a ridiculous mess
|
||||||
|
|
||||||
|
# 1.6.2
|
||||||
|
- Support for Flutter `>=1.12 <=1.17`
|
||||||
|
|
||||||
|
# 1.6.1
|
||||||
|
- Support for Flutter `1.12+`
|
||||||
|
|
||||||
|
# 1.6.0
|
||||||
|
- No changes other than fixes for non-backwards compatible Flutter changes
|
||||||
|
- Flutter `>= 1.12.0` is required due to Flutter compatibility issues
|
||||||
|
- Dart `>= 2.6.0` is required
|
||||||
|
|
||||||
|
# 1.5.2
|
||||||
|
- Remove dependency on `dart:io`
|
||||||
|
- 1.5.x and lower now only supports Flutter versions `< 1.13.0`
|
||||||
|
|
||||||
|
# 1.5.1
|
||||||
|
- Add explicit material and full screen material transition types
|
||||||
|
- Fix issue in transition logic
|
||||||
|
- Remove redundant `new`, `const`, etc qualifiers
|
||||||
|
- Tidy example
|
||||||
|
- Add font license info
|
||||||
|
|
||||||
|
# 1.5.0
|
||||||
|
- Native transitions will now use the Cupertino page route on iOS and Material page route on android. This will enable swipe gestures on iOS.
|
||||||
|
- Added cupertino specific transition types.
|
||||||
|
- **You should not be using Cupertino types on non-iOS platforms. It's up to you, but it's bad design**.
|
||||||
|
|
||||||
|
# 1.4.0
|
||||||
|
- Added the ability to define a transition at the point of route definition. Route transitions are optional and any transition defined a "push" will override the route definition.
|
||||||
|
|
||||||
|
# 1.3.7
|
||||||
|
- Add `toString` for custom `RouteNotFoundException` type
|
||||||
|
|
||||||
|
# 1.3.6
|
||||||
|
- Small fix to error return type when no route match was made
|
||||||
|
|
||||||
|
# 1.3.5
|
||||||
|
- add `pop` convenience
|
||||||
|
- add `clearStack` flag so that you can clear the history when pushing a route
|
||||||
|
|
||||||
|
# 1.3.4
|
||||||
|
- Change lower dart version to cater to older flutter versions
|
||||||
|
|
||||||
|
# 1.3.3
|
||||||
|
- Fix analyzer issues
|
||||||
|
- Remove deprecations in example code
|
||||||
|
- Fix pubspec analysis issue
|
||||||
|
|
||||||
|
# 1.3.2
|
||||||
|
- Dart 2 package (pubspec) compliance changes ONLY
|
||||||
|
- **Note**: No functional changes
|
||||||
|
|
||||||
# 1.3.1
|
# 1.3.1
|
||||||
- Fixes an issue with the route generator (result cannot be Null)
|
- Fixes an issue with the route generator (result cannot be Null)
|
||||||
|
|
||||||
|
|
16
LICENSE
|
@ -1,9 +1,9 @@
|
||||||
Fluro
|
Fluro
|
||||||
|
|
||||||
Created by Posse in NYC
|
Created by Yakka
|
||||||
http://goposse.com
|
https://theyakka.com
|
||||||
|
|
||||||
Copyright (c) 2017 Posse Productions LLC.
|
Copyright (c) 2019 Yakka LLC.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -14,17 +14,17 @@ modification, are permitted provided that the following conditions are met:
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of the Posse Productions LLC, Posse nor the
|
* Neither the name of the Yakka LLC, Yakka nor the names of its contributors may
|
||||||
names of its contributors may be used to endorse or promote products
|
be used to endorse or promote products derived from this software without
|
||||||
derived from this software without specific prior written permission.
|
specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
DISCLAIMED. IN NO EVENT SHALL POSSE PRODUCTIONS LLC (POSSE) BE LIABLE FOR ANY
|
DISCLAIMED. IN NO EVENT SHALL YAKKA LLC (YAKKA) BE LIABLE FOR ANY
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
34
README.md
|
@ -1,11 +1,13 @@
|
||||||
<img src="https://storage.googleapis.com/app-logos/logo_fluro.png" width="220">
|
<img src="https://storage.googleapis.com/product-logos/logo_fluro.png" width="220">
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
The brightest, hippest, coolest router for Flutter.
|
The brightest, hippest, coolest router for Flutter.
|
||||||
|
|
||||||
[![Version](https://img.shields.io/badge/version-1.3.1-blue.svg)](https://pub.dartlang.org/packages/fluro)
|
[![Version](https://img.shields.io/badge/version-1.6.3-blue.svg)](https://pub.dartlang.org/packages/fluro)
|
||||||
[![Build Status](https://travis-ci.org/goposse/fluro.svg?branch=master)](https://travis-ci.org/goposse/fluro)
|
[![Build Status](https://travis-ci.org/theyakka/fluro.svg?branch=master)](https://travis-ci.org/theyakka/fluro)
|
||||||
[![Coverage](https://codecov.io/gh/goposse/fluro/branch/master/graph/badge.svg)](https://codecov.io/gh/goposse/fluro)
|
[![Coverage](https://codecov.io/gh/theyakka/fluro/branch/master/graph/badge.svg)](https://codecov.io/gh/theyakka/fluro)
|
||||||
|
|
||||||
|
Version `1.6.0` (and higher) requires Flutter `>= 1.12.0` and Dart `>= 2.6.0`. If you're running an older version of Flutter, use a version `< 1.6.0`.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -25,14 +27,14 @@ See CHANGELOG for all breaking (and non-breaking) changes.
|
||||||
You should ensure that you add the router as a dependency in your flutter project.
|
You should ensure that you add the router as a dependency in your flutter project.
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
fluro: "^1.3.1"
|
fluro: "^1.6.3"
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also reference the git repo directly if you want:
|
You can also reference the git repo directly if you want:
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
fluro:
|
fluro:
|
||||||
git: git://github.com/goposse/fluro.git
|
git: git://github.com/theyakka/fluro.git
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,19 +48,22 @@ There is a pretty sweet example project in the `example` folder. Check it out. O
|
||||||
|
|
||||||
First, you should define a new `Router` object by initializing it as such:
|
First, you should define a new `Router` object by initializing it as such:
|
||||||
```dart
|
```dart
|
||||||
final router = new Router();
|
final router = Router();
|
||||||
```
|
```
|
||||||
It may be convenient for you to store the router globally/statically so that
|
It may be convenient for you to store the router globally/statically so that
|
||||||
you can access the router in other areas in your application.
|
you can access the router in other areas in your application.
|
||||||
|
|
||||||
After instantiating the router, you will need to define your routes and your route handlers:
|
After instantiating the router, you will need to define your routes and your route handlers:
|
||||||
```dart
|
```dart
|
||||||
var usersHandler = new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
|
var usersHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
|
||||||
return new UsersScreen(params["id"][0]);
|
return UsersScreen(params["id"][0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
void defineRoutes(Router router) {
|
void defineRoutes(Router router) {
|
||||||
router.define("/users/:id", handler: usersHandler);
|
router.define("/users/:id", handler: usersHandler);
|
||||||
|
|
||||||
|
// it is also possible to define the route transition to use
|
||||||
|
// router.define("users/:id", handler: usersHandler, transitionType: TransitionType.inFromLeft);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -78,13 +83,12 @@ for you.
|
||||||
You can also manually push to a route yourself. To do so:
|
You can also manually push to a route yourself. To do so:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
router.navigateTo(context, "/users/1234",
|
router.navigateTo(context, "/users/1234", transition: TransitionType.fadeIn);
|
||||||
transition: TransitionType.fadeIn);
|
|
||||||
```
|
```
|
||||||
<br/>
|
|
||||||
<hr/>
|
<hr/>
|
||||||
Fluro is a Posse Production.
|
Fluro is a Yakka original.
|
||||||
<br/>
|
<br/>
|
||||||
<a href="http://goposse.com" target="_posse">
|
<a href="https://theyakka.com" target="_yakka">
|
||||||
<img src="https://storage.googleapis.com/posse-logos/logo-posse.png"
|
<img src="https://storage.googleapis.com/yakka-logos/logo_wordmark.png"
|
||||||
width="60"></a>
|
width="60"></a>
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply from: "../config.gradle"
|
|
||||||
apply from: "../flutter.gradle"
|
apply from: "../flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion versions.targetSDK
|
compileSdkVersion 29
|
||||||
buildToolsVersion "${versions.buildTools}"
|
buildToolsVersion "29.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion versions.minSDK
|
minSdkVersion 24
|
||||||
targetSdkVersion versions.targetSDK
|
targetSdkVersion 29
|
||||||
applicationId "$appInfo.applicationID"
|
applicationId "app.yakka.fluroexample"
|
||||||
versionCode appInfo.build
|
versionCode 1
|
||||||
versionName "${appInfo.version}"
|
versionName "1.6.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
disable 'InvalidPackage'
|
disable 'InvalidPackage'
|
||||||
|
@ -28,15 +27,15 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
// kotlin
|
// kotlin
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
|
||||||
// google
|
// google
|
||||||
compile "com.android.support:appcompat-v7:${versions.googleSupport}"
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
compile "com.android.support:support-v13:${versions.googleSupport}"
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||||
compile "com.android.support:support-v4:${versions.googleSupport}"
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
// testing
|
// testing
|
||||||
androidTestCompile "com.android.support:support-annotations:${versions.googleSupport}"
|
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
|
||||||
androidTestCompile 'com.android.support.test:runner:1.0.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestCompile 'com.android.support.test:rules:1.0.1'
|
androidTestImplementation 'androidx.test:rules:1.2.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import io.flutter.plugins.GeneratedPluginRegistrant
|
||||||
|
|
||||||
class MainActivity : FlutterActivity() {
|
class MainActivity : FlutterActivity() {
|
||||||
|
|
||||||
private val LOG_TAG = "A:Main"
|
private val logTag = "A:Main"
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -17,16 +17,13 @@ class MainActivity : FlutterActivity() {
|
||||||
checkForLinkEvent(intent)
|
checkForLinkEvent(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkForLinkEvent(intent: Intent) {
|
private fun checkForLinkEvent(intent: Intent) {
|
||||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
val data = intent.data
|
||||||
val path = intent.data.getQueryParameter("path")
|
if (intent.action == Intent.ACTION_VIEW && data != null) {
|
||||||
val text = intent.data.getQueryParameter("message") ?: "Why you don't enter text?"
|
val path = data.getQueryParameter("path")
|
||||||
|
val text = data.getQueryParameter("message") ?: "Why you don't enter text?"
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
Log.d(LOG_TAG, "Setting initial route to: $path?message=$text")
|
Log.d(logTag, "Setting initial route to: $path?message=$text")
|
||||||
flutterView.setInitialRoute("$path?message=$text")
|
flutterView.setInitialRoute("$path?message=$text")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.2.30'
|
ext.kotlin_version = '1.3.61'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
ext.appInfo = [
|
ext.appInfo = [
|
||||||
version: '1.3.0',
|
version: '1.6.0',
|
||||||
build: 1,
|
build: 1,
|
||||||
applicationID: "com.goposse.fluro"
|
applicationID: "com.goposse.fluro"
|
||||||
]
|
]
|
||||||
|
|
||||||
ext.versions = [
|
ext.versions = [
|
||||||
minSDK: 21,
|
minSDK: 21,
|
||||||
targetSDK: 27,
|
targetSDK: 29,
|
||||||
buildTools: '27.0.3',
|
buildTools: '29.0.3',
|
||||||
kotlin: '1.2.30',
|
kotlin: '1.3.61',
|
||||||
googleSupport: '27.1.0'
|
googleSupport: '27.1.0'
|
||||||
]
|
]
|
|
@ -1 +1,4 @@
|
||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
|
android.enableR8=true
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
Copyright 2015 SUNRISE DIGITAL, Juan Hodgson Authors (srdigital@msn.com)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
After Width: | Height: | Size: 731 B |
After Width: | Height: | Size: 978 B |
After Width: | Height: | Size: 882 B |
After Width: | Height: | Size: 587 B |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 978 B |
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 11 KiB |
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# NOTE: This podspec is NOT to be published. It is only used as a local source!
|
||||||
|
#
|
||||||
|
|
||||||
|
Pod::Spec.new do |s|
|
||||||
|
s.name = 'Flutter'
|
||||||
|
s.version = '1.0.0'
|
||||||
|
s.summary = 'High-performance, high-fidelity mobile apps.'
|
||||||
|
s.description = <<-DESC
|
||||||
|
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
|
||||||
|
DESC
|
||||||
|
s.homepage = 'https://flutter.io'
|
||||||
|
s.license = { :type => 'MIT' }
|
||||||
|
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
|
||||||
|
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
|
||||||
|
s.ios.deployment_target = '8.0'
|
||||||
|
s.vendored_frameworks = 'Flutter.framework'
|
||||||
|
end
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
|
|
||||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
||||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
41FA87031F2620DA005CDA4D /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 41FA87021F2620DA005CDA4D /* GeneratedPluginRegistrant.m */; };
|
41FA87031F2620DA005CDA4D /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 41FA87021F2620DA005CDA4D /* GeneratedPluginRegistrant.m */; };
|
||||||
|
@ -40,7 +39,6 @@
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
|
|
||||||
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
||||||
41FA87011F2620DA005CDA4D /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
41FA87011F2620DA005CDA4D /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
41FA87021F2620DA005CDA4D /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
41FA87021F2620DA005CDA4D /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
|
@ -76,7 +74,6 @@
|
||||||
children = (
|
children = (
|
||||||
3B80C3931E831B6300D905FE /* App.framework */,
|
3B80C3931E831B6300D905FE /* App.framework */,
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
|
|
||||||
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||||
|
@ -190,7 +187,6 @@
|
||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||||
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
|
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
|
|
||||||
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
|
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||||
|
|
|
@ -7,8 +7,11 @@
|
||||||
|
|
||||||
#import <Flutter/Flutter.h>
|
#import <Flutter/Flutter.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface GeneratedPluginRegistrant : NSObject
|
@interface GeneratedPluginRegistrant : NSObject
|
||||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
|
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
#endif /* GeneratedPluginRegistrant_h */
|
#endif /* GeneratedPluginRegistrant_h */
|
||||||
|
|
|
@ -1,44 +1,43 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import '../../config/application.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../config/application.dart';
|
||||||
import '../../config/routes.dart';
|
import '../../config/routes.dart';
|
||||||
import '../home/home_component.dart';
|
|
||||||
|
|
||||||
class AppComponent extends StatefulWidget {
|
class AppComponent extends StatefulWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State createState() {
|
State createState() {
|
||||||
return new AppComponentState();
|
return AppComponentState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppComponentState extends State<AppComponent> {
|
class AppComponentState extends State<AppComponent> {
|
||||||
|
|
||||||
AppComponentState() {
|
AppComponentState() {
|
||||||
final router = new Router();
|
final router = Router();
|
||||||
Routes.configureRoutes(router);
|
Routes.configureRoutes(router);
|
||||||
Application.router = router;
|
Application.router = router;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final app = new MaterialApp(
|
final app = MaterialApp(
|
||||||
title: 'Fluro',
|
title: 'Fluro',
|
||||||
theme: new ThemeData(
|
debugShowCheckedModeBanner: false,
|
||||||
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
onGenerateRoute: Application.router.generator,
|
onGenerateRoute: Application.router.generator,
|
||||||
|
navigatorKey: Application.routerKey,
|
||||||
);
|
);
|
||||||
print("initial route = ${app.initialRoute}");
|
// print("initial route = ${app.initialRoute}");
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class DemoMessageComponent extends StatelessWidget {
|
class DemoMessageComponent extends StatelessWidget {
|
||||||
|
DemoMessageComponent(
|
||||||
DemoMessageComponent({@required this.message, this.color = const Color(0xFFFFFFFF)});
|
{@required this.message, this.color = const Color(0xFFFFFFFF)});
|
||||||
|
|
||||||
final String message;
|
final String message;
|
||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Material(
|
return Material(
|
||||||
color: this.color,
|
color: this.color,
|
||||||
child: new Center(
|
child: Center(
|
||||||
child: new Text(
|
child: Text(
|
||||||
message,
|
message,
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: "Lazer84",
|
fontFamily: "Lazer84",
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
|
/*
|
||||||
|
* fluro
|
||||||
|
* Created by Yakka
|
||||||
|
* https://theyakka.com
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
|
* See LICENSE for distribution and usage details.
|
||||||
|
*/
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class DemoResultComponent extends StatefulWidget {
|
class DemoResultComponent extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
_DemoResultComponentState createState() => new _DemoResultComponentState();
|
_DemoResultComponentState createState() => _DemoResultComponentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DemoResultComponentState extends State<DemoResultComponent> {
|
class _DemoResultComponentState extends State<DemoResultComponent> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container();
|
||||||
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import '../../helpers/color_helpers.dart';
|
import '../../helpers/color_helpers.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class DemoSimpleComponent extends StatelessWidget {
|
class DemoSimpleComponent extends StatelessWidget {
|
||||||
|
DemoSimpleComponent(
|
||||||
DemoSimpleComponent({String message = "Testing", Color color = const Color(0xFFFFFFFF), String result})
|
{String message = "Testing",
|
||||||
|
Color color = const Color(0xFFFFFFFF),
|
||||||
|
String result})
|
||||||
: this.message = message,
|
: this.message = message,
|
||||||
this.color = color,
|
this.color = color,
|
||||||
this.result = result;
|
this.result = result;
|
||||||
|
@ -21,34 +24,36 @@ class DemoSimpleComponent extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Material(
|
return Material(
|
||||||
color: color,
|
color: color,
|
||||||
child: new Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
new Image(
|
Image(
|
||||||
image: new AssetImage("assets/images/acc_boom.png"),
|
image: AssetImage("assets/images/acc_boom.png"),
|
||||||
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
||||||
width: 260.0,
|
width: 260.0,
|
||||||
),
|
),
|
||||||
new Padding(
|
Padding(
|
||||||
padding: new EdgeInsets.only(left: 50.0, right: 50.0, top: 15.0),
|
padding: EdgeInsets.only(left: 50.0, right: 50.0, top: 15.0),
|
||||||
child: new Text(
|
child: Text(
|
||||||
message,
|
message,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
||||||
height: 2.0,
|
height: 2.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new Padding(
|
Padding(
|
||||||
padding: new EdgeInsets.only(top: 15.0),
|
padding: EdgeInsets.only(top: 15.0),
|
||||||
child: new ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: new BoxConstraints(minHeight: 42.0),
|
constraints: BoxConstraints(minHeight: 42.0),
|
||||||
child: new FlatButton(
|
child: FlatButton(
|
||||||
highlightColor: ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(17),
|
highlightColor:
|
||||||
splashColor: ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(34),
|
ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(17),
|
||||||
|
splashColor:
|
||||||
|
ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(34),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
@ -56,9 +61,9 @@ class DemoSimpleComponent extends StatelessWidget {
|
||||||
Navigator.pop(context, result);
|
Navigator.pop(context, result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: new Text(
|
child: Text(
|
||||||
"OK",
|
"OK",
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
||||||
),
|
),
|
||||||
|
@ -70,4 +75,4 @@ class DemoSimpleComponent extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,50 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import '../../config/application.dart';
|
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class HomeComponent extends StatefulWidget {
|
import '../../config/application.dart';
|
||||||
|
|
||||||
|
class HomeComponent extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
State createState() => new HomeComponentState();
|
State createState() => HomeComponentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class HomeComponentState extends State<HomeComponent> {
|
class HomeComponentState extends State<HomeComponent> {
|
||||||
|
|
||||||
var _deepLinkOpacity = 1.0;
|
var _deepLinkOpacity = 1.0;
|
||||||
final _deepLinkURL = "fluro://deeplink?path=/message&mesage=fluro%20rocks%21%21";
|
final _deepLinkURL =
|
||||||
|
"fluro://deeplink?path=/message&mesage=fluro%20rocks%21%21";
|
||||||
final _daysOfWeek = const [
|
final _daysOfWeek = const [
|
||||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
"Monday",
|
||||||
|
"Tuesday",
|
||||||
|
"Wednesday",
|
||||||
|
"Thursday",
|
||||||
|
"Friday",
|
||||||
|
"Saturday",
|
||||||
|
"Sunday"
|
||||||
];
|
];
|
||||||
|
|
||||||
Widget deepLinkWidget(BuildContext context) {
|
Widget deepLinkWidget(BuildContext context) {
|
||||||
return new Stack(
|
return Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
// copied widget
|
// copied widget
|
||||||
new AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
opacity: (_deepLinkOpacity - 1.0).abs(),
|
opacity: (_deepLinkOpacity - 1.0).abs(),
|
||||||
duration: new Duration(milliseconds: 400),
|
duration: Duration(milliseconds: 400),
|
||||||
child: new Center(
|
child: Center(
|
||||||
child: new Text(
|
child: Text(
|
||||||
"Copied to clipboard!",
|
"Copied to clipboard!",
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
color: const Color(0xFFFFFFFF),
|
color: const Color(0xFFFFFFFF),
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
@ -45,16 +53,16 @@ class HomeComponentState extends State<HomeComponent> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// button widget
|
// button widget
|
||||||
new AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
opacity: _deepLinkOpacity,
|
opacity: _deepLinkOpacity,
|
||||||
duration: new Duration(milliseconds: 250),
|
duration: Duration(milliseconds: 250),
|
||||||
child: new Center(
|
child: Center(
|
||||||
child: new FlatButton(
|
child: FlatButton(
|
||||||
highlightColor: const Color(0x11FFFFFF),
|
highlightColor: const Color(0x11FFFFFF),
|
||||||
splashColor: const Color(0x22FFFFFF),
|
splashColor: const Color(0x22FFFFFF),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_deepLinkOpacity == 1.0) {
|
if (_deepLinkOpacity == 1.0) {
|
||||||
new Timer(new Duration(milliseconds: 2000), () {
|
Timer(Duration(milliseconds: 2000), () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_deepLinkOpacity = 1.0;
|
_deepLinkOpacity = 1.0;
|
||||||
});
|
});
|
||||||
|
@ -62,16 +70,16 @@ class HomeComponentState extends State<HomeComponent> {
|
||||||
setState(() {
|
setState(() {
|
||||||
_deepLinkOpacity = 0.0;
|
_deepLinkOpacity = 0.0;
|
||||||
});
|
});
|
||||||
final clipboardData = new ClipboardData(text: _deepLinkURL);
|
final clipboardData = ClipboardData(text: _deepLinkURL);
|
||||||
Clipboard.setData(clipboardData);
|
Clipboard.setData(clipboardData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: new Padding(
|
child: Padding(
|
||||||
padding: new EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: new Text(
|
child: Text(
|
||||||
"Click here to copy a deep link url to the clipboard",
|
"Click here to copy a deep link url to the clipboard",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.0,
|
fontSize: 12.0,
|
||||||
color: const Color(0xCCFFFFFF),
|
color: const Color(0xCCFFFFFF),
|
||||||
),
|
),
|
||||||
|
@ -87,50 +95,99 @@ class HomeComponentState extends State<HomeComponent> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var menuWidgets = <Widget>[
|
var menuWidgets = <Widget>[
|
||||||
new Padding(
|
menuButton(context, 'assets/images/ic_transform_native_hz.png',
|
||||||
padding: new EdgeInsets.only(bottom: 35.0),
|
"Native Animation", "native"),
|
||||||
child: new Image(image: new AssetImage("assets/images/logo_fluro.png"), width: 200.0),
|
menuButton(context, 'assets/images/ic_transform_fade_in_hz.png',
|
||||||
),
|
"Preset (Fade In)", "preset-fade"),
|
||||||
menuButton(context, "Native Animation", "native"),
|
menuButton(context, 'assets/images/ic_transform_global_hz.png',
|
||||||
menuButton(context, "Preset (In from Left)", "preset-from-left"),
|
"Preset (Global transition)", "fixed-trans"),
|
||||||
menuButton(context, "Preset (Fade In)", "preset-fade"),
|
menuButton(context, 'assets/images/ic_transform_custom_hz.png',
|
||||||
menuButton(context, "Custom Transition", "custom"),
|
"Custom Transition", "custom"),
|
||||||
menuButton(context, "Navigator Result", "pop-result"),
|
menuButton(context, 'assets/images/ic_result_hz.png', "Navigator Result",
|
||||||
menuButton(context, "Function Call", "function-call"),
|
"pop-result"),
|
||||||
new Padding(
|
menuButton(context, 'assets/images/ic_function_hz.png', "Function Call",
|
||||||
padding: new EdgeInsets.only(top: 65.0, left: 60.0, right: 60.0),
|
"function-call"),
|
||||||
child: new Center(
|
|
||||||
child: new ConstrainedBox(
|
|
||||||
constraints: new BoxConstraints.tightFor(height: 60.0),
|
|
||||||
child: deepLinkWidget(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return new Material(
|
final size = MediaQuery.of(context).size;
|
||||||
|
final childRatio = (size.width / size.height) * 2.5;
|
||||||
|
|
||||||
|
return Material(
|
||||||
color: const Color(0xFF00D6F7),
|
color: const Color(0xFF00D6F7),
|
||||||
child: new Column(
|
child: SafeArea(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
top: true,
|
||||||
children: menuWidgets,
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 25, bottom: 35, left: 25),
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage("assets/images/logo_fluro.png"),
|
||||||
|
width: 100.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
||||||
|
child: GridView.count(
|
||||||
|
childAspectRatio: childRatio,
|
||||||
|
crossAxisCount: 2,
|
||||||
|
mainAxisSpacing: 5,
|
||||||
|
children: menuWidgets,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Padding(
|
||||||
|
// padding: EdgeInsets.only(top: 35.0, bottom: 25),
|
||||||
|
// child: Center(
|
||||||
|
// child: ConstrainedBox(
|
||||||
|
// constraints: BoxConstraints.tightFor(height: 60.0),
|
||||||
|
// child: deepLinkWidget(context),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
Widget menuButton(BuildContext context, String title, String key) {
|
Widget menuButton(
|
||||||
return new Padding(
|
BuildContext context, String assetSrc, String title, String key) {
|
||||||
padding: new EdgeInsets.all(4.0),
|
return Padding(
|
||||||
child: new ConstrainedBox(
|
padding: EdgeInsets.all(4.0),
|
||||||
constraints: new BoxConstraints(minHeight: 42.0),
|
child: Container(
|
||||||
child: new FlatButton(
|
height: 42.0,
|
||||||
|
child: FlatButton(
|
||||||
|
color: const Color(0x22FFFFFF),
|
||||||
highlightColor: const Color(0x11FFFFFF),
|
highlightColor: const Color(0x11FFFFFF),
|
||||||
splashColor: const Color(0x22FFFFFF),
|
splashColor: const Color(0x22FFFFFF),
|
||||||
child: new Text(
|
child: Column(
|
||||||
title,
|
mainAxisSize: MainAxisSize.min,
|
||||||
style: new TextStyle(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
color: const Color(0xAA001133),
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
),
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 10),
|
||||||
|
child: Container(
|
||||||
|
height: 36,
|
||||||
|
child: Image.asset(
|
||||||
|
assetSrc,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: const Color(0xAA001133),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tappedMenuButton(context, key);
|
tappedMenuButton(context, key);
|
||||||
|
@ -146,13 +203,15 @@ class HomeComponentState extends State<HomeComponent> {
|
||||||
String hexCode = "#FFFFFF";
|
String hexCode = "#FFFFFF";
|
||||||
String result;
|
String result;
|
||||||
TransitionType transitionType = TransitionType.native;
|
TransitionType transitionType = TransitionType.native;
|
||||||
if (key != "custom" && key != "function-call") {
|
if (key != "custom" && key != "function-call" && key != "fixed-trans") {
|
||||||
if (key == "native") {
|
if (key == "native") {
|
||||||
hexCode = "#F76F00";
|
hexCode = "#F76F00";
|
||||||
message = "This screen should have appeared using the default flutter animation for the current OS";
|
message =
|
||||||
|
"This screen should have appeared using the default flutter animation for the current OS";
|
||||||
} else if (key == "preset-from-left") {
|
} else if (key == "preset-from-left") {
|
||||||
hexCode = "#5BF700";
|
hexCode = "#5BF700";
|
||||||
message = "This screen should have appeared with a slide in from left transition";
|
message =
|
||||||
|
"This screen should have appeared with a slide in from left transition";
|
||||||
transitionType = TransitionType.inFromLeft;
|
transitionType = TransitionType.inFromLeft;
|
||||||
} else if (key == "preset-fade") {
|
} else if (key == "preset-fade") {
|
||||||
hexCode = "#F700D2";
|
hexCode = "#F700D2";
|
||||||
|
@ -161,8 +220,9 @@ class HomeComponentState extends State<HomeComponent> {
|
||||||
} else if (key == "pop-result") {
|
} else if (key == "pop-result") {
|
||||||
transitionType = TransitionType.native;
|
transitionType = TransitionType.native;
|
||||||
hexCode = "#7d41f4";
|
hexCode = "#7d41f4";
|
||||||
message = "When you close this screen you should see the current day of the week";
|
message =
|
||||||
result = "Today is ${_daysOfWeek[new DateTime.now().weekday]}!";
|
"When you close this screen you should see the current day of the week";
|
||||||
|
result = "Today is ${_daysOfWeek[DateTime.now().weekday - 1]}!";
|
||||||
}
|
}
|
||||||
|
|
||||||
String route = "/demo?message=$message&color_hex=$hexCode";
|
String route = "/demo?message=$message&color_hex=$hexCode";
|
||||||
|
@ -171,37 +231,40 @@ class HomeComponentState extends State<HomeComponent> {
|
||||||
route = "$route&result=$result";
|
route = "$route&result=$result";
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.router.navigateTo(
|
Application.router
|
||||||
context, route,
|
.navigateTo(Application.routerKey, route, transition: transitionType)
|
||||||
transition: transitionType).then((result) {
|
.then((result) {
|
||||||
if (key == "pop-result") {
|
if (key == "pop-result") {
|
||||||
Application.router.navigateTo(context, "/demo/func?message=$result");
|
Application.router.navigateTo(Application.routerKey, "/demo/func?message=$result");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (key == "custom") {
|
} else if (key == "custom") {
|
||||||
hexCode = "#DFF700";
|
hexCode = "#DFF700";
|
||||||
message = "This screen should have appeared with a crazy custom transition";
|
message =
|
||||||
var transition =
|
"This screen should have appeared with a crazy custom transition";
|
||||||
(BuildContext context, Animation<double> animation,
|
var transition = (BuildContext context, Animation<double> animation,
|
||||||
Animation<double> secondaryAnimation, Widget child) {
|
Animation<double> secondaryAnimation, Widget child) {
|
||||||
return new ScaleTransition(
|
return ScaleTransition(
|
||||||
scale: animation,
|
scale: animation,
|
||||||
child: new RotationTransition(
|
child: RotationTransition(
|
||||||
turns: animation,
|
turns: animation,
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Application.router.navigateTo(
|
Application.router.navigateTo(
|
||||||
context,
|
Application.routerKey,
|
||||||
"/demo?message=$message&color_hex=$hexCode",
|
"/demo?message=$message&color_hex=$hexCode",
|
||||||
transition: TransitionType.custom,
|
transition: TransitionType.custom,
|
||||||
transitionBuilder: transition,
|
transitionBuilder: transition,
|
||||||
transitionDuration: const Duration(milliseconds: 600),
|
transitionDuration: const Duration(milliseconds: 600),
|
||||||
);
|
);
|
||||||
|
} else if (key == "fixed-trans") {
|
||||||
|
Application.router.navigateTo(
|
||||||
|
Application.routerKey, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b");
|
||||||
} else {
|
} else {
|
||||||
message = "You tapped the function button!";
|
message = "You tapped the function button!";
|
||||||
Application.router.navigateTo(context, "/demo/func?message=$message");
|
Application.router.navigateTo(Application.routerKey, "/demo/func?message=$message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class Application {
|
class Application {
|
||||||
static Router router;
|
static Router router;
|
||||||
}
|
|
||||||
|
static GlobalKey<NavigatorState> routerKey = GlobalKey<NavigatorState>();
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import '../helpers/color_helpers.dart';
|
import '../helpers/color_helpers.dart';
|
||||||
|
@ -12,63 +13,68 @@ import 'package:flutter/painting.dart';
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
var rootHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
var rootHandler = Handler(
|
||||||
return new HomeComponent();
|
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||||
|
return HomeComponent();
|
||||||
});
|
});
|
||||||
|
|
||||||
var demoRouteHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
var demoRouteHandler = Handler(
|
||||||
|
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||||
String message = params["message"]?.first;
|
String message = params["message"]?.first;
|
||||||
String colorHex = params["color_hex"]?.first;
|
String colorHex = params["color_hex"]?.first;
|
||||||
String result = params["result"]?.first;
|
String result = params["result"]?.first;
|
||||||
Color color = new Color(0xFFFFFFFF);
|
Color color = Color(0xFFFFFFFF);
|
||||||
if (colorHex != null && colorHex.length > 0) {
|
if (colorHex != null && colorHex.length > 0) {
|
||||||
color = new Color(ColorHelpers.fromHexString(colorHex));
|
color = Color(ColorHelpers.fromHexString(colorHex));
|
||||||
}
|
}
|
||||||
return new DemoSimpleComponent(message: message, color: color, result: result);
|
return DemoSimpleComponent(message: message, color: color, result: result);
|
||||||
});
|
});
|
||||||
|
|
||||||
var demoFunctionHandler = new Handler(
|
var demoFunctionHandler = Handler(
|
||||||
type: HandlerType.function,
|
type: HandlerType.function,
|
||||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||||
String message = params["message"]?.first;
|
String message = params["message"]?.first;
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
child: new AlertDialog(
|
builder: (context) {
|
||||||
title: new Text(
|
return AlertDialog(
|
||||||
"Hey Hey!",
|
title: Text(
|
||||||
style: new TextStyle(
|
"Hey Hey!",
|
||||||
color: const Color(0xFF00D6F7),
|
style: TextStyle(
|
||||||
fontFamily: "Lazer84",
|
color: const Color(0xFF00D6F7),
|
||||||
fontSize: 22.0,
|
fontFamily: "Lazer84",
|
||||||
),
|
fontSize: 22.0,
|
||||||
),
|
|
||||||
content: new Text("$message"),
|
|
||||||
actions: <Widget>[
|
|
||||||
new Padding(
|
|
||||||
padding: new EdgeInsets.only(bottom: 8.0, right: 8.0),
|
|
||||||
child: new FlatButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop(true);
|
|
||||||
},
|
|
||||||
child: new Text("OK"),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
content: Text("$message"),
|
||||||
),
|
actions: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 8.0, right: 8.0),
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(true);
|
||||||
|
},
|
||||||
|
child: Text("OK"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Handles deep links into the app
|
/// Handles deep links into the app
|
||||||
/// To test on Android:
|
/// To test on Android:
|
||||||
///
|
///
|
||||||
/// `adb shell am start -W -a android.intent.action.VIEW -d "fluro://deeplink?path=/message&mesage=fluro%20rocks%21%21" com.goposse.fluro`
|
/// `adb shell am start -W -a android.intent.action.VIEW -d "fluro://deeplink?path=/message&mesage=fluro%20rocks%21%21" com.theyakka.fluro`
|
||||||
var deepLinkHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
var deepLinkHandler = Handler(
|
||||||
String message = params["message"]?.first;
|
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||||
String colorHex = params["color_hex"]?.first;
|
String colorHex = params["color_hex"]?.first;
|
||||||
String result = params["result"]?.first;
|
String result = params["result"]?.first;
|
||||||
Color color = new Color(0xFFFFFFFF);
|
Color color = Color(0xFFFFFFFF);
|
||||||
if (colorHex != null && colorHex.length > 0) {
|
if (colorHex != null && colorHex.length > 0) {
|
||||||
color = new Color(ColorHelpers.fromHexString(colorHex));
|
color = Color(ColorHelpers.fromHexString(colorHex));
|
||||||
}
|
}
|
||||||
return new DemoSimpleComponent(message: "DEEEEEP LINK!!!", color: color, result: result);
|
return DemoSimpleComponent(
|
||||||
|
message: "DEEEEEP LINK!!!", color: color, result: result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
|
@ -10,20 +11,22 @@ import 'package:flutter/material.dart';
|
||||||
import './route_handlers.dart';
|
import './route_handlers.dart';
|
||||||
|
|
||||||
class Routes {
|
class Routes {
|
||||||
|
|
||||||
static String root = "/";
|
static String root = "/";
|
||||||
static String demoSimple = "/demo";
|
static String demoSimple = "/demo";
|
||||||
|
static String demoSimpleFixedTrans = "/demo/fixedtrans";
|
||||||
static String demoFunc = "/demo/func";
|
static String demoFunc = "/demo/func";
|
||||||
static String deepLink = "/message";
|
static String deepLink = "/message";
|
||||||
|
|
||||||
static void configureRoutes(Router router) {
|
static void configureRoutes(Router router) {
|
||||||
router.notFoundHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
router.notFoundHandler = Handler(
|
||||||
|
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||||
print("ROUTE WAS NOT FOUND !!!");
|
print("ROUTE WAS NOT FOUND !!!");
|
||||||
});
|
});
|
||||||
router.define(root, handler: rootHandler);
|
router.define(root, handler: rootHandler);
|
||||||
router.define(demoSimple, handler: demoRouteHandler);
|
router.define(demoSimple, handler: demoRouteHandler);
|
||||||
|
router.define(demoSimpleFixedTrans,
|
||||||
|
handler: demoRouteHandler, transitionType: TransitionType.inFromLeft);
|
||||||
router.define(demoFunc, handler: demoFunctionHandler);
|
router.define(demoFunc, handler: demoFunctionHandler);
|
||||||
router.define(deepLink, handler: deepLinkHandler);
|
router.define(deepLink, handler: deepLinkHandler);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -14,7 +15,6 @@ enum ContrastPreference {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ColorHelpers {
|
class ColorHelpers {
|
||||||
|
|
||||||
static int fromHexString(String argbHexString) {
|
static int fromHexString(String argbHexString) {
|
||||||
String useString = argbHexString;
|
String useString = argbHexString;
|
||||||
if (useString.startsWith("#")) {
|
if (useString.startsWith("#")) {
|
||||||
|
@ -36,16 +36,22 @@ class ColorHelpers {
|
||||||
/// or lighter. If darker, will return white. If lighter, will return
|
/// or lighter. If darker, will return white. If lighter, will return
|
||||||
/// black. If the color is within 35-65% of the spectrum and a prefer
|
/// black. If the color is within 35-65% of the spectrum and a prefer
|
||||||
/// value is specified, then white or black will be preferred.
|
/// value is specified, then white or black will be preferred.
|
||||||
static Color blackOrWhiteContrastColor(Color sourceColor, {ContrastPreference prefer = ContrastPreference.none}) {
|
static Color blackOrWhiteContrastColor(Color sourceColor,
|
||||||
|
{ContrastPreference prefer = ContrastPreference.none}) {
|
||||||
// Will return a value between 0.0 (black) and 1.0 (white)
|
// Will return a value between 0.0 (black) and 1.0 (white)
|
||||||
double value = (((sourceColor.red * 299.0) + (sourceColor.green * 587.0) +
|
double value = (((sourceColor.red * 299.0) +
|
||||||
(sourceColor.blue * 114.0)) / 1000.0) / 255.0;
|
(sourceColor.green * 587.0) +
|
||||||
|
(sourceColor.blue * 114.0)) /
|
||||||
|
1000.0) /
|
||||||
|
255.0;
|
||||||
if (prefer != ContrastPreference.none) {
|
if (prefer != ContrastPreference.none) {
|
||||||
if (value >= _kMinContrastModifierRange && value <= _kMaxContrastModifierRange) {
|
if (value >= _kMinContrastModifierRange &&
|
||||||
return prefer == ContrastPreference.light ? new Color(0xFFFFFFFF) : new Color(0xFF000000);
|
value <= _kMaxContrastModifierRange) {
|
||||||
|
return prefer == ContrastPreference.light
|
||||||
|
? Color(0xFFFFFFFF)
|
||||||
|
: Color(0xFF000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value > 0.6 ? new Color(0xFF000000) : new Color(0xFFFFFFFF);
|
return value > 0.6 ? Color(0xFF000000) : Color(0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
import 'components/app/app_component.dart';
|
import 'components/app/app_component.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(new AppComponent());
|
runApp(AppComponent());
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,13 @@ flutter:
|
||||||
assets:
|
assets:
|
||||||
- assets/images/logo_fluro.png
|
- assets/images/logo_fluro.png
|
||||||
- assets/images/acc_boom.png
|
- assets/images/acc_boom.png
|
||||||
|
- assets/images/ic_result_hz.png
|
||||||
|
- assets/images/ic_function_hz.png
|
||||||
|
- assets/images/ic_transform_custom_hz.png
|
||||||
|
- assets/images/ic_transform_fade_in_hz.png
|
||||||
|
- assets/images/ic_transform_fade_out_hz.png
|
||||||
|
- assets/images/ic_transform_global_hz.png
|
||||||
|
- assets/images/ic_transform_native_hz.png
|
||||||
fonts:
|
fonts:
|
||||||
- family: Lazer84
|
- family: Lazer84
|
||||||
fonts:
|
fonts:
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
library fluro;
|
library fluro;
|
||||||
|
|
||||||
import 'dart:async';
|
export 'src/common.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
export 'src/router.dart';
|
||||||
import 'package:flutter/material.dart';
|
export 'src/tree.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
|
|
||||||
part 'src/common.dart';
|
|
||||||
part 'src/router.dart';
|
|
||||||
part 'src/tree.dart';
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
part of fluro;
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
enum HandlerType {
|
enum HandlerType {
|
||||||
|
@ -15,22 +17,39 @@ enum HandlerType {
|
||||||
|
|
||||||
///
|
///
|
||||||
class Handler {
|
class Handler {
|
||||||
Handler({this.type = HandlerType.route, this.handlerFunc});
|
const Handler({this.type = HandlerType.route, this.handlerFunc});
|
||||||
final HandlerType type;
|
final HandlerType type;
|
||||||
final HandlerFunc handlerFunc;
|
final HandlerFunc handlerFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
typedef Route<T> RouteCreator<T>(RouteSettings route, Map<String, List<String>> parameters);
|
typedef Route<T> RouteCreator<T>(
|
||||||
|
RouteSettings route, Map<String, List<String>> parameters);
|
||||||
|
|
||||||
///
|
///
|
||||||
typedef Widget HandlerFunc(BuildContext context, Map<String, List<String>> parameters);
|
typedef Widget HandlerFunc(
|
||||||
|
BuildContext context, Map<String, List<String>> parameters);
|
||||||
|
|
||||||
///
|
///
|
||||||
class AppRoute {
|
class AppRoute {
|
||||||
String route;
|
String route;
|
||||||
dynamic handler;
|
dynamic handler;
|
||||||
AppRoute(this.route, this.handler);
|
TransitionType transitionType;
|
||||||
|
AppRoute(this.route, this.handler, {this.transitionType});
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TransitionType {
|
||||||
|
native,
|
||||||
|
nativeModal,
|
||||||
|
inFromLeft,
|
||||||
|
inFromRight,
|
||||||
|
inFromBottom,
|
||||||
|
fadeIn,
|
||||||
|
custom, // if using custom then you must also provide a transition
|
||||||
|
material,
|
||||||
|
materialFullScreenDialog,
|
||||||
|
cupertino,
|
||||||
|
cupertinoFullScreenDialog,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RouteMatchType {
|
enum RouteMatchType {
|
||||||
|
@ -41,12 +60,22 @@ enum RouteMatchType {
|
||||||
|
|
||||||
///
|
///
|
||||||
class RouteMatch {
|
class RouteMatch {
|
||||||
RouteMatch({
|
RouteMatch(
|
||||||
this.matchType = RouteMatchType.noMatch,
|
{this.matchType = RouteMatchType.noMatch,
|
||||||
this.route,
|
this.route,
|
||||||
this.errorMessage = "Unable to match route. Please check the logs."
|
this.errorMessage = "Unable to match route. Please check the logs."});
|
||||||
});
|
|
||||||
final Route<dynamic> route;
|
final Route<dynamic> route;
|
||||||
final RouteMatchType matchType;
|
final RouteMatchType matchType;
|
||||||
final String errorMessage;
|
final String errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RouteNotFoundException implements Exception {
|
||||||
|
final String message;
|
||||||
|
final String path;
|
||||||
|
RouteNotFoundException(this.message, this.path);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return "No registered route was found to handle '$path'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,36 +1,35 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
part of fluro;
|
|
||||||
|
|
||||||
enum TransitionType {
|
import 'dart:async';
|
||||||
native,
|
|
||||||
nativeModal,
|
import 'package:fluro/fluro.dart';
|
||||||
inFromLeft,
|
import 'package:fluro/src/common.dart';
|
||||||
inFromRight,
|
import 'package:flutter/foundation.dart';
|
||||||
inFromBottom,
|
import 'package:flutter/cupertino.dart';
|
||||||
fadeIn,
|
import 'package:flutter/material.dart';
|
||||||
custom, // if using custom then you must also provide a transition
|
|
||||||
}
|
|
||||||
|
|
||||||
class Router {
|
class Router {
|
||||||
|
static final appRouter = Router();
|
||||||
static final appRouter = new Router();
|
|
||||||
|
|
||||||
/// The tree structure that stores the defined routes
|
/// The tree structure that stores the defined routes
|
||||||
final RouteTree _routeTree = new RouteTree();
|
final RouteTree _routeTree = RouteTree();
|
||||||
|
|
||||||
/// Generic handler for when a route has not been defined
|
/// Generic handler for when a route has not been defined
|
||||||
Handler notFoundHandler;
|
Handler notFoundHandler;
|
||||||
|
|
||||||
/// Creates a [PageRoute] definition for the passed [RouteHandler]. You can optionally provide a custom
|
/// Creates a [PageRoute] definition for the passed [RouteHandler]. You can optionally provide a default transition type.
|
||||||
/// transition builder for the route.
|
void define(String routePath,
|
||||||
void define(String routePath, {@required Handler handler}) {
|
{@required Handler handler, TransitionType transitionType}) {
|
||||||
_routeTree.addRoute(new AppRoute(routePath, handler));
|
_routeTree.addRoute(
|
||||||
|
AppRoute(routePath, handler, transitionType: transitionType),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds a defined [AppRoute] for the path value. If no [AppRoute] definition was found
|
/// Finds a defined [AppRoute] for the path value. If no [AppRoute] definition was found
|
||||||
|
@ -39,29 +38,42 @@ class Router {
|
||||||
return _routeTree.matchRoute(path);
|
return _routeTree.matchRoute(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pop(GlobalKey<NavigatorState> key) => key.currentState.pop();
|
||||||
|
|
||||||
///
|
///
|
||||||
Future navigateTo(BuildContext context, String path, {bool replace = false, TransitionType transition = TransitionType.native,
|
Future navigateTo(GlobalKey<NavigatorState> key, String path,
|
||||||
Duration transitionDuration = const Duration(milliseconds: 250),
|
{bool replace = false,
|
||||||
RouteTransitionsBuilder transitionBuilder})
|
bool clearStack = false,
|
||||||
{
|
TransitionType transition,
|
||||||
RouteMatch routeMatch = matchRoute(context, path, transitionType: transition,
|
Duration transitionDuration = const Duration(milliseconds: 250),
|
||||||
transitionsBuilder: transitionBuilder, transitionDuration: transitionDuration);
|
RouteTransitionsBuilder transitionBuilder}) {
|
||||||
|
RouteMatch routeMatch = matchRoute(key.currentContext, path,
|
||||||
|
transitionType: transition,
|
||||||
|
transitionsBuilder: transitionBuilder,
|
||||||
|
transitionDuration: transitionDuration);
|
||||||
Route<dynamic> route = routeMatch.route;
|
Route<dynamic> route = routeMatch.route;
|
||||||
Completer completer = new Completer();
|
Completer completer = Completer();
|
||||||
Future future = completer.future;
|
Future future = completer.future;
|
||||||
if (routeMatch.matchType == RouteMatchType.nonVisual) {
|
if (routeMatch.matchType == RouteMatchType.nonVisual) {
|
||||||
completer.complete("Non visual route type.");
|
completer.complete("Non visual route type.");
|
||||||
} else {
|
} else {
|
||||||
if (route == null && notFoundHandler != null) {
|
if (route == null && notFoundHandler != null) {
|
||||||
route = _notFoundRoute(context, path);
|
route = _notFoundRoute(path);
|
||||||
}
|
}
|
||||||
if (route != null) {
|
if (route != null) {
|
||||||
future = replace ? Navigator.pushReplacement(context, route) : Navigator.push(context, route);
|
if (clearStack) {
|
||||||
|
future =
|
||||||
|
key.currentState.pushAndRemoveUntil(route, (check) => false);
|
||||||
|
} else {
|
||||||
|
future = replace
|
||||||
|
? key.currentState.pushReplacement(route)
|
||||||
|
: key.currentState.push(route);
|
||||||
|
}
|
||||||
completer.complete();
|
completer.complete();
|
||||||
} else {
|
} else {
|
||||||
String error = "No registered route was found to handle '$path'.";
|
String error = "No registered route was found to handle '$path'.";
|
||||||
print(error);
|
print(error);
|
||||||
completer.completeError(error);
|
completer.completeError(RouteNotFoundException(error, path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,52 +81,96 @@ class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
Route<Null> _notFoundRoute(BuildContext context, String path) {
|
Route<Null> _notFoundRoute(String path) {
|
||||||
RouteCreator<Null> creator = (RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
RouteCreator<Null> creator =
|
||||||
return new MaterialPageRoute<Null>(settings: routeSettings, builder: (BuildContext context) {
|
(RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
||||||
return notFoundHandler.handlerFunc(context, parameters);
|
return MaterialPageRoute<Null>(
|
||||||
});
|
settings: routeSettings,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return notFoundHandler.handlerFunc(context, parameters);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return creator(new RouteSettings(name: path), null);
|
return creator(RouteSettings(name: path), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
RouteMatch matchRoute(BuildContext buildContext, String path, {RouteSettings routeSettings,
|
RouteMatch matchRoute(BuildContext buildContext, String path,
|
||||||
TransitionType transitionType, Duration transitionDuration = const Duration(milliseconds: 250),
|
{RouteSettings routeSettings,
|
||||||
RouteTransitionsBuilder transitionsBuilder})
|
TransitionType transitionType,
|
||||||
{
|
Duration transitionDuration = const Duration(milliseconds: 250),
|
||||||
|
RouteTransitionsBuilder transitionsBuilder}) {
|
||||||
RouteSettings settingsToUse = routeSettings;
|
RouteSettings settingsToUse = routeSettings;
|
||||||
if (routeSettings == null) {
|
if (routeSettings == null) {
|
||||||
settingsToUse = new RouteSettings(name: path);
|
settingsToUse = RouteSettings(name: path);
|
||||||
}
|
}
|
||||||
AppRouteMatch match = _routeTree.matchRoute(path);
|
AppRouteMatch match = _routeTree.matchRoute(path);
|
||||||
AppRoute route = match?.route;
|
AppRoute route = match?.route;
|
||||||
Handler handler = (route != null ? route.handler : notFoundHandler);
|
Handler handler = (route != null ? route.handler : notFoundHandler);
|
||||||
if (route == null && notFoundHandler == null) {
|
var transition = transitionType;
|
||||||
return new RouteMatch(matchType: RouteMatchType.noMatch, errorMessage: "No matching route was found");
|
if (transitionType == null) {
|
||||||
|
transition = route != null ? route.transitionType : TransitionType.native;
|
||||||
}
|
}
|
||||||
Map<String, List<String>> parameters = match?.parameters ?? <String, List<String>>{};
|
if (route == null && notFoundHandler == null) {
|
||||||
|
return RouteMatch(
|
||||||
|
matchType: RouteMatchType.noMatch,
|
||||||
|
errorMessage: "No matching route was found");
|
||||||
|
}
|
||||||
|
Map<String, List<String>> parameters =
|
||||||
|
match?.parameters ?? <String, List<String>>{};
|
||||||
if (handler.type == HandlerType.function) {
|
if (handler.type == HandlerType.function) {
|
||||||
handler.handlerFunc(buildContext, parameters);
|
handler.handlerFunc(buildContext, parameters);
|
||||||
return new RouteMatch(matchType: RouteMatchType.nonVisual);
|
return RouteMatch(matchType: RouteMatchType.nonVisual);
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteCreator creator = (RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
RouteCreator creator =
|
||||||
bool isNativeTransition = (transitionType == TransitionType.native || transitionType == TransitionType.nativeModal);
|
(RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
||||||
|
bool isNativeTransition = (transition == TransitionType.native ||
|
||||||
|
transition == TransitionType.nativeModal);
|
||||||
if (isNativeTransition) {
|
if (isNativeTransition) {
|
||||||
return new MaterialPageRoute<dynamic>(settings: routeSettings, fullscreenDialog: transitionType == TransitionType.nativeModal,
|
if (Theme.of(buildContext).platform == TargetPlatform.iOS) {
|
||||||
|
return CupertinoPageRoute<dynamic>(
|
||||||
|
settings: routeSettings,
|
||||||
|
fullscreenDialog: transition == TransitionType.nativeModal,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return handler.handlerFunc(context, parameters);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return MaterialPageRoute<dynamic>(
|
||||||
|
settings: routeSettings,
|
||||||
|
fullscreenDialog: transition == TransitionType.nativeModal,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return handler.handlerFunc(context, parameters);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (transition == TransitionType.material ||
|
||||||
|
transition == TransitionType.materialFullScreenDialog) {
|
||||||
|
return MaterialPageRoute<dynamic>(
|
||||||
|
settings: routeSettings,
|
||||||
|
fullscreenDialog:
|
||||||
|
transition == TransitionType.materialFullScreenDialog,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return handler.handlerFunc(context, parameters);
|
||||||
|
});
|
||||||
|
} else if (transition == TransitionType.cupertino ||
|
||||||
|
transition == TransitionType.cupertinoFullScreenDialog) {
|
||||||
|
return CupertinoPageRoute<dynamic>(
|
||||||
|
settings: routeSettings,
|
||||||
|
fullscreenDialog:
|
||||||
|
transition == TransitionType.cupertinoFullScreenDialog,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return handler.handlerFunc(context, parameters);
|
return handler.handlerFunc(context, parameters);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var routeTransitionsBuilder;
|
var routeTransitionsBuilder;
|
||||||
if (transitionType == TransitionType.custom) {
|
if (transition == TransitionType.custom) {
|
||||||
routeTransitionsBuilder = transitionsBuilder;
|
routeTransitionsBuilder = transitionsBuilder;
|
||||||
} else {
|
} else {
|
||||||
routeTransitionsBuilder = _standardTransitionsBuilder(transitionType);
|
routeTransitionsBuilder = _standardTransitionsBuilder(transition);
|
||||||
}
|
}
|
||||||
return new PageRouteBuilder<dynamic>(settings: routeSettings,
|
return PageRouteBuilder<dynamic>(
|
||||||
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
|
settings: routeSettings,
|
||||||
|
pageBuilder: (BuildContext context, Animation<double> animation,
|
||||||
|
Animation<double> secondaryAnimation) {
|
||||||
return handler.handlerFunc(context, parameters);
|
return handler.handlerFunc(context, parameters);
|
||||||
},
|
},
|
||||||
transitionDuration: transitionDuration,
|
transitionDuration: transitionDuration,
|
||||||
|
@ -122,16 +178,18 @@ class Router {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return new RouteMatch(
|
return RouteMatch(
|
||||||
matchType: RouteMatchType.visual,
|
matchType: RouteMatchType.visual,
|
||||||
route: creator(settingsToUse, parameters),
|
route: creator(settingsToUse, parameters),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteTransitionsBuilder _standardTransitionsBuilder(TransitionType transitionType) {
|
RouteTransitionsBuilder _standardTransitionsBuilder(
|
||||||
return (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
|
TransitionType transitionType) {
|
||||||
|
return (BuildContext context, Animation<double> animation,
|
||||||
|
Animation<double> secondaryAnimation, Widget child) {
|
||||||
if (transitionType == TransitionType.fadeIn) {
|
if (transitionType == TransitionType.fadeIn) {
|
||||||
return new FadeTransition(opacity: animation, child: child);
|
return FadeTransition(opacity: animation, child: child);
|
||||||
} else {
|
} else {
|
||||||
const Offset topLeft = const Offset(0.0, 0.0);
|
const Offset topLeft = const Offset(0.0, 0.0);
|
||||||
const Offset topRight = const Offset(1.0, 0.0);
|
const Offset topRight = const Offset(1.0, 0.0);
|
||||||
|
@ -146,8 +204,8 @@ class Router {
|
||||||
endOffset = topLeft;
|
endOffset = topLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SlideTransition(
|
return SlideTransition(
|
||||||
position: new Tween<Offset>(
|
position: Tween<Offset>(
|
||||||
begin: startOffset,
|
begin: startOffset,
|
||||||
end: endOffset,
|
end: endOffset,
|
||||||
).animate(animation),
|
).animate(animation),
|
||||||
|
@ -161,7 +219,8 @@ class Router {
|
||||||
/// if any defined handler is found. It can also be used with the [MaterialApp.onGenerateRoute]
|
/// if any defined handler is found. It can also be used with the [MaterialApp.onGenerateRoute]
|
||||||
/// property as callback to create routes that can be used with the [Navigator] class.
|
/// property as callback to create routes that can be used with the [Navigator] class.
|
||||||
Route<dynamic> generator(RouteSettings routeSettings) {
|
Route<dynamic> generator(RouteSettings routeSettings) {
|
||||||
RouteMatch match = matchRoute(null, routeSettings.name, routeSettings: routeSettings);
|
RouteMatch match =
|
||||||
|
matchRoute(null, routeSettings.name, routeSettings: routeSettings);
|
||||||
return match.route;
|
return match.route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
part of fluro;
|
|
||||||
|
import 'package:fluro/src/common.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
enum RouteTreeNodeType {
|
enum RouteTreeNodeType {
|
||||||
component,
|
component,
|
||||||
|
@ -39,8 +42,7 @@ class RouteTreeNodeMatch {
|
||||||
|
|
||||||
class RouteTreeNode {
|
class RouteTreeNode {
|
||||||
// constructors
|
// constructors
|
||||||
RouteTreeNode(this.part,
|
RouteTreeNode(this.part, this.type);
|
||||||
this.type);
|
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
String part;
|
String part;
|
||||||
|
@ -69,7 +71,7 @@ class RouteTree {
|
||||||
// could be affected
|
// could be affected
|
||||||
throw ("Default route was already defined");
|
throw ("Default route was already defined");
|
||||||
}
|
}
|
||||||
var node = new RouteTreeNode(path, RouteTreeNodeType.component);
|
var node = RouteTreeNode(path, RouteTreeNodeType.component);
|
||||||
node.routes = [route];
|
node.routes = [route];
|
||||||
_nodes.add(node);
|
_nodes.add(node);
|
||||||
_hasDefaultRoute = true;
|
_hasDefaultRoute = true;
|
||||||
|
@ -85,7 +87,7 @@ class RouteTree {
|
||||||
RouteTreeNode node = _nodeForComponent(component, parent);
|
RouteTreeNode node = _nodeForComponent(component, parent);
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
RouteTreeNodeType type = _typeForComponent(component);
|
RouteTreeNodeType type = _typeForComponent(component);
|
||||||
node = new RouteTreeNode(component, type);
|
node = RouteTreeNode(component, type);
|
||||||
node.parent = parent;
|
node.parent = parent;
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
_nodes.add(node);
|
_nodes.add(node);
|
||||||
|
@ -114,10 +116,12 @@ class RouteTree {
|
||||||
components = ["/"];
|
components = ["/"];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<RouteTreeNode, RouteTreeNodeMatch> nodeMatches = <RouteTreeNode, RouteTreeNodeMatch>{};
|
Map<RouteTreeNode, RouteTreeNodeMatch> nodeMatches =
|
||||||
|
<RouteTreeNode, RouteTreeNodeMatch>{};
|
||||||
List<RouteTreeNode> nodesToCheck = _nodes;
|
List<RouteTreeNode> nodesToCheck = _nodes;
|
||||||
for (String checkComponent in components) {
|
for (String checkComponent in components) {
|
||||||
Map<RouteTreeNode, RouteTreeNodeMatch> currentMatches = <RouteTreeNode, RouteTreeNodeMatch>{};
|
Map<RouteTreeNode, RouteTreeNodeMatch> currentMatches =
|
||||||
|
<RouteTreeNode, RouteTreeNodeMatch>{};
|
||||||
List<RouteTreeNode> nextNodes = <RouteTreeNode>[];
|
List<RouteTreeNode> nextNodes = <RouteTreeNode>[];
|
||||||
for (RouteTreeNode node in nodesToCheck) {
|
for (RouteTreeNode node in nodesToCheck) {
|
||||||
String pathPart = checkComponent;
|
String pathPart = checkComponent;
|
||||||
|
@ -130,7 +134,8 @@ class RouteTree {
|
||||||
bool isMatch = (node.part == pathPart || node.isParameter());
|
bool isMatch = (node.part == pathPart || node.isParameter());
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
RouteTreeNodeMatch parentMatch = nodeMatches[node.parent];
|
RouteTreeNodeMatch parentMatch = nodeMatches[node.parent];
|
||||||
RouteTreeNodeMatch match = new RouteTreeNodeMatch.fromMatch(parentMatch, node);
|
RouteTreeNodeMatch match =
|
||||||
|
RouteTreeNodeMatch.fromMatch(parentMatch, node);
|
||||||
if (node.isParameter()) {
|
if (node.isParameter()) {
|
||||||
String paramKey = node.part.substring(1);
|
String paramKey = node.part.substring(1);
|
||||||
match.parameters[paramKey] = [pathPart];
|
match.parameters[paramKey] = [pathPart];
|
||||||
|
@ -156,9 +161,11 @@ class RouteTree {
|
||||||
RouteTreeNodeMatch match = matches.first;
|
RouteTreeNodeMatch match = matches.first;
|
||||||
RouteTreeNode nodeToUse = match.node;
|
RouteTreeNode nodeToUse = match.node;
|
||||||
// print("using match: ${match}, ${nodeToUse?.part}, ${match?.parameters}");
|
// print("using match: ${match}, ${nodeToUse?.part}, ${match?.parameters}");
|
||||||
if (nodeToUse != null && nodeToUse.routes != null && nodeToUse.routes.length > 0) {
|
if (nodeToUse != null &&
|
||||||
|
nodeToUse.routes != null &&
|
||||||
|
nodeToUse.routes.length > 0) {
|
||||||
List<AppRoute> routes = nodeToUse.routes;
|
List<AppRoute> routes = nodeToUse.routes;
|
||||||
AppRouteMatch routeMatch = new AppRouteMatch(routes[0]);
|
AppRouteMatch routeMatch = AppRouteMatch(routes[0]);
|
||||||
routeMatch.parameters = match.parameters;
|
routeMatch.parameters = match.parameters;
|
||||||
return routeMatch;
|
return routeMatch;
|
||||||
}
|
}
|
||||||
|
@ -212,8 +219,8 @@ class RouteTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<String>> parseQueryString(String query) {
|
Map<String, List<String>> parseQueryString(String query) {
|
||||||
var search = new RegExp('([^&=]+)=?([^&]*)');
|
var search = RegExp('([^&=]+)=?([^&]*)');
|
||||||
var params = new Map<String, List<String>>();
|
var params = Map<String, List<String>>();
|
||||||
if (query.startsWith('?')) query = query.substring(1);
|
if (query.startsWith('?')) query = query.substring(1);
|
||||||
decode(String s) => Uri.decodeComponent(s.replaceAll('+', ' '));
|
decode(String s) => Uri.decodeComponent(s.replaceAll('+', ' '));
|
||||||
for (Match match in search.allMatches(query)) {
|
for (Match match in search.allMatches(query)) {
|
||||||
|
|
13
pubspec.yaml
|
@ -1,11 +1,13 @@
|
||||||
name: fluro
|
name: fluro
|
||||||
description: The brightest, hippest, coolest router for Flutter.
|
description: >
|
||||||
version: 1.3.1
|
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named
|
||||||
author: Posse Productions LLC <apps@goposse.com>
|
parameters and clear route definitions.
|
||||||
homepage: https://github.com/goposse/fluro
|
version: 1.6.3
|
||||||
|
homepage: https://github.com/theyakka/fluro
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=1.23.0 <2.0.0"
|
sdk: ">=2.6.0 <3.0.0"
|
||||||
|
flutter: ">=1.12.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
@ -14,6 +16,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
test: ^1.6.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: false
|
uses-material-design: false
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
git clone https://github.com/flutter/flutter.git -b alpha --depth 1
|
|
|
@ -1,62 +1,85 @@
|
||||||
/*
|
/*
|
||||||
* fluro
|
* fluro
|
||||||
* A Posse Production
|
* Created by Yakka
|
||||||
* http://goposse.com
|
* https://theyakka.com
|
||||||
* Copyright (c) 2018 Posse Productions LLC. All rights reserved.
|
*
|
||||||
|
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||||
* See LICENSE for distribution and usage details.
|
* See LICENSE for distribution and usage details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:fluro/fluro.dart';
|
import 'package:fluro/fluro.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
testWidgets("Router correctly parses named parameters",
|
||||||
testWidgets("Router correctly parses named parameters", (WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
String path = "/users/1234";
|
String path = "/users/1234";
|
||||||
String route = "/users/:id";
|
String route = "/users/:id";
|
||||||
Router router = new Router();
|
Router router = Router();
|
||||||
router.define(route, handler: null);
|
router.define(route, handler: null);
|
||||||
AppRouteMatch match = router.match(path);
|
AppRouteMatch match = router.match(path);
|
||||||
expect(match?.parameters, equals(<String, List<String>>{
|
expect(
|
||||||
"id" : ["1234"],
|
match?.parameters,
|
||||||
}));
|
equals(<String, List<String>>{
|
||||||
|
"id": ["1234"],
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets("Router correctly parses named parameters with query", (WidgetTester tester) async {
|
testWidgets("Router correctly parses named parameters with query",
|
||||||
|
(WidgetTester tester) async {
|
||||||
String path = "/users/1234?name=luke";
|
String path = "/users/1234?name=luke";
|
||||||
String route = "/users/:id";
|
String route = "/users/:id";
|
||||||
Router router = new Router();
|
Router router = Router();
|
||||||
router.define(route, handler: null);
|
router.define(route, handler: null);
|
||||||
AppRouteMatch match = router.match(path);
|
AppRouteMatch match = router.match(path);
|
||||||
expect(match?.parameters, equals(<String, List<String>>{
|
expect(
|
||||||
"id" : ["1234"],
|
match?.parameters,
|
||||||
"name" : ["luke"],
|
equals(<String, List<String>>{
|
||||||
}));
|
"id": ["1234"],
|
||||||
|
"name": ["luke"],
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets("Router correctly parses query parameters", (WidgetTester tester) async {
|
testWidgets("Router correctly parses query parameters",
|
||||||
|
(WidgetTester tester) async {
|
||||||
String path = "/users/create?name=luke&phrase=hello%20world&number=7";
|
String path = "/users/create?name=luke&phrase=hello%20world&number=7";
|
||||||
String route = "/users/create";
|
String route = "/users/create";
|
||||||
Router router = new Router();
|
Router router = Router();
|
||||||
router.define(route, handler: null);
|
router.define(route, handler: null);
|
||||||
AppRouteMatch match = router.match(path);
|
AppRouteMatch match = router.match(path);
|
||||||
expect(match?.parameters, equals(<String, List<String>>{
|
expect(
|
||||||
"name" : ["luke"],
|
match?.parameters,
|
||||||
"phrase" : ["hello world"],
|
equals(<String, List<String>>{
|
||||||
"number" : ["7"],
|
"name": ["luke"],
|
||||||
}));
|
"phrase": ["hello world"],
|
||||||
|
"number": ["7"],
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets("Router correctly parses array parameters", (WidgetTester tester) async {
|
testWidgets("Router correctly parses array parameters",
|
||||||
String path = "/users/create?name=luke&phrase=hello%20world&number=7&number=10&number=13";
|
(WidgetTester tester) async {
|
||||||
|
String path =
|
||||||
|
"/users/create?name=luke&phrase=hello%20world&number=7&number=10&number=13";
|
||||||
String route = "/users/create";
|
String route = "/users/create";
|
||||||
Router router = new Router();
|
Router router = Router();
|
||||||
router.define(route, handler: null);
|
router.define(route, handler: null);
|
||||||
AppRouteMatch match = router.match(path);
|
AppRouteMatch match = router.match(path);
|
||||||
expect(match?.parameters, equals(<String, List<String>>{
|
expect(
|
||||||
"name" : ["luke"],
|
match?.parameters,
|
||||||
"phrase" : ["hello world"],
|
equals(<String, List<String>>{
|
||||||
"number" : ["7", "10", "13"],
|
"name": ["luke"],
|
||||||
}));
|
"phrase": ["hello world"],
|
||||||
|
"number": ["7", "10", "13"],
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
testWidgets("Router correctly matches route and transition type",
|
||||||
}
|
(WidgetTester tester) async {
|
||||||
|
String path = "/users/1234";
|
||||||
|
String route = "/users/:id";
|
||||||
|
Router router = Router();
|
||||||
|
router.define(route,
|
||||||
|
handler: null, transitionType: TransitionType.inFromRight);
|
||||||
|
AppRouteMatch match = router.match(path);
|
||||||
|
expect(TransitionType.inFromRight, match.route.transitionType);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
$TRAVIS_BUILD_DIR/flutter/bin/flutter test --coverage
|