forked from inex/swipe_to_action
Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
Inex Code | 24526a17d9 | ||
Inex Code | 157ad067eb | ||
Inex Code | 606f5a9015 | ||
Inex Code | 04793a588f | ||
Inex Code | e567c39d20 | ||
Inex Code | 0a23e36821 | ||
EpicKiwi | b1f20c8b5c | ||
Inex Code | 631b9b999d | ||
EpicKiwi | 73cf87b2b5 | ||
EpicKiwi | 3ae1548ba0 | ||
Inex Code | 976427f9df |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
||||||
.pub/
|
.pub/
|
||||||
|
|
||||||
build/
|
build/
|
||||||
|
.idea/
|
|
@ -1,19 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Dart SDK">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/async" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/collection" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/convert" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/core" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/developer" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/html" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/io" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/isolate" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/math" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/mirrors" />
|
|
||||||
<root url="file:///home/inex/flutter/bin/cache/dart-sdk/lib/typed_data" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/swipe_to_action.iml" filepath="$PROJECT_DIR$/swipe_to_action.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/android/swipe_to_action_android.iml" filepath="$PROJECT_DIR$/android/swipe_to_action_android.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/example/android/swipe_to_action_example_android.iml" filepath="$PROJECT_DIR$/example/android/swipe_to_action_example_android.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="example/lib/main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
|
||||||
<option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -1,45 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="FileEditorManager">
|
|
||||||
<leaf>
|
|
||||||
<file leaf-file-name="swipe_to_action.dart" pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/swipe_to_action.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
|
||||||
</component>
|
|
||||||
<component name="ToolWindowManager">
|
|
||||||
<editor active="true" />
|
|
||||||
<layout>
|
|
||||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
|
||||||
</layout>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectView">
|
|
||||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
|
||||||
</navigator>
|
|
||||||
<panes>
|
|
||||||
<pane id="ProjectPane">
|
|
||||||
<option name="show-excluded-files" value="false" />
|
|
||||||
</pane>
|
|
||||||
</panes>
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">
|
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
||||||
<property name="dart.analysis.tool.window.force.activate" value="true" />
|
|
||||||
<property name="show.migrate.to.gradle.popup" value="false" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
## 0.3.0
|
||||||
|
|
||||||
|
* Ignore swipe when it starts in system gesture insets by [EpicKiwi](https://github.com/EpicKiwi)
|
||||||
|
|
||||||
|
## 0.2.0
|
||||||
|
|
||||||
|
* Null-safety migration by [devcat37](https://github.com/devcat37)
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
* Initial release.
|
* Initial release.
|
||||||
|
|
70
analysis_options.yaml
Normal file
70
analysis_options.yaml
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# This file configures the analyzer, which statically analyzes Dart code to
|
||||||
|
# check for errors, warnings, and lints.
|
||||||
|
#
|
||||||
|
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||||
|
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||||
|
# invoked from the command line by running `flutter analyze`.
|
||||||
|
|
||||||
|
# The following line activates a set of recommended lints for Flutter apps,
|
||||||
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
linter:
|
||||||
|
# The lint rules applied to this project can be customized in the
|
||||||
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
|
# included above or to enable additional rules. A list of all available lints
|
||||||
|
# and their documentation is published at
|
||||||
|
# https://dart-lang.github.io/linter/lints/index.html.
|
||||||
|
#
|
||||||
|
# Instead of disabling a lint rule for the entire project in the
|
||||||
|
# section below, it can also be suppressed for a single line of code
|
||||||
|
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||||
|
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||||
|
# producing the lint.
|
||||||
|
rules:
|
||||||
|
avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||||
|
always_declare_return_types: true
|
||||||
|
always_put_control_body_on_new_line: true
|
||||||
|
always_put_required_named_parameters_first: true
|
||||||
|
always_use_package_imports: true
|
||||||
|
avoid_escaping_inner_quotes: true
|
||||||
|
avoid_setters_without_getters: true
|
||||||
|
collection_methods_unrelated_type: true
|
||||||
|
combinators_ordering: true
|
||||||
|
directives_ordering: true
|
||||||
|
eol_at_end_of_file: true
|
||||||
|
no_adjacent_strings_in_list: true
|
||||||
|
prefer_constructors_over_static_methods: true
|
||||||
|
prefer_expression_function_bodies: true
|
||||||
|
prefer_final_in_for_each: true
|
||||||
|
prefer_final_locals: true
|
||||||
|
prefer_final_parameters: true
|
||||||
|
prefer_foreach: true
|
||||||
|
prefer_if_elements_to_conditional_expressions: true
|
||||||
|
prefer_mixin: true
|
||||||
|
prefer_null_aware_method_calls: true
|
||||||
|
prefer_single_quotes: true
|
||||||
|
require_trailing_commas: true
|
||||||
|
sized_box_shrink_expand: true
|
||||||
|
sort_constructors_first: true
|
||||||
|
unawaited_futures: true
|
||||||
|
unnecessary_await_in_return: true
|
||||||
|
unnecessary_null_aware_operator_on_extension_on_nullable: true
|
||||||
|
unnecessary_null_checks: true
|
||||||
|
unnecessary_parenthesis: true
|
||||||
|
unnecessary_statements: true
|
||||||
|
unnecessary_to_list_in_spreads: true
|
||||||
|
unreachable_from_main: true
|
||||||
|
use_enums: true
|
||||||
|
use_if_null_to_convert_nulls_to_bools: true
|
||||||
|
use_is_even_rather_than_modulo: true
|
||||||
|
use_late_for_private_fields_and_variables: true
|
||||||
|
use_named_constants: true
|
||||||
|
use_setters_to_change_properties: true
|
||||||
|
use_string_buffers: true
|
||||||
|
use_string_in_part_of_directives: true
|
||||||
|
use_super_parameters: true
|
||||||
|
use_to_and_as_if_applicable: true
|
||||||
|
|
||||||
|
# Additional information about this file can be found at
|
||||||
|
# https://dart.dev/guides/language/analysis-options
|
|
@ -1,3 +1,9 @@
|
||||||
|
plugins {
|
||||||
|
id "com.android.application"
|
||||||
|
id "kotlin-android"
|
||||||
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
|
}
|
||||||
|
|
||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
if (localPropertiesFile.exists()) {
|
if (localPropertiesFile.exists()) {
|
||||||
|
@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
||||||
if (flutterRoot == null) {
|
|
||||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
||||||
}
|
|
||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = '1'
|
flutterVersionCode = '1'
|
||||||
|
@ -21,12 +22,9 @@ if (flutterVersionName == null) {
|
||||||
flutterVersionName = '1.0'
|
flutterVersionName = '1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
namespace 'dev.inex.swipe_to_action_example'
|
||||||
|
compileSdkVersion 34
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
@ -36,10 +34,19 @@ android {
|
||||||
disable 'InvalidPackage'
|
disable 'InvalidPackage'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "17"
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "dev.inex.swipe_to_action_example"
|
applicationId "dev.inex.swipe_to_action_example"
|
||||||
minSdkVersion 16
|
minSdkVersion flutter.minSdkVersion
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
@ -57,7 +64,3 @@ android {
|
||||||
flutter {
|
flutter {
|
||||||
source '../..'
|
source '../..'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,16 +1,3 @@
|
||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.3.50'
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
@ -18,6 +5,7 @@ allprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rootProject.buildDir = '../build'
|
rootProject.buildDir = '../build'
|
||||||
subprojects {
|
subprojects {
|
||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
|
@ -26,6 +14,6 @@ subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
include ':app'
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
|
||||||
def properties = new Properties()
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
assert localPropertiesFile.exists()
|
|
||||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
|
||||||
|
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
|
id "com.android.application" version "8.3.1" apply false
|
||||||
|
id "org.jetbrains.kotlin.android" version "1.9.21" apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
|
|
|
@ -2,20 +2,21 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:swipe_to_action/swipe_to_action.dart';
|
import 'package:swipe_to_action/swipe_to_action.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
|
const MyApp({final Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyAppState createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MyAppState extends State<MyApp> {
|
class _MyAppState extends State<MyApp> {
|
||||||
String _text = "Swipe some tiles!";
|
String _text = 'Swipe some tiles!';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(final BuildContext context) => MaterialApp(
|
||||||
return MaterialApp(
|
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Plugin example app'),
|
title: const Text('Plugin example app'),
|
||||||
|
@ -23,49 +24,47 @@ class _MyAppState extends State<MyApp> {
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
Swipeable(
|
Swipeable(
|
||||||
key: ValueKey(1),
|
key: const ValueKey(1),
|
||||||
onSwipe: (direction) {
|
onSwipe: (final direction) {
|
||||||
if (direction == SwipeDirection.startToEnd) {
|
if (direction == SwipeDirection.startToEnd) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_text = "Swiped to right!";
|
_text = 'Swiped to right!';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_text = "Swiped to left!";
|
_text = 'Swiped to left!';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: ListTile(
|
child: const ListTile(
|
||||||
title: Text("Tile one"),
|
title: Text('Tile one'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Swipeable(
|
Swipeable(
|
||||||
key: ValueKey(2),
|
key: const ValueKey(2),
|
||||||
onSwipe: (direction) {
|
onSwipe: (final direction) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_text = "This one can only be swiped to right!";
|
_text = 'This one can only be swiped to right!';
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
background: Container(color: Colors.orange),
|
background: Container(color: Colors.orange),
|
||||||
direction: SwipeDirection.startToEnd,
|
direction: SwipeDirection.startToEnd,
|
||||||
child: ListTile(
|
child: const ListTile(
|
||||||
title: Text("Tile one"),
|
title: Text('Tile one'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Swipeable(
|
Swipeable(
|
||||||
key: ValueKey(3),
|
key: const ValueKey(3),
|
||||||
onSwipe: (direction) {
|
onSwipe: (final direction) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_text = "This one was confirmed with a function!";
|
_text = 'This one was confirmed with a function!';
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
background: Container(color: Colors.green),
|
background: Container(color: Colors.green),
|
||||||
secondaryBackground: Container(color: Colors.teal),
|
secondaryBackground: Container(color: Colors.teal),
|
||||||
confirmSwipe: (direction) async {
|
confirmSwipe: (final direction) async => true,
|
||||||
return true;
|
child: const ListTile(
|
||||||
},
|
title: Text('Tile three'),
|
||||||
child: ListTile(
|
|
||||||
title: Text("Tile three"),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(child: Text(_text)),
|
Center(child: Text(_text)),
|
||||||
|
@ -74,4 +73,3 @@ class _MyAppState extends State<MyApp> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Generated file. Do not edit.
|
// Generated file. Do not edit.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Generated file. Do not edit.
|
// Generated file. Do not edit.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||||
#define GENERATED_PLUGIN_REGISTRANT_
|
#define GENERATED_PLUGIN_REGISTRANT_
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
)
|
)
|
||||||
|
|
||||||
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
)
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|
||||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||||
|
@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||||
endforeach(plugin)
|
endforeach(plugin)
|
||||||
|
|
||||||
|
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||||
|
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
||||||
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||||
|
endforeach(ffi_plugin)
|
||||||
|
|
|
@ -5,58 +5,58 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.0"
|
version: "2.11.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.3.0"
|
||||||
charcode:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: charcode
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.0"
|
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: clock
|
name: clock
|
||||||
url: "https://pub.dartlang.org"
|
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.1"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.18.0"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: cupertino_icons
|
name: cupertino_icons
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.0.8"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.1"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -72,34 +72,62 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
js:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: leak_tracker
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.3"
|
version: "10.0.5"
|
||||||
|
leak_tracker_flutter_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_flutter_testing
|
||||||
|
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.5"
|
||||||
|
leak_tracker_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_testing
|
||||||
|
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.1"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.10"
|
version: "0.12.16+1"
|
||||||
|
material_color_utilities:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: material_color_utilities
|
||||||
|
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.11.1"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.15.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.9.0"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -109,65 +137,73 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.10.0"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.11.1"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.2"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.2.0"
|
||||||
swipe_to_action:
|
swipe_to_action:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.1.0"
|
version: "0.3.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: term_glyph
|
name: term_glyph
|
||||||
url: "https://pub.dartlang.org"
|
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.1"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.19"
|
version: "0.7.2"
|
||||||
typed_data:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: typed_data
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.3.0"
|
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.4"
|
||||||
|
vm_service:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vm_service
|
||||||
|
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "14.2.4"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.12.0 <3.0.0"
|
dart: ">=3.3.0 <4.0.0"
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=3.18.0-18.0.pre.54"
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Swipeable extends StatefulWidget {
|
||||||
/// state of the dismissed item. Using keys causes the widgets to sync
|
/// state of the dismissed item. Using keys causes the widgets to sync
|
||||||
/// according to their keys and avoids this pitfall.
|
/// according to their keys and avoids this pitfall.
|
||||||
const Swipeable({
|
const Swipeable({
|
||||||
required Key key,
|
required final Key key,
|
||||||
required this.child,
|
required this.child,
|
||||||
required this.onSwipe,
|
required this.onSwipe,
|
||||||
this.background,
|
this.background,
|
||||||
|
@ -61,7 +61,7 @@ class Swipeable extends StatefulWidget {
|
||||||
this.allowedPointerKinds = const {
|
this.allowedPointerKinds = const {
|
||||||
PointerDeviceKind.invertedStylus,
|
PointerDeviceKind.invertedStylus,
|
||||||
PointerDeviceKind.stylus,
|
PointerDeviceKind.stylus,
|
||||||
PointerDeviceKind.touch
|
PointerDeviceKind.touch,
|
||||||
},
|
},
|
||||||
}) : assert(secondaryBackground == null || background != null),
|
}) : assert(secondaryBackground == null || background != null),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
@ -155,7 +155,7 @@ class Swipeable extends StatefulWidget {
|
||||||
final DragStartBehavior dragStartBehavior;
|
final DragStartBehavior dragStartBehavior;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_SwipeableState createState() => _SwipeableState();
|
State<Swipeable> createState() => _SwipeableState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SwipeableClipper extends CustomClipper<Rect> {
|
class _SwipeableClipper extends CustomClipper<Rect> {
|
||||||
|
@ -166,7 +166,7 @@ class _SwipeableClipper extends CustomClipper<Rect> {
|
||||||
final Animation<Offset> moveAnimation;
|
final Animation<Offset> moveAnimation;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Rect getClip(Size size) {
|
Rect getClip(final Size size) {
|
||||||
final offset = moveAnimation.value.dx * size.width;
|
final offset = moveAnimation.value.dx * size.width;
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
return Rect.fromLTRB(size.width + offset, 0.0, size.width, size.height);
|
return Rect.fromLTRB(size.width + offset, 0.0, size.width, size.height);
|
||||||
|
@ -175,20 +175,21 @@ class _SwipeableClipper extends CustomClipper<Rect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Rect getApproximateClipRect(Size size) => getClip(size);
|
Rect getApproximateClipRect(final Size size) => getClip(size);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldReclip(_SwipeableClipper oldClipper) {
|
bool shouldReclip(final _SwipeableClipper oldClipper) =>
|
||||||
return oldClipper.moveAnimation.value != moveAnimation.value;
|
oldClipper.moveAnimation.value != moveAnimation.value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum _FlingGestureKind { none, forward, reverse }
|
enum _FlingGestureKind { none, forward, reverse }
|
||||||
|
|
||||||
class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
class _SwipeableState extends State<Swipeable>
|
||||||
|
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_moveController = AnimationController(duration: widget.movementDuration, vsync: this)
|
_moveController =
|
||||||
|
AnimationController(duration: widget.movementDuration, vsync: this)
|
||||||
..addStatusListener(_handleDismissStatusChanged);
|
..addStatusListener(_handleDismissStatusChanged);
|
||||||
_updateMoveAnimation();
|
_updateMoveAnimation();
|
||||||
|
|
||||||
|
@ -204,6 +205,14 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
|
|
||||||
bool _isTouch = true;
|
bool _isTouch = true;
|
||||||
|
|
||||||
|
// Minimum global X where swipe is allowed to start
|
||||||
|
double? _minX;
|
||||||
|
// Maximum global X where swipe is allowed to start
|
||||||
|
double? _maxX;
|
||||||
|
// Screen width reference that helped to compute _minX and _maxX
|
||||||
|
// used to check if insets should be updated or not
|
||||||
|
double? _widthReference;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => _moveController.isAnimating == true;
|
bool get wantKeepAlive => _moveController.isAnimating == true;
|
||||||
|
|
||||||
|
@ -213,39 +222,56 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
SwipeDirection _extentToDirection(double extent) {
|
SwipeDirection _extentToDirection(final double extent) {
|
||||||
if (extent == 0.0) {
|
if (extent == 0.0) {
|
||||||
return SwipeDirection.none;
|
return SwipeDirection.none;
|
||||||
}
|
}
|
||||||
switch (Directionality.of(context)) {
|
switch (Directionality.of(context)) {
|
||||||
case TextDirection.rtl:
|
case TextDirection.rtl:
|
||||||
return extent < 0 ? SwipeDirection.startToEnd : SwipeDirection.endToStart;
|
return extent < 0
|
||||||
|
? SwipeDirection.startToEnd
|
||||||
|
: SwipeDirection.endToStart;
|
||||||
case TextDirection.ltr:
|
case TextDirection.ltr:
|
||||||
return extent > 0 ? SwipeDirection.startToEnd : SwipeDirection.endToStart;
|
return extent > 0
|
||||||
|
? SwipeDirection.startToEnd
|
||||||
|
: SwipeDirection.endToStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SwipeDirection get _swipeDirection => _extentToDirection(_dragExtent);
|
SwipeDirection get _swipeDirection => _extentToDirection(_dragExtent);
|
||||||
|
|
||||||
bool get _isActive {
|
bool get _isActive => _dragUnderway || _moveController.isAnimating;
|
||||||
return _dragUnderway || _moveController.isAnimating;
|
|
||||||
}
|
|
||||||
|
|
||||||
double get _overallDragAxisExtent {
|
double get _overallDragAxisExtent {
|
||||||
final size = context.size;
|
final size = context.size;
|
||||||
return size?.width ?? 0.0;
|
return size?.width ?? 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handlePointerDown(PointerDownEvent event) {
|
void _handlePointerDown(final PointerDownEvent event) {
|
||||||
|
final xPos = event.position.dx;
|
||||||
|
|
||||||
|
var validTouch = widget.allowedPointerKinds.contains(event.kind);
|
||||||
|
|
||||||
|
// Check if touch was performed after minX and before maxX to avoid system
|
||||||
|
// gesture insets
|
||||||
|
if (validTouch && _minX != null) {
|
||||||
|
validTouch = xPos > _minX!;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validTouch && _maxX != null) {
|
||||||
|
validTouch = xPos < _maxX!;
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_isTouch = widget.allowedPointerKinds.contains(event.kind);
|
_isTouch = validTouch;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleDragStart(DragStartDetails details) {
|
void _handleDragStart(final DragStartDetails details) {
|
||||||
_dragUnderway = true;
|
_dragUnderway = true;
|
||||||
if (_moveController.isAnimating) {
|
if (_moveController.isAnimating) {
|
||||||
_dragExtent = _moveController.value * _overallDragAxisExtent * _dragExtent.sign;
|
_dragExtent =
|
||||||
|
_moveController.value * _overallDragAxisExtent * _dragExtent.sign;
|
||||||
_moveController.stop();
|
_moveController.stop();
|
||||||
} else {
|
} else {
|
||||||
_dragExtent = 0.0;
|
_dragExtent = 0.0;
|
||||||
|
@ -256,7 +282,7 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleDragUpdate(DragUpdateDetails details) {
|
void _handleDragUpdate(final DragUpdateDetails details) {
|
||||||
if (!_isActive || _moveController.isAnimating) {
|
if (!_isActive || _moveController.isAnimating) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -321,7 +347,7 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_FlingGestureKind _describeFlingGesture(Velocity velocity) {
|
_FlingGestureKind _describeFlingGesture(final Velocity velocity) {
|
||||||
if (_dragExtent == 0.0) {
|
if (_dragExtent == 0.0) {
|
||||||
// If it was a fling, then it was a fling that was let loose at the exact
|
// If it was a fling, then it was a fling that was let loose at the exact
|
||||||
// middle of the range (i.e. when there's no displacement). In that case,
|
// middle of the range (i.e. when there's no displacement). In that case,
|
||||||
|
@ -334,7 +360,8 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
final vy = velocity.pixelsPerSecond.dy;
|
final vy = velocity.pixelsPerSecond.dy;
|
||||||
SwipeDirection flingDirection;
|
SwipeDirection flingDirection;
|
||||||
// Verify that the fling is in the generally right direction and fast enough.
|
// Verify that the fling is in the generally right direction and fast enough.
|
||||||
if (vx.abs() - vy.abs() < _kMinFlingVelocityDelta || vx.abs() < _kMinFlingVelocity) {
|
if (vx.abs() - vy.abs() < _kMinFlingVelocityDelta ||
|
||||||
|
vx.abs() < _kMinFlingVelocity) {
|
||||||
return _FlingGestureKind.none;
|
return _FlingGestureKind.none;
|
||||||
}
|
}
|
||||||
assert(vx != 0.0);
|
assert(vx != 0.0);
|
||||||
|
@ -346,12 +373,13 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
return _FlingGestureKind.reverse;
|
return _FlingGestureKind.reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleDragEnd(DragEndDetails details) async {
|
Future<void> _handleDragEnd(final DragEndDetails details) async {
|
||||||
if (!_isActive || _moveController.isAnimating) {
|
if (!_isActive || _moveController.isAnimating) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_dragUnderway = false;
|
_dragUnderway = false;
|
||||||
if (_moveController.isCompleted && await _confirmStartSwipeAnimation() == true) {
|
if (_moveController.isCompleted &&
|
||||||
|
await _confirmStartSwipeAnimation() == true) {
|
||||||
_startSwipeAnimation();
|
_startSwipeAnimation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -360,23 +388,30 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
case _FlingGestureKind.forward:
|
case _FlingGestureKind.forward:
|
||||||
assert(_dragExtent != 0.0);
|
assert(_dragExtent != 0.0);
|
||||||
assert(!_moveController.isDismissed);
|
assert(!_moveController.isDismissed);
|
||||||
if ((widget.dismissThresholds[_swipeDirection] ?? _kDismissThreshold) >= 1.0) {
|
if ((widget.dismissThresholds[_swipeDirection] ?? _kDismissThreshold) >=
|
||||||
|
1.0) {
|
||||||
await _moveController.reverse();
|
await _moveController.reverse();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_dragExtent = flingVelocity.sign;
|
_dragExtent = flingVelocity.sign;
|
||||||
await _moveController.fling(velocity: flingVelocity.abs() * _kFlingVelocityScale);
|
await _moveController.fling(
|
||||||
|
velocity: flingVelocity.abs() * _kFlingVelocityScale,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case _FlingGestureKind.reverse:
|
case _FlingGestureKind.reverse:
|
||||||
assert(_dragExtent != 0.0);
|
assert(_dragExtent != 0.0);
|
||||||
assert(!_moveController.isDismissed);
|
assert(!_moveController.isDismissed);
|
||||||
_dragExtent = flingVelocity.sign;
|
_dragExtent = flingVelocity.sign;
|
||||||
await _moveController.fling(velocity: -flingVelocity.abs() * _kFlingVelocityScale);
|
await _moveController.fling(
|
||||||
|
velocity: -flingVelocity.abs() * _kFlingVelocityScale,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case _FlingGestureKind.none:
|
case _FlingGestureKind.none:
|
||||||
if (!_moveController.isDismissed) {
|
if (!_moveController.isDismissed) {
|
||||||
// we already know it's not completed, we check that above
|
// we already know it's not completed, we check that above
|
||||||
if (_moveController.value > (widget.dismissThresholds[_swipeDirection] ?? _kDismissThreshold)) {
|
if (_moveController.value >
|
||||||
|
(widget.dismissThresholds[_swipeDirection] ??
|
||||||
|
_kDismissThreshold)) {
|
||||||
await _moveController.forward();
|
await _moveController.forward();
|
||||||
} else {
|
} else {
|
||||||
await _moveController.reverse();
|
await _moveController.reverse();
|
||||||
|
@ -386,7 +421,7 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleDismissStatusChanged(AnimationStatus status) async {
|
Future<void> _handleDismissStatusChanged(final AnimationStatus status) async {
|
||||||
if (status == AnimationStatus.completed && !_dragUnderway) {
|
if (status == AnimationStatus.completed && !_dragUnderway) {
|
||||||
if (await _confirmStartSwipeAnimation() == true) {
|
if (await _confirmStartSwipeAnimation() == true) {
|
||||||
_startSwipeAnimation();
|
_startSwipeAnimation();
|
||||||
|
@ -416,7 +451,7 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(final BuildContext context) {
|
||||||
super.build(context); // See AutomaticKeepAliveClientMixin.
|
super.build(context); // See AutomaticKeepAliveClientMixin.
|
||||||
|
|
||||||
assert(debugCheckHasDirectionality(context));
|
assert(debugCheckHasDirectionality(context));
|
||||||
|
@ -429,13 +464,30 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get system screen size and system gesture insets
|
||||||
|
// to avoid starting a swipe in this areas
|
||||||
|
final MediaQueryData? mediaQuery = MediaQuery.maybeOf(context);
|
||||||
|
if (mediaQuery != null) {
|
||||||
|
if (_widthReference == null || _widthReference != mediaQuery.size.width) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((final _) {
|
||||||
|
setState(() {
|
||||||
|
_widthReference = mediaQuery.size.width;
|
||||||
|
_minX = mediaQuery.systemGestureInsets.left;
|
||||||
|
_maxX =
|
||||||
|
mediaQuery.size.width - mediaQuery.systemGestureInsets.right;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget content = SlideTransition(
|
Widget content = SlideTransition(
|
||||||
position: _moveAnimation,
|
position: _moveAnimation,
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (background != null) {
|
if (background != null) {
|
||||||
content = Stack(children: <Widget>[
|
content = Stack(
|
||||||
|
children: <Widget>[
|
||||||
if (!_moveAnimation.isDismissed)
|
if (!_moveAnimation.isDismissed)
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: ClipRect(
|
child: ClipRect(
|
||||||
|
@ -446,7 +498,8 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
content,
|
content,
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// We are not swiping but we may be being dragging in widget.direction.
|
// We are not swiping but we may be being dragging in widget.direction.
|
||||||
return Listener(
|
return Listener(
|
||||||
|
@ -456,8 +509,8 @@ class _SwipeableState extends State<Swipeable> with TickerProviderStateMixin, Au
|
||||||
onHorizontalDragUpdate: _isTouch ? _handleDragUpdate : null,
|
onHorizontalDragUpdate: _isTouch ? _handleDragUpdate : null,
|
||||||
onHorizontalDragEnd: _isTouch ? _handleDragEnd : null,
|
onHorizontalDragEnd: _isTouch ? _handleDragEnd : null,
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
child: content,
|
|
||||||
dragStartBehavior: widget.dragStartBehavior,
|
dragStartBehavior: widget.dragStartBehavior,
|
||||||
|
child: content,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
155
pubspec.lock
155
pubspec.lock
|
@ -5,56 +5,63 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.0"
|
version: "2.11.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.3.0"
|
||||||
charcode:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: charcode
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.0"
|
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: clock
|
name: clock
|
||||||
url: "https://pub.dartlang.org"
|
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.1"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0"
|
version: "1.18.0"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.1"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_lints:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_lints
|
||||||
|
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -65,34 +72,70 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
js:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: leak_tracker
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.3"
|
version: "10.0.5"
|
||||||
|
leak_tracker_flutter_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_flutter_testing
|
||||||
|
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.5"
|
||||||
|
leak_tracker_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_testing
|
||||||
|
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.1"
|
||||||
|
lints:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: lints
|
||||||
|
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.10"
|
version: "0.12.16+1"
|
||||||
|
material_color_utilities:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: material_color_utilities
|
||||||
|
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.11.1"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.15.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.9.0"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -102,58 +145,66 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0"
|
version: "1.10.0"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.11.1"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.2"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.2.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: term_glyph
|
name: term_glyph
|
||||||
url: "https://pub.dartlang.org"
|
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.1"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.19"
|
version: "0.7.2"
|
||||||
typed_data:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: typed_data
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.3.0"
|
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.4"
|
||||||
|
vm_service:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vm_service
|
||||||
|
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "14.2.4"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.12.0 <3.0.0"
|
dart: ">=3.5.0 <4.0.0"
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=3.18.0-18.0.pre.54"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
name: swipe_to_action
|
name: swipe_to_action
|
||||||
description: A widget which can be used to call functions when the wrapped child is dragged or flinged.
|
description: A widget which can be used to call functions when the wrapped child is dragged or flinged.
|
||||||
version: 0.1.0
|
version: 0.3.0
|
||||||
homepage: https://inex.dev/inex/swipe_to_action
|
homepage: https://inex.dev/inex/swipe_to_action
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <4.0.0"
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=2.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -16,6 +16,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_lints: ^5.0.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/build" />
|
<excludeFolder url="file://$MODULE_DIR$/example/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
<orderEntry type="library" name="Dart Packages" level="project" />
|
||||||
|
|
Loading…
Reference in a new issue