From 94ee74840a23e97400d53c600cb973b7eadfd5c5 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 4 May 2020 10:58:19 +0100 Subject: [PATCH] zzz --- .gitignore | 1 + .idea/libraries/Dart_SDK.xml | 32 +++-- .idea/workspace.xml | 113 ++++++++++++------ example/android/gradle.properties | 1 + .../ios/Flutter/flutter_export_environment.sh | 8 +- example/lib/main.dart | 36 ++++-- example/pubspec.lock | 61 +++++++++- lib/src/ux_app.dart | 18 +++ lib/ux.dart | 35 ++++-- pubspec.lock | 59 ++++++++- pubspec.yaml | 4 +- test/ux_test.dart | 2 +- ux.iml | 2 +- 13 files changed, 291 insertions(+), 81 deletions(-) diff --git a/.gitignore b/.gitignore index e9dc58d..02c4c38 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ .pub/ build/ +.idea/ \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 827eb39..c92cda1 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,17 +1,27 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 113d108..3c8cb3c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,45 +1,86 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - + + + - - - - - - - + + + + + + + + - + - + + + + + + + + + + 1587543692625 + + + + + + + \ No newline at end of file diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 2bd6f4f..1441b1d 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,2 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.enableR8=true diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index d128f02..5b60a3b 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -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" diff --git a/example/lib/main.dart b/example/lib/main.dart index 78cc480..847186e 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -25,7 +25,7 @@ class _MyAppState extends State { 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 { @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), + ) + ], + ), + ), + ) + }, ), ); } diff --git a/example/pubspec.lock b/example/pubspec.lock index 2ed2921..f858e78 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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" diff --git a/lib/src/ux_app.dart b/lib/src/ux_app.dart index e69de29..24da9da 100644 --- a/lib/src/ux_app.dart +++ b/lib/src/ux_app.dart @@ -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(); +} + diff --git a/lib/ux.dart b/lib/ux.dart index 7e0a07f..29f9de1 100644 --- a/lib/ux.dart +++ b/lib/ux.dart @@ -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 get platformVersion async { final String version = await _channel.invokeMethod('getPlatformVersion'); return version; } } + +extension UxExtension on BuildContext { + showText(String text, + {bool modal = false, + double backdropBlur = 0.0, + Duration duration = const Duration(seconds: 3)}) => + Note( + 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); +} diff --git a/pubspec.lock b/pubspec.lock index aebdafa..95e6141 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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" diff --git a/pubspec.yaml b/pubspec.yaml index 2777790..e34a625 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: ux description: UX Kit -version: 0.0.4 +version: 0.1.0 author: Alexandru Agrapine homepage: https://swipelab.co/ux.html environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.6.0 <3.0.0" dependencies: flutter: diff --git a/test/ux_test.dart b/test/ux_test.dart index 36f40da..ba43ce2 100644 --- a/test/ux_test.dart +++ b/test/ux_test.dart @@ -16,6 +16,6 @@ void main() { }); test('getPlatformVersion', () async { - expect(await Ux.platformVersion, '42'); + expect(await UX.platformVersion, '42'); }); } diff --git a/ux.iml b/ux.iml index 429df7d..73e7ebd 100644 --- a/ux.iml +++ b/ux.iml @@ -8,11 +8,11 @@ + -