This commit is contained in:
alex
2020-05-04 10:58:19 +01:00
parent 0f2ab52606
commit 94ee74840a
13 changed files with 291 additions and 81 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@
.pub/
build/
.idea/

View File

@@ -1,17 +1,27 @@
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file:///Users/zen/github/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/cli" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/ffi" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/js" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/js_util" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/svg" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/wasm" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/web_gl" />
<root url="file://$PROJECT_DIR$/../../flutter/flutter/bin/cache/dart-sdk/lib/web_sql" />
</CLASSES>
<JAVADOC />
<SOURCES />

113
.idea/workspace.xml generated
View File

@@ -1,45 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="ux.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/ux.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 name="ChangeListManager">
<list default="true" id="e30161f9-0e11-4901-861c-a8265e376258" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/lib/src/ux_app.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/libraries/Dart_SDK.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_SDK.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/android/gradle.properties" beforeDir="false" afterPath="$PROJECT_DIR$/example/android/gradle.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/Flutter/flutter_export_environment.sh" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/Flutter/flutter_export_environment.sh" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/ux.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/ux.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/ux_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/ux_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ux.iml" beforeDir="false" afterPath="$PROJECT_DIR$/ux.iml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</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 name="ExecutionTargetManager" SELECTED_TARGET="Pixel_2_API_R" />
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Dart File" />
</list>
</option>
</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 name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IgnoredFileRootStore">
<option name="generatedRoots">
<set>
<option value="$PROJECT_DIR$/.idea" />
</set>
</option>
</component>
<component name="ProjectId" id="1at8n2PN9LKTGQcSjAp463ktCTy" />
<component name="PropertiesComponent">
<property name="dart.analysis.tool.window.force.activate" value="false" />
<property name="io.flutter.reload.alreadyRun" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="dart.analysis.tool.window.force.activate" value="true" />
<property name="settings.editor.selected.configurable" value="flutter.settings" />
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
</project>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e30161f9-0e11-4901-861c-a8265e376258" name="Default Changelist" comment="" />
<created>1587543692625</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1587543692625</updated>
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@@ -1,2 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true

View File

@@ -1,8 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/zen/git/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/zen/git/swipelab/ux/example"
export "FLUTTER_ROOT=/home/agra/git/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/home/agra/git/swipelab/ux/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/zen/git/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_FRAMEWORK_DIR=/home/agra/git/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"

View File

@@ -25,7 +25,7 @@ class _MyAppState extends State<MyApp> {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformVersion = await Ux.platformVersion;
platformVersion = await UX.platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
@@ -42,14 +42,32 @@ class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
return UxApp(
child: MaterialApp(
routes: {
'/': (context) => Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Builder(
builder: (context) => ListView(
padding: EdgeInsets.only(top: 48),
children: [
ListTile(title: Text('Running on: $_platformVersion\n')),
ListTile(
title: Text('Show a simple note'),
onTap: () => context.showText('This is a simple note'),
),
ListTile(
title: Text('Show modal note'),
onTap: () => context.showText('This is a modal note',
backdropBlur: 6, modal: true),
)
],
),
),
)
},
),
);
}

View File

@@ -1,13 +1,27 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
@@ -29,6 +43,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
@@ -46,20 +74,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
version: "1.1.8"
path:
dependency: transitive
description:
@@ -74,6 +109,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
@@ -127,7 +169,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
typed_data:
dependency: transitive
description:
@@ -141,7 +183,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.4"
version: "0.1.0"
vector_math:
dependency: transitive
description:
@@ -149,5 +191,12 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.2.2 <3.0.0"
dart: ">=2.6.0 <3.0.0"

View File

@@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
class UxApp extends InheritedWidget {
final Widget child;
UxApp({this.child});
Widget build(BuildContext context) {
return Stack(
children: [Positioned.fill(child: child)],
);
}
bool updateShouldNotify(InheritedWidget oldWidget) => false;
UxApp of(BuildContext context) => context.dependOnInheritedWidgetOfExactType<UxApp>();
}

View File

@@ -1,16 +1,37 @@
library scoped;
import 'dart:async';
import 'package:flutter/services.dart';
library ux;
export 'src/bend_box.dart';
export 'src/note.dart';
export 'src/ux_app.dart';
export 'src/json_extension.dart';
class Ux {
static const MethodChannel _channel =
const MethodChannel('ux');
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'src/note.dart';
class UX {
static const MethodChannel _channel = const MethodChannel('ux');
static Future<String> get platformVersion async {
final String version = await _channel.invokeMethod('getPlatformVersion');
return version;
}
}
extension UxExtension on BuildContext {
showText<T>(String text,
{bool modal = false,
double backdropBlur = 0.0,
Duration duration = const Duration(seconds: 3)}) =>
Note<T>(
duration: duration,
modalBackdropBlur: backdropBlur,
isModal: modal,
child: Container(
decoration: BoxDecoration(color: Color(0xFF202020)),
child: ListTile(
title:
Text(text, style: TextStyle(color: Colors.white)))))
.show(this);
}

View File

@@ -1,13 +1,27 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
@@ -29,6 +43,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
flutter:
dependency: "direct main"
description: flutter
@@ -39,20 +67,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
version: "1.1.8"
path:
dependency: transitive
description:
@@ -67,6 +102,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
@@ -120,7 +162,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
typed_data:
dependency: transitive
description:
@@ -135,5 +177,12 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.2.2 <3.0.0"
dart: ">=2.6.0 <3.0.0"

View File

@@ -1,11 +1,11 @@
name: ux
description: UX Kit
version: 0.0.4
version: 0.1.0
author: Alexandru Agrapine <alex@swipelab.co>
homepage: https://swipelab.co/ux.html
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:

View File

@@ -16,6 +16,6 @@ void main() {
});
test('getPlatformVersion', () async {
expect(await Ux.platformVersion, '42');
expect(await UX.platformVersion, '42');
});
}

2
ux.iml
View File

@@ -8,11 +8,11 @@
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>