aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pubspec.lock79
-rw-r--r--pubspec.yaml1
-rw-r--r--src/distractionless/core.cljd68
-rw-r--r--src/distractionless/ui/apps.cljd3
4 files changed, 119 insertions, 32 deletions
diff --git a/pubspec.lock b/pubspec.lock
index 7108ce5..dc34b2d 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -83,6 +83,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
installed_apps:
dependency: "direct main"
description:
@@ -272,6 +277,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.3"
+ url_launcher:
+ dependency: "direct main"
+ description:
+ name: url_launcher
+ sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.3.1"
+ url_launcher_android:
+ dependency: transitive
+ description:
+ name: url_launcher_android
+ sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.3.14"
+ url_launcher_ios:
+ dependency: transitive
+ description:
+ name: url_launcher_ios
+ sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.3.2"
+ url_launcher_linux:
+ dependency: transitive
+ description:
+ name: url_launcher_linux
+ sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.2.1"
+ url_launcher_macos:
+ dependency: transitive
+ description:
+ name: url_launcher_macos
+ sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.2.2"
+ url_launcher_platform_interface:
+ dependency: transitive
+ description:
+ name: url_launcher_platform_interface
+ sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.2"
+ url_launcher_web:
+ dependency: transitive
+ description:
+ name: url_launcher_web
+ sha256: "3ba963161bd0fe395917ba881d320b9c4f6dd3c4a233da62ab18a5025c85f1e9"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.0"
+ url_launcher_windows:
+ dependency: transitive
+ description:
+ name: url_launcher_windows
+ sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.1.4"
vector_math:
dependency: transitive
description:
@@ -288,6 +357,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.3.0"
+ web:
+ dependency: transitive
+ description:
+ name: web
+ sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.0"
xdg_directories:
dependency: transitive
description:
@@ -298,4 +375,4 @@ packages:
version: "1.1.0"
sdks:
dart: ">=3.6.0 <4.0.0"
- flutter: ">=3.24.0"
+ flutter: ">=3.27.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 2fd58f1..9ac57e7 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -36,6 +36,7 @@ dependencies:
cupertino_icons: ^1.0.8
installed_apps: ^1.5.2
path_provider: ^2.1.5
+ url_launcher: ^6.3.1
dev_dependencies:
flutter_test:
diff --git a/src/distractionless/core.cljd b/src/distractionless/core.cljd
index 146dc0a..f8c0929 100644
--- a/src/distractionless/core.cljd
+++ b/src/distractionless/core.cljd
@@ -5,6 +5,8 @@
[distractionless.config :as dconfig]
["dart:io" :as io]
[clojure.string :as cstr]
+ ["package:url_launcher/url_launcher.dart" :as url-launcher]
+ ["package:url_launcher/url_launcher_string.dart" :as url-launcher-str]
[distractionless.ui.constants :as duconstants]
[distractionless.ui.apps :as duapps]))
@@ -37,33 +39,41 @@
.child (if (nil? apps)
(m/Text "Lade Apps..."
.style (m/TextStyle
- .color duconstants/text-color
- .fontStyle m/FontStyle.italic))
+ .color duconstants/text-color
+ .fontStyle m/FontStyle.italic))
(m/Column
- .children [(m/SearchBar
- .onChanged (fn [new-val]
- (reset! *query new-val)
- nil)
- .hintText "Suche"
- .controller search-bar-controller
- .backgroundColor (#/(.resolveWith m/Color?) m/MaterialStateProperty (fn [^Set _states] duconstants/background-color))
- .trailing (when-not (cstr/blank? query)
- [(m/IconButton .icon (m/Icon m/Icons.clear_rounded)
- .color duconstants/text-color
- .onPressed #(do (reset! *query "")
- (.clear search-bar-controller))
- .iconSize 30.0)]))
- (m/CheckboxListTile
- .title (m/Text "Alle Apps anzeigen"
- .style duconstants/text-style)
- .value show-all-apps?
- .onChanged #(reset! *show-all-apps? %)
- .activeColor duconstants/checkbox-active-color)
- (m/Expanded
- .child (duapps/apps-list (filter (cond
- (not (cstr/blank? query)) #(cstr/includes?
- (cstr/lower-case (.-name %))
- (cstr/lower-case query))
- show-all-apps? (fn [_] true)
- :else #(.contains favourites (.-packageName %))) apps)
- config-file ctx reloader))])))))
+ .children (filter some?
+ [(m/SearchBar
+ .onChanged (fn [new-val]
+ (reset! *query new-val)
+ nil)
+ .hintText "Suche"
+ .controller search-bar-controller
+ .backgroundColor (#/(.resolveWith m/Color?) m/MaterialStateProperty (fn [^Set _states] duconstants/background-color))
+ .trailing (when-not (cstr/blank? query)
+ [(m/IconButton .icon (m/Icon m/Icons.clear_rounded)
+ .color duconstants/text-color
+ .onPressed #(do (reset! *query "")
+ (.clear search-bar-controller))
+ .iconSize 30.0)]))
+ (m/CheckboxListTile
+ .title (m/Text "Alle Apps anzeigen"
+ .style duconstants/text-style)
+ .value show-all-apps?
+ .onChanged #(reset! *show-all-apps? %)
+ .activeColor duconstants/checkbox-active-color)
+ (m/Expanded
+ .child (duapps/apps-list (filter (cond
+ (not (cstr/blank? query)) #(cstr/includes?
+ (cstr/lower-case (.-name %))
+ (cstr/lower-case query))
+ show-all-apps? (fn [_] true)
+ :else #(.contains favourites (.-packageName %))) apps)
+ config-file ctx reloader))
+ (when (not (cstr/blank? query))
+ (m/ListTile
+ .title (m/Text (str "Nach \"" query "\" im Internet suchen")
+ .style duconstants/text-style)
+ .onTap #(do (await (url-launcher-str/launchUrlString (str "https://google.com/search?q=" (cstr/replace query " " "+"))
+ .mode url-launcher/LaunchMode.externalApplication))
+ nil)))]))))))
diff --git a/src/distractionless/ui/apps.cljd b/src/distractionless/ui/apps.cljd
index 6d9920a..b7cf61f 100644
--- a/src/distractionless/ui/apps.cljd
+++ b/src/distractionless/ui/apps.cljd
@@ -1,6 +1,5 @@
(ns distractionless.ui.apps
- (:require ["package:flutter/material.dart" :as m]
- [clojure.string :as cstr]
+ (:require ["package:flutter/material.dart" :as m]
["package:installed_apps/installed_apps.dart" :as apps]
[distractionless.ui.constants :as duconstants]
[distractionless.ui.apps.settings :as duasettings]))