Compare commits
25 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 |
|
@ -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!
|
|
@ -10,3 +10,7 @@ pubspec.lock
|
|||
coverage
|
||||
__temp_coverage*
|
||||
.dart_tool/
|
||||
build/
|
||||
|
||||
# iOS
|
||||
**/flutter_export_environment.sh
|
||||
|
|
33
CHANGELOG.md
|
@ -1,3 +1,36 @@
|
|||
# 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
|
||||
|
||||
|
|
2
LICENSE
|
@ -3,7 +3,7 @@ Fluro
|
|||
Created by Yakka
|
||||
https://theyakka.com
|
||||
|
||||
Copyright (c) 2018 Yakka LLC.
|
||||
Copyright (c) 2019 Yakka LLC.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
The brightest, hippest, coolest router for Flutter.
|
||||
|
||||
[![Version](https://img.shields.io/badge/version-1.3.7-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/theyakka/fluro.svg?branch=master)](https://travis-ci.org/theyakka/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
|
||||
|
||||
- Simple route navigation
|
||||
|
@ -25,7 +27,7 @@ See CHANGELOG for all breaking (and non-breaking) changes.
|
|||
You should ensure that you add the router as a dependency in your flutter project.
|
||||
```yaml
|
||||
dependencies:
|
||||
fluro: "^1.3.7"
|
||||
fluro: "^1.6.3"
|
||||
```
|
||||
|
||||
You can also reference the git repo directly if you want:
|
||||
|
@ -59,6 +61,9 @@ var usersHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynam
|
|||
|
||||
void defineRoutes(Router router) {
|
||||
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);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "../config.gradle"
|
||||
apply from: "../flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion versions.targetSDK
|
||||
buildToolsVersion "${versions.buildTools}"
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion versions.minSDK
|
||||
targetSdkVersion versions.targetSDK
|
||||
applicationId "$appInfo.applicationID"
|
||||
versionCode appInfo.build
|
||||
versionName "${appInfo.version}"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
applicationId "app.yakka.fluroexample"
|
||||
versionCode 1
|
||||
versionName "1.6.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
|
@ -28,15 +27,15 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
// kotlin
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
|
||||
// google
|
||||
compile "com.android.support:appcompat-v7:${versions.googleSupport}"
|
||||
compile "com.android.support:support-v13:${versions.googleSupport}"
|
||||
compile "com.android.support:support-v4:${versions.googleSupport}"
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
// testing
|
||||
androidTestCompile "com.android.support:support-annotations:${versions.googleSupport}"
|
||||
androidTestCompile 'com.android.support.test:runner:1.0.1'
|
||||
androidTestCompile 'com.android.support.test:rules:1.0.1'
|
||||
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test:rules:1.2.0'
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.flutter.plugins.GeneratedPluginRegistrant
|
|||
|
||||
class MainActivity : FlutterActivity() {
|
||||
|
||||
private val LOG_TAG = "A:Main"
|
||||
private val logTag = "A:Main"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -17,16 +17,13 @@ class MainActivity : FlutterActivity() {
|
|||
checkForLinkEvent(intent)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
private fun checkForLinkEvent(intent: Intent) {
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
val path = intent.data.getQueryParameter("path")
|
||||
val text = intent.data.getQueryParameter("message") ?: "Why you don't enter text?"
|
||||
val data = intent.data
|
||||
if (intent.action == Intent.ACTION_VIEW && data != null) {
|
||||
val path = data.getQueryParameter("path")
|
||||
val text = data.getQueryParameter("message") ?: "Why you don't enter text?"
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
buildscript {
|
||||
ext.kotlin_version = '1.2.30'
|
||||
ext.kotlin_version = '1.3.61'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
ext.appInfo = [
|
||||
version: '1.3.0',
|
||||
version: '1.6.0',
|
||||
build: 1,
|
||||
applicationID: "com.goposse.fluro"
|
||||
]
|
||||
|
||||
ext.versions = [
|
||||
minSDK: 21,
|
||||
targetSDK: 27,
|
||||
buildTools: '27.0.3',
|
||||
kotlin: '1.2.30',
|
||||
targetSDK: 29,
|
||||
buildTools: '29.0.3',
|
||||
kotlin: '1.3.61',
|
||||
googleSupport: '27.1.0'
|
||||
]
|
|
@ -1 +1,4 @@
|
|||
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 */
|
||||
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 */; };
|
||||
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 */; };
|
||||
|
@ -40,7 +39,6 @@
|
|||
|
||||
/* Begin PBXFileReference section */
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -76,7 +74,6 @@
|
|||
children = (
|
||||
3B80C3931E831B6300D905FE /* App.framework */,
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
|
||||
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
|
@ -190,7 +187,6 @@
|
|||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
|
||||
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GeneratedPluginRegistrant : NSObject
|
||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
#endif /* GeneratedPluginRegistrant_h */
|
||||
|
|
|
@ -3,38 +3,41 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import '../../config/application.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../config/application.dart';
|
||||
import '../../config/routes.dart';
|
||||
|
||||
class AppComponent extends StatefulWidget {
|
||||
@override
|
||||
State createState() {
|
||||
return new AppComponentState();
|
||||
return AppComponentState();
|
||||
}
|
||||
}
|
||||
|
||||
class AppComponentState extends State<AppComponent> {
|
||||
AppComponentState() {
|
||||
final router = new Router();
|
||||
final router = Router();
|
||||
Routes.configureRoutes(router);
|
||||
Application.router = router;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final app = new MaterialApp(
|
||||
final app = MaterialApp(
|
||||
title: 'Fluro',
|
||||
theme: new ThemeData(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
onGenerateRoute: Application.router.generator,
|
||||
navigatorKey: Application.routerKey,
|
||||
);
|
||||
print("initial route = ${app.initialRoute}");
|
||||
// print("initial route = ${app.initialRoute}");
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -17,15 +17,16 @@ class DemoMessageComponent extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Material(
|
||||
return Material(
|
||||
color: this.color,
|
||||
child: new Center(
|
||||
child: new Text(
|
||||
message,
|
||||
style: new TextStyle(
|
||||
fontFamily: "Lazer84",
|
||||
child: Center(
|
||||
child: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
fontFamily: "Lazer84",
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DemoResultComponent extends StatefulWidget {
|
||||
@override
|
||||
_DemoResultComponentState createState() => new _DemoResultComponentState();
|
||||
_DemoResultComponentState createState() => _DemoResultComponentState();
|
||||
}
|
||||
|
||||
class _DemoResultComponentState extends State<DemoResultComponent> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container();
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import '../../helpers/color_helpers.dart';
|
||||
|
@ -24,32 +24,32 @@ class DemoSimpleComponent extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Material(
|
||||
return Material(
|
||||
color: color,
|
||||
child: new Column(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
new Image(
|
||||
image: new AssetImage("assets/images/acc_boom.png"),
|
||||
Image(
|
||||
image: AssetImage("assets/images/acc_boom.png"),
|
||||
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
||||
width: 260.0,
|
||||
),
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(left: 50.0, right: 50.0, top: 15.0),
|
||||
child: new Text(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 50.0, right: 50.0, top: 15.0),
|
||||
child: Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
||||
height: 2.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: 15.0),
|
||||
child: new ConstrainedBox(
|
||||
constraints: new BoxConstraints(minHeight: 42.0),
|
||||
child: new FlatButton(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 15.0),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(minHeight: 42.0),
|
||||
child: FlatButton(
|
||||
highlightColor:
|
||||
ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(17),
|
||||
splashColor:
|
||||
|
@ -61,9 +61,9 @@ class DemoSimpleComponent extends StatelessWidget {
|
|||
Navigator.pop(context, result);
|
||||
}
|
||||
},
|
||||
child: new Text(
|
||||
child: Text(
|
||||
"OK",
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
color: ColorHelpers.blackOrWhiteContrastColor(color),
|
||||
),
|
||||
|
|
|
@ -3,19 +3,21 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'dart:async';
|
||||
|
||||
import '../../config/application.dart';
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../config/application.dart';
|
||||
|
||||
class HomeComponent extends StatefulWidget {
|
||||
@override
|
||||
State createState() => new HomeComponentState();
|
||||
State createState() => HomeComponentState();
|
||||
}
|
||||
|
||||
class HomeComponentState extends State<HomeComponent> {
|
||||
|
@ -33,16 +35,16 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
];
|
||||
|
||||
Widget deepLinkWidget(BuildContext context) {
|
||||
return new Stack(
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
// copied widget
|
||||
new AnimatedOpacity(
|
||||
AnimatedOpacity(
|
||||
opacity: (_deepLinkOpacity - 1.0).abs(),
|
||||
duration: new Duration(milliseconds: 400),
|
||||
child: new Center(
|
||||
child: new Text(
|
||||
duration: Duration(milliseconds: 400),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"Copied to clipboard!",
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: const Color(0xFFFFFFFF),
|
||||
fontWeight: FontWeight.w500,
|
||||
|
@ -51,16 +53,16 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
),
|
||||
),
|
||||
// button widget
|
||||
new AnimatedOpacity(
|
||||
AnimatedOpacity(
|
||||
opacity: _deepLinkOpacity,
|
||||
duration: new Duration(milliseconds: 250),
|
||||
child: new Center(
|
||||
child: new FlatButton(
|
||||
duration: Duration(milliseconds: 250),
|
||||
child: Center(
|
||||
child: FlatButton(
|
||||
highlightColor: const Color(0x11FFFFFF),
|
||||
splashColor: const Color(0x22FFFFFF),
|
||||
onPressed: () {
|
||||
if (_deepLinkOpacity == 1.0) {
|
||||
new Timer(new Duration(milliseconds: 2000), () {
|
||||
Timer(Duration(milliseconds: 2000), () {
|
||||
setState(() {
|
||||
_deepLinkOpacity = 1.0;
|
||||
});
|
||||
|
@ -68,16 +70,16 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
setState(() {
|
||||
_deepLinkOpacity = 0.0;
|
||||
});
|
||||
final clipboardData = new ClipboardData(text: _deepLinkURL);
|
||||
final clipboardData = ClipboardData(text: _deepLinkURL);
|
||||
Clipboard.setData(clipboardData);
|
||||
}
|
||||
},
|
||||
child: new Padding(
|
||||
padding: new EdgeInsets.all(8.0),
|
||||
child: new Text(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"Click here to copy a deep link url to the clipboard",
|
||||
textAlign: TextAlign.center,
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: const Color(0xCCFFFFFF),
|
||||
),
|
||||
|
@ -93,52 +95,99 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var menuWidgets = <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(bottom: 35.0),
|
||||
child: new Image(
|
||||
image: new AssetImage("assets/images/logo_fluro.png"),
|
||||
width: 200.0),
|
||||
),
|
||||
menuButton(context, "Native Animation", "native"),
|
||||
menuButton(context, "Preset (In from Left)", "preset-from-left"),
|
||||
menuButton(context, "Preset (Fade In)", "preset-fade"),
|
||||
menuButton(context, "Custom Transition", "custom"),
|
||||
menuButton(context, "Navigator Result", "pop-result"),
|
||||
menuButton(context, "Function Call", "function-call"),
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: 65.0, left: 60.0, right: 60.0),
|
||||
child: new Center(
|
||||
child: new ConstrainedBox(
|
||||
constraints: new BoxConstraints.tightFor(height: 60.0),
|
||||
child: deepLinkWidget(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
menuButton(context, 'assets/images/ic_transform_native_hz.png',
|
||||
"Native Animation", "native"),
|
||||
menuButton(context, 'assets/images/ic_transform_fade_in_hz.png',
|
||||
"Preset (Fade In)", "preset-fade"),
|
||||
menuButton(context, 'assets/images/ic_transform_global_hz.png',
|
||||
"Preset (Global transition)", "fixed-trans"),
|
||||
menuButton(context, 'assets/images/ic_transform_custom_hz.png',
|
||||
"Custom Transition", "custom"),
|
||||
menuButton(context, 'assets/images/ic_result_hz.png', "Navigator Result",
|
||||
"pop-result"),
|
||||
menuButton(context, 'assets/images/ic_function_hz.png', "Function Call",
|
||||
"function-call"),
|
||||
];
|
||||
|
||||
return new Material(
|
||||
final size = MediaQuery.of(context).size;
|
||||
final childRatio = (size.width / size.height) * 2.5;
|
||||
|
||||
return Material(
|
||||
color: const Color(0xFF00D6F7),
|
||||
child: new Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: menuWidgets,
|
||||
child: SafeArea(
|
||||
top: true,
|
||||
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
|
||||
Widget menuButton(BuildContext context, String title, String key) {
|
||||
return new Padding(
|
||||
padding: new EdgeInsets.all(4.0),
|
||||
child: new ConstrainedBox(
|
||||
constraints: new BoxConstraints(minHeight: 42.0),
|
||||
child: new FlatButton(
|
||||
Widget menuButton(
|
||||
BuildContext context, String assetSrc, String title, String key) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: Container(
|
||||
height: 42.0,
|
||||
child: FlatButton(
|
||||
color: const Color(0x22FFFFFF),
|
||||
highlightColor: const Color(0x11FFFFFF),
|
||||
splashColor: const Color(0x22FFFFFF),
|
||||
child: new Text(
|
||||
title,
|
||||
style: new TextStyle(
|
||||
color: const Color(0xAA001133),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
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: () {
|
||||
tappedMenuButton(context, key);
|
||||
|
@ -154,7 +203,7 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
String hexCode = "#FFFFFF";
|
||||
String result;
|
||||
TransitionType transitionType = TransitionType.native;
|
||||
if (key != "custom" && key != "function-call") {
|
||||
if (key != "custom" && key != "function-call" && key != "fixed-trans") {
|
||||
if (key == "native") {
|
||||
hexCode = "#F76F00";
|
||||
message =
|
||||
|
@ -173,7 +222,7 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
hexCode = "#7d41f4";
|
||||
message =
|
||||
"When you close this screen you should see the current day of the week";
|
||||
result = "Today is ${_daysOfWeek[new DateTime.now().weekday - 1]}!";
|
||||
result = "Today is ${_daysOfWeek[DateTime.now().weekday - 1]}!";
|
||||
}
|
||||
|
||||
String route = "/demo?message=$message&color_hex=$hexCode";
|
||||
|
@ -183,10 +232,10 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
}
|
||||
|
||||
Application.router
|
||||
.navigateTo(context, route, transition: transitionType)
|
||||
.navigateTo(Application.routerKey, route, transition: transitionType)
|
||||
.then((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") {
|
||||
|
@ -195,24 +244,27 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
"This screen should have appeared with a crazy custom transition";
|
||||
var transition = (BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation, Widget child) {
|
||||
return new ScaleTransition(
|
||||
return ScaleTransition(
|
||||
scale: animation,
|
||||
child: new RotationTransition(
|
||||
child: RotationTransition(
|
||||
turns: animation,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
};
|
||||
Application.router.navigateTo(
|
||||
context,
|
||||
Application.routerKey,
|
||||
"/demo?message=$message&color_hex=$hexCode",
|
||||
transition: TransitionType.custom,
|
||||
transitionBuilder: transition,
|
||||
transitionDuration: const Duration(milliseconds: 600),
|
||||
);
|
||||
} else if (key == "fixed-trans") {
|
||||
Application.router.navigateTo(
|
||||
Application.routerKey, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b");
|
||||
} else {
|
||||
message = "You tapped the function button!";
|
||||
Application.router.navigateTo(context, "/demo/func?message=$message");
|
||||
Application.router.navigateTo(Application.routerKey, "/demo/func?message=$message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Application {
|
||||
static Router router;
|
||||
|
||||
static GlobalKey<NavigatorState> routerKey = GlobalKey<NavigatorState>();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import '../helpers/color_helpers.dart';
|
||||
|
@ -13,49 +13,48 @@ import 'package:flutter/painting.dart';
|
|||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
var rootHandler = new Handler(
|
||||
var rootHandler = Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return new HomeComponent();
|
||||
return HomeComponent();
|
||||
});
|
||||
|
||||
var demoRouteHandler = new Handler(
|
||||
var demoRouteHandler = Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
String message = params["message"]?.first;
|
||||
String colorHex = params["color_hex"]?.first;
|
||||
String result = params["result"]?.first;
|
||||
Color color = new Color(0xFFFFFFFF);
|
||||
Color color = Color(0xFFFFFFFF);
|
||||
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,
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
String message = params["message"]?.first;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return new AlertDialog(
|
||||
title: new Text(
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
"Hey Hey!",
|
||||
style: new TextStyle(
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF00D6F7),
|
||||
fontFamily: "Lazer84",
|
||||
fontSize: 22.0,
|
||||
),
|
||||
),
|
||||
content: new Text("$message"),
|
||||
content: Text("$message"),
|
||||
actions: <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(bottom: 8.0, right: 8.0),
|
||||
child: new FlatButton(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 8.0, right: 8.0),
|
||||
child: FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: new Text("OK"),
|
||||
child: Text("OK"),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -68,14 +67,14 @@ var demoFunctionHandler = new Handler(
|
|||
/// 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.theyakka.fluro`
|
||||
var deepLinkHandler = new Handler(
|
||||
var deepLinkHandler = Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
String colorHex = params["color_hex"]?.first;
|
||||
String result = params["result"]?.first;
|
||||
Color color = new Color(0xFFFFFFFF);
|
||||
Color color = Color(0xFFFFFFFF);
|
||||
if (colorHex != null && colorHex.length > 0) {
|
||||
color = new Color(ColorHelpers.fromHexString(colorHex));
|
||||
color = Color(ColorHelpers.fromHexString(colorHex));
|
||||
}
|
||||
return new DemoSimpleComponent(
|
||||
return DemoSimpleComponent(
|
||||
message: "DEEEEEP LINK!!!", color: color, result: result);
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'package:fluro/fluro.dart';
|
||||
|
@ -13,16 +13,19 @@ import './route_handlers.dart';
|
|||
class Routes {
|
||||
static String root = "/";
|
||||
static String demoSimple = "/demo";
|
||||
static String demoSimpleFixedTrans = "/demo/fixedtrans";
|
||||
static String demoFunc = "/demo/func";
|
||||
static String deepLink = "/message";
|
||||
|
||||
static void configureRoutes(Router router) {
|
||||
router.notFoundHandler = new Handler(
|
||||
router.notFoundHandler = Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
print("ROUTE WAS NOT FOUND !!!");
|
||||
});
|
||||
router.define(root, handler: rootHandler);
|
||||
router.define(demoSimple, handler: demoRouteHandler);
|
||||
router.define(demoSimpleFixedTrans,
|
||||
handler: demoRouteHandler, transitionType: TransitionType.inFromLeft);
|
||||
router.define(demoFunc, handler: demoFunctionHandler);
|
||||
router.define(deepLink, handler: deepLinkHandler);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -48,10 +48,10 @@ class ColorHelpers {
|
|||
if (value >= _kMinContrastModifierRange &&
|
||||
value <= _kMaxContrastModifierRange) {
|
||||
return prefer == ContrastPreference.light
|
||||
? new Color(0xFFFFFFFF)
|
||||
: new Color(0xFF000000);
|
||||
? Color(0xFFFFFFFF)
|
||||
: Color(0xFF000000);
|
||||
}
|
||||
}
|
||||
return value > 0.6 ? new Color(0xFF000000) : new Color(0xFFFFFFFF);
|
||||
return value > 0.6 ? Color(0xFF000000) : Color(0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'components/app/app_component.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(new AppComponent());
|
||||
runApp(AppComponent());
|
||||
}
|
||||
|
|
|
@ -11,6 +11,13 @@ flutter:
|
|||
assets:
|
||||
- assets/images/logo_fluro.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:
|
||||
- family: Lazer84
|
||||
fonts:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
library fluro;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
|
||||
|
@ -17,7 +17,7 @@ enum HandlerType {
|
|||
|
||||
///
|
||||
class Handler {
|
||||
Handler({this.type = HandlerType.route, this.handlerFunc});
|
||||
const Handler({this.type = HandlerType.route, this.handlerFunc});
|
||||
final HandlerType type;
|
||||
final HandlerFunc handlerFunc;
|
||||
}
|
||||
|
@ -34,7 +34,22 @@ typedef Widget HandlerFunc(
|
|||
class AppRoute {
|
||||
String route;
|
||||
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 {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
|
||||
|
@ -11,31 +11,25 @@ import 'dart:async';
|
|||
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:fluro/src/common.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum TransitionType {
|
||||
native,
|
||||
nativeModal,
|
||||
inFromLeft,
|
||||
inFromRight,
|
||||
inFromBottom,
|
||||
fadeIn,
|
||||
custom, // if using custom then you must also provide a transition
|
||||
}
|
||||
|
||||
class Router {
|
||||
static final appRouter = new Router();
|
||||
static final appRouter = Router();
|
||||
|
||||
/// 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
|
||||
Handler notFoundHandler;
|
||||
|
||||
/// Creates a [PageRoute] definition for the passed [RouteHandler]. You can optionally provide a custom
|
||||
/// transition builder for the route.
|
||||
void define(String routePath, {@required Handler handler}) {
|
||||
_routeTree.addRoute(new AppRoute(routePath, handler));
|
||||
/// Creates a [PageRoute] definition for the passed [RouteHandler]. You can optionally provide a default transition type.
|
||||
void define(String routePath,
|
||||
{@required Handler handler, TransitionType transitionType}) {
|
||||
_routeTree.addRoute(
|
||||
AppRoute(routePath, handler, transitionType: transitionType),
|
||||
);
|
||||
}
|
||||
|
||||
/// Finds a defined [AppRoute] for the path value. If no [AppRoute] definition was found
|
||||
|
@ -44,36 +38,36 @@ class Router {
|
|||
return _routeTree.matchRoute(path);
|
||||
}
|
||||
|
||||
bool pop(BuildContext context) => Navigator.pop(context);
|
||||
void pop(GlobalKey<NavigatorState> key) => key.currentState.pop();
|
||||
|
||||
///
|
||||
Future navigateTo(BuildContext context, String path,
|
||||
Future navigateTo(GlobalKey<NavigatorState> key, String path,
|
||||
{bool replace = false,
|
||||
bool clearStack = false,
|
||||
TransitionType transition = TransitionType.native,
|
||||
TransitionType transition,
|
||||
Duration transitionDuration = const Duration(milliseconds: 250),
|
||||
RouteTransitionsBuilder transitionBuilder}) {
|
||||
RouteMatch routeMatch = matchRoute(context, path,
|
||||
RouteMatch routeMatch = matchRoute(key.currentContext, path,
|
||||
transitionType: transition,
|
||||
transitionsBuilder: transitionBuilder,
|
||||
transitionDuration: transitionDuration);
|
||||
Route<dynamic> route = routeMatch.route;
|
||||
Completer completer = new Completer();
|
||||
Completer completer = Completer();
|
||||
Future future = completer.future;
|
||||
if (routeMatch.matchType == RouteMatchType.nonVisual) {
|
||||
completer.complete("Non visual route type.");
|
||||
} else {
|
||||
if (route == null && notFoundHandler != null) {
|
||||
route = _notFoundRoute(context, path);
|
||||
route = _notFoundRoute(path);
|
||||
}
|
||||
if (route != null) {
|
||||
if (clearStack) {
|
||||
future =
|
||||
Navigator.pushAndRemoveUntil(context, route, (check) => false);
|
||||
key.currentState.pushAndRemoveUntil(route, (check) => false);
|
||||
} else {
|
||||
future = replace
|
||||
? Navigator.pushReplacement(context, route)
|
||||
: Navigator.push(context, route);
|
||||
? key.currentState.pushReplacement(route)
|
||||
: key.currentState.push(route);
|
||||
}
|
||||
completer.complete();
|
||||
} else {
|
||||
|
@ -87,16 +81,16 @@ class Router {
|
|||
}
|
||||
|
||||
///
|
||||
Route<Null> _notFoundRoute(BuildContext context, String path) {
|
||||
Route<Null> _notFoundRoute(String path) {
|
||||
RouteCreator<Null> creator =
|
||||
(RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
||||
return new MaterialPageRoute<Null>(
|
||||
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);
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -107,13 +101,17 @@ class Router {
|
|||
RouteTransitionsBuilder transitionsBuilder}) {
|
||||
RouteSettings settingsToUse = routeSettings;
|
||||
if (routeSettings == null) {
|
||||
settingsToUse = new RouteSettings(name: path);
|
||||
settingsToUse = RouteSettings(name: path);
|
||||
}
|
||||
AppRouteMatch match = _routeTree.matchRoute(path);
|
||||
AppRoute route = match?.route;
|
||||
Handler handler = (route != null ? route.handler : notFoundHandler);
|
||||
var transition = transitionType;
|
||||
if (transitionType == null) {
|
||||
transition = route != null ? route.transitionType : TransitionType.native;
|
||||
}
|
||||
if (route == null && notFoundHandler == null) {
|
||||
return new RouteMatch(
|
||||
return RouteMatch(
|
||||
matchType: RouteMatchType.noMatch,
|
||||
errorMessage: "No matching route was found");
|
||||
}
|
||||
|
@ -121,28 +119,55 @@ class Router {
|
|||
match?.parameters ?? <String, List<String>>{};
|
||||
if (handler.type == HandlerType.function) {
|
||||
handler.handlerFunc(buildContext, parameters);
|
||||
return new RouteMatch(matchType: RouteMatchType.nonVisual);
|
||||
return RouteMatch(matchType: RouteMatchType.nonVisual);
|
||||
}
|
||||
|
||||
RouteCreator creator =
|
||||
(RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
||||
bool isNativeTransition = (transitionType == TransitionType.native ||
|
||||
transitionType == TransitionType.nativeModal);
|
||||
bool isNativeTransition = (transition == TransitionType.native ||
|
||||
transition == TransitionType.nativeModal);
|
||||
if (isNativeTransition) {
|
||||
return new MaterialPageRoute<dynamic>(
|
||||
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: transitionType == TransitionType.nativeModal,
|
||||
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) {
|
||||
return handler.handlerFunc(context, parameters);
|
||||
});
|
||||
} else {
|
||||
var routeTransitionsBuilder;
|
||||
if (transitionType == TransitionType.custom) {
|
||||
if (transition == TransitionType.custom) {
|
||||
routeTransitionsBuilder = transitionsBuilder;
|
||||
} else {
|
||||
routeTransitionsBuilder = _standardTransitionsBuilder(transitionType);
|
||||
routeTransitionsBuilder = _standardTransitionsBuilder(transition);
|
||||
}
|
||||
return new PageRouteBuilder<dynamic>(
|
||||
return PageRouteBuilder<dynamic>(
|
||||
settings: routeSettings,
|
||||
pageBuilder: (BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
|
@ -153,7 +178,7 @@ class Router {
|
|||
);
|
||||
}
|
||||
};
|
||||
return new RouteMatch(
|
||||
return RouteMatch(
|
||||
matchType: RouteMatchType.visual,
|
||||
route: creator(settingsToUse, parameters),
|
||||
);
|
||||
|
@ -164,7 +189,7 @@ class Router {
|
|||
return (BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation, Widget child) {
|
||||
if (transitionType == TransitionType.fadeIn) {
|
||||
return new FadeTransition(opacity: animation, child: child);
|
||||
return FadeTransition(opacity: animation, child: child);
|
||||
} else {
|
||||
const Offset topLeft = const Offset(0.0, 0.0);
|
||||
const Offset topRight = const Offset(1.0, 0.0);
|
||||
|
@ -179,8 +204,8 @@ class Router {
|
|||
endOffset = topLeft;
|
||||
}
|
||||
|
||||
return new SlideTransition(
|
||||
position: new Tween<Offset>(
|
||||
return SlideTransition(
|
||||
position: Tween<Offset>(
|
||||
begin: startOffset,
|
||||
end: endOffset,
|
||||
).animate(animation),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
|
||||
|
@ -71,7 +71,7 @@ class RouteTree {
|
|||
// could be affected
|
||||
throw ("Default route was already defined");
|
||||
}
|
||||
var node = new RouteTreeNode(path, RouteTreeNodeType.component);
|
||||
var node = RouteTreeNode(path, RouteTreeNodeType.component);
|
||||
node.routes = [route];
|
||||
_nodes.add(node);
|
||||
_hasDefaultRoute = true;
|
||||
|
@ -87,7 +87,7 @@ class RouteTree {
|
|||
RouteTreeNode node = _nodeForComponent(component, parent);
|
||||
if (node == null) {
|
||||
RouteTreeNodeType type = _typeForComponent(component);
|
||||
node = new RouteTreeNode(component, type);
|
||||
node = RouteTreeNode(component, type);
|
||||
node.parent = parent;
|
||||
if (parent == null) {
|
||||
_nodes.add(node);
|
||||
|
@ -135,7 +135,7 @@ class RouteTree {
|
|||
if (isMatch) {
|
||||
RouteTreeNodeMatch parentMatch = nodeMatches[node.parent];
|
||||
RouteTreeNodeMatch match =
|
||||
new RouteTreeNodeMatch.fromMatch(parentMatch, node);
|
||||
RouteTreeNodeMatch.fromMatch(parentMatch, node);
|
||||
if (node.isParameter()) {
|
||||
String paramKey = node.part.substring(1);
|
||||
match.parameters[paramKey] = [pathPart];
|
||||
|
@ -165,7 +165,7 @@ class RouteTree {
|
|||
nodeToUse.routes != null &&
|
||||
nodeToUse.routes.length > 0) {
|
||||
List<AppRoute> routes = nodeToUse.routes;
|
||||
AppRouteMatch routeMatch = new AppRouteMatch(routes[0]);
|
||||
AppRouteMatch routeMatch = AppRouteMatch(routes[0]);
|
||||
routeMatch.parameters = match.parameters;
|
||||
return routeMatch;
|
||||
}
|
||||
|
@ -219,8 +219,8 @@ class RouteTree {
|
|||
}
|
||||
|
||||
Map<String, List<String>> parseQueryString(String query) {
|
||||
var search = new RegExp('([^&=]+)=?([^&]*)');
|
||||
var params = new Map<String, List<String>>();
|
||||
var search = RegExp('([^&=]+)=?([^&]*)');
|
||||
var params = Map<String, List<String>>();
|
||||
if (query.startsWith('?')) query = query.substring(1);
|
||||
decode(String s) => Uri.decodeComponent(s.replaceAll('+', ' '));
|
||||
for (Match match in search.allMatches(query)) {
|
||||
|
|
|
@ -2,12 +2,12 @@ name: fluro
|
|||
description: >
|
||||
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named
|
||||
parameters and clear route definitions.
|
||||
version: 1.3.7
|
||||
author: Yakka, LLC <flutter@theyakka.com>
|
||||
version: 1.6.3
|
||||
homepage: https://github.com/theyakka/fluro
|
||||
|
||||
environment:
|
||||
sdk: ">=2.0.0-dev.58.0 <3.0.0"
|
||||
sdk: ">=2.6.0 <3.0.0"
|
||||
flutter: ">=1.12.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
@ -16,7 +16,7 @@ dependencies:
|
|||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
test: "^1.3.3"
|
||||
test: ^1.6.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: false
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Created by Yakka
|
||||
* https://theyakka.com
|
||||
*
|
||||
* Copyright (c) 2018 Yakka, LLC. All rights reserved.
|
||||
* Copyright (c) 2019 Yakka, LLC. All rights reserved.
|
||||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
|
||||
|
@ -15,7 +15,7 @@ void main() {
|
|||
(WidgetTester tester) async {
|
||||
String path = "/users/1234";
|
||||
String route = "/users/:id";
|
||||
Router router = new Router();
|
||||
Router router = Router();
|
||||
router.define(route, handler: null);
|
||||
AppRouteMatch match = router.match(path);
|
||||
expect(
|
||||
|
@ -29,7 +29,7 @@ void main() {
|
|||
(WidgetTester tester) async {
|
||||
String path = "/users/1234?name=luke";
|
||||
String route = "/users/:id";
|
||||
Router router = new Router();
|
||||
Router router = Router();
|
||||
router.define(route, handler: null);
|
||||
AppRouteMatch match = router.match(path);
|
||||
expect(
|
||||
|
@ -44,7 +44,7 @@ void main() {
|
|||
(WidgetTester tester) async {
|
||||
String path = "/users/create?name=luke&phrase=hello%20world&number=7";
|
||||
String route = "/users/create";
|
||||
Router router = new Router();
|
||||
Router router = Router();
|
||||
router.define(route, handler: null);
|
||||
AppRouteMatch match = router.match(path);
|
||||
expect(
|
||||
|
@ -61,7 +61,7 @@ void main() {
|
|||
String path =
|
||||
"/users/create?name=luke&phrase=hello%20world&number=7&number=10&number=13";
|
||||
String route = "/users/create";
|
||||
Router router = new Router();
|
||||
Router router = Router();
|
||||
router.define(route, handler: null);
|
||||
AppRouteMatch match = router.match(path);
|
||||
expect(
|
||||
|
@ -72,4 +72,14 @@ void main() {
|
|||
"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);
|
||||
});
|
||||
}
|
||||
|
|