Compare commits

...

19 Commits

Author SHA1 Message Date
Michael Pfaff 9956b24eb2 Take GlobalKey<NavigatorState> instead of BuildContext 2020-04-24 14:16:22 -04:00
Michael Pfaff 45949890cc Make route handler constant 2020-04-20 16:59:39 -04:00
Michael Pfaff 8e99c535bd Remove file that should not be checked into version control 2020-04-20 16:59:23 -04:00
Luke 30ae4378df
Remove upper bounds on pubspec (#163)
* remove upper constraint for flutter environment
* update docs
Co-authored-by: Luke Pighetti <lukepighetti@gmail.com>
2020-04-07 10:46:20 -07:00
Luke Freeman 937afe9757 update docs 2020-03-28 14:37:43 -07:00
Luke Pighetti aca29a1e34
Allow Flutter <1.17.0 (#153)
- Support dev version
2020-03-22 14:56:55 -07:00
Luke Freeman 337d864b62 bump version 2020-03-08 19:54:50 -07:00
Luke Freeman 3a1a20e03b update CHANGLOG and README 2020-03-08 19:54:38 -07:00
Luke Freeman 53e1c97960 downgrade Flutter required version 2020-03-08 19:53:28 -07:00
Luke Freeman 16b09f760c bump version 2020-03-08 19:42:31 -07:00
Luke Freeman 624626c85d update README and CHANGELOG 2020-03-08 19:39:52 -07:00
Luke Freeman 2c06f63e19 bump to 1.6.0. fix compatibility issue 2020-02-10 17:28:31 -08:00
Luke Freeman 2676006fe3 update pubspec 2020-02-10 16:53:12 -08:00
Luke Freeman df3434d599 release prep 2020-02-10 16:51:30 -08:00
Luke Freeman fd792404d3 update podspec 2020-02-08 15:03:47 -08:00
Luke Freeman 827ecfcc65 update ios build artifacts 2020-02-08 15:03:22 -08:00
Yusuke Otsuka 5cce0a4db2
remove dart:io import (#132) 2020-02-08 08:36:48 -08:00
Luke Freeman 9a3ad8d03f fix example and migrate to androidx 2020-02-08 08:34:09 -08:00
Luke 1536372360 Update issue templates 2019-08-15 13:20:22 -07:00
20 changed files with 175 additions and 57 deletions

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -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.

View File

@ -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.

View File

@ -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!

3
.gitignore vendored
View File

@ -11,3 +11,6 @@ coverage
__temp_coverage*
.dart_tool/
build/
# iOS
**/flutter_export_environment.sh

View File

@ -1,3 +1,21 @@
# 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

View File

@ -3,10 +3,12 @@
The brightest, hippest, coolest router for Flutter.
[![Version](https://img.shields.io/badge/version-1.5.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/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.5.1"
fluro: "^1.6.3"
```
You can also reference the git repo directly if you want:

View File

@ -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'
@ -30,13 +29,13 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
// google
implementation "com.android.support:appcompat-v7:${versions.googleSupport}"
implementation "com.android.support:support-v13:${versions.googleSupport}"
implementation "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
androidTestImplementation "com.android.support:support-annotations:${versions.googleSupport}"
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation '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'
}

View File

@ -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")
}
}

View File

@ -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"
}
}

View File

@ -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'
]

View File

@ -1 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

View File

@ -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

View File

@ -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 */,

View File

@ -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 */

View File

@ -35,6 +35,7 @@ class AppComponentState extends State<AppComponent> {
primarySwatch: Colors.blue,
),
onGenerateRoute: Application.router.generator,
navigatorKey: Application.routerKey,
);
// print("initial route = ${app.initialRoute}");
return app;

View File

@ -232,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") {
@ -253,7 +253,7 @@ class HomeComponentState extends State<HomeComponent> {
);
};
Application.router.navigateTo(
context,
Application.routerKey,
"/demo?message=$message&color_hex=$hexCode",
transition: TransitionType.custom,
transitionBuilder: transition,
@ -261,10 +261,10 @@ class HomeComponentState extends State<HomeComponent> {
);
} else if (key == "fixed-trans") {
Application.router.navigateTo(
context, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b");
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");
}
}
}

View File

@ -7,7 +7,10 @@
* 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>();
}

View File

@ -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;
}

View File

@ -8,10 +8,10 @@
*/
import 'dart:async';
import 'dart:io';
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';
@ -38,16 +38,16 @@ 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,
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);
@ -58,16 +58,16 @@ class Router {
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 {
@ -81,7 +81,7 @@ 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 MaterialPageRoute<Null>(
@ -127,7 +127,7 @@ class Router {
bool isNativeTransition = (transition == TransitionType.native ||
transition == TransitionType.nativeModal);
if (isNativeTransition) {
if (Platform.isIOS) {
if (Theme.of(buildContext).platform == TargetPlatform.iOS) {
return CupertinoPageRoute<dynamic>(
settings: routeSettings,
fullscreenDialog: transition == TransitionType.nativeModal,

View File

@ -2,13 +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.5.1
author: Yakka, LLC <apps@theyakka.com>
version: 1.6.3
homepage: https://github.com/theyakka/fluro
environment:
sdk: ">=2.1.0 <3.0.0"
flutter: ">=1.2.0"
sdk: ">=2.6.0 <3.0.0"
flutter: ">=1.12.0"
dependencies:
flutter: