Compare commits
100 Commits
f64ed77b75
...
v0.1.38
| Author | SHA1 | Date | |
|---|---|---|---|
| b3aee85a84 | |||
| a984269c15 | |||
| 600ff26016 | |||
| 9c85d565a9 | |||
| 446ef9a57a | |||
| 6103d0b679 | |||
| 5fd690197a | |||
| 31c0ade243 | |||
| 8ec264cebe | |||
| 83bfdf322b | |||
| cad43c7664 | |||
| 5c44574949 | |||
| 336be6cb72 | |||
| 214ae08bb9 | |||
| 100b86d3f9 | |||
| ff1b102047 | |||
| d51f3d4ba7 | |||
| b4016e6e5b | |||
| eae4a853e9 | |||
| 8eb4cadc85 | |||
| 06c5ca9910 | |||
| 27c3804b1e | |||
| debf960d70 | |||
| 1029bad20f | |||
| cef23a1c83 | |||
| c4fe32e4b1 | |||
| 893a1b558f | |||
| b0eebb5ee8 | |||
| 56daf1b940 | |||
| 8687b7788b | |||
| eeae1d919e | |||
| d02684bb84 | |||
| ea961da678 | |||
| 632da54311 | |||
| bc20593661 | |||
| 045f8b5b6b | |||
| 81f7b45619 | |||
| 06a76afc42 | |||
| 3032e13dc9 | |||
| d0492b2f79 | |||
| c2506fab7a | |||
| dca8c64555 | |||
| c80606b7d0 | |||
| be6020d6c5 | |||
| 5eb58d7cf2 | |||
| 306a38a36a | |||
| 1aaea5f6d9 | |||
| 99a8aaa409 | |||
| 85d57c6e1c | |||
| 77a647d17d | |||
| 3a54a077f3 | |||
| cf88a9a371 | |||
| 5feb535cf3 | |||
| 2d23207497 | |||
| c7c5b3682d | |||
| 321a310add | |||
| 3bc7d713dd | |||
| 1d9ace45a1 | |||
| 588843a989 | |||
| f780638269 | |||
| 37447b4a53 | |||
| c283de7a45 | |||
| 483db8bfbd | |||
| a4d471dc62 | |||
| 970d78943b | |||
| a66c25c784 | |||
| 609a477b75 | |||
| 6d847aa2bb | |||
| f0b3c11e63 | |||
| 143206cd72 | |||
| 36e4eaee17 | |||
| 11a43a39fa | |||
| c0f92fac58 | |||
| be6a44e7f0 | |||
| 36e035c09c | |||
| 0309678650 | |||
| 885e638265 | |||
| 68a2a31d07 | |||
| baf664a3ad | |||
| 6d51ef9ad0 | |||
| eddf2acbde | |||
| 7211560b8d | |||
| db61809939 | |||
| be171aa4bc | |||
| ca27cfeb96 | |||
| 8bdf036c1a | |||
| 6fb873163b | |||
| 2d93d1a9d7 | |||
| a4d760a970 | |||
| d0feca1ba8 | |||
| 12459bb4cb | |||
| 4970836c60 | |||
| 90539932ec | |||
| 69c00cca3e | |||
| 603060fe58 | |||
| ef9a369df1 | |||
| 651e52485c | |||
| fbec875334 | |||
| 56e277593d | |||
| 0502d82509 |
68
.gitea/workflows/android_build.yml
Normal file
68
.gitea/workflows/android_build.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
name: Flutter APK Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
build_apk:
|
||||
name: Build Flutter APK
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Java (Temurin 17)
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: "platform-tools platforms;android-36 build-tools;36.0.0"
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
- run: flutter --version
|
||||
- run: flutter doctor
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build APK
|
||||
run: flutter build apk --release
|
||||
|
||||
- name: Upload APK artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: flutter-apk
|
||||
path: build/app/outputs/flutter-apk/app-release.apk
|
||||
retention-days: 30
|
||||
|
||||
- name: Create Gitea release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RUNNER_CREATE_RELEASE }}
|
||||
with:
|
||||
tag_name: "v0.1.${{ github.run_number }}"
|
||||
name: "Flutter Android v0.1.${{ github.run_number }}"
|
||||
body: "Automated build from CI"
|
||||
draft: false
|
||||
prerelease: false
|
||||
files: |
|
||||
build/app/outputs/flutter-apk/app-release.apk
|
||||
gitea_url: "https://git.skup.in"
|
||||
owner: "marco"
|
||||
repo: "maps_bookmarks"
|
||||
155
.gitignore
vendored
155
.gitignore
vendored
@@ -1,16 +1,23 @@
|
||||
# Do not remove or rename entries in this file, only add new ones
|
||||
# See https://github.com/flutter/flutter/issues/128635 for more context.
|
||||
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.lock
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.build/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
.swiftpm/
|
||||
migrate_working_dir/
|
||||
lib/l10n/app_localizations*
|
||||
|
||||
# As packages are no longer pinned, we use a lockfile for testing locally.
|
||||
# When unpinning packages, Using lockfiles ensures that failures in PRs are
|
||||
# actually due to those PRs, not due to a package being updated.
|
||||
!/pubspec.lock
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
@@ -18,28 +25,142 @@ migrate_working_dir/
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
# Visual Studio Code related
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
.vscode/*
|
||||
.ccls-cache
|
||||
|
||||
# This file, on the master branch, should never exist or be checked-in.
|
||||
#
|
||||
# On a *final* release branch, that is, what will ship to stable or beta, the
|
||||
# file can be force added (git add --force) and checked-in in order to effectively
|
||||
# "pin" the engine artifact version so the flutter tool does not need to use git
|
||||
# to determine the engine artifacts.
|
||||
#
|
||||
# See https://github.com/flutter/flutter/blob/main/docs/tool/Engine-artifacts.md.
|
||||
/bin/internal/engine.version
|
||||
|
||||
# Flutter repo-specific
|
||||
/bin/cache/
|
||||
/bin/internal/bootstrap.bat
|
||||
/bin/internal/bootstrap.sh
|
||||
/bin/internal/engine.realm
|
||||
/bin/mingit/
|
||||
/dev/benchmarks/mega_gallery/
|
||||
/dev/bots/.recipe_deps
|
||||
/dev/bots/android_tools/
|
||||
/dev/devicelab/ABresults*.json
|
||||
/dev/docs/doc/
|
||||
/dev/docs/api_docs.zip
|
||||
/dev/docs/flutter.docs.zip
|
||||
/dev/docs/lib/
|
||||
/dev/docs/pubspec.yaml
|
||||
/dev/integration_tests/**/xcuserdata
|
||||
/dev/integration_tests/**/Pods
|
||||
/packages/flutter/coverage/
|
||||
version
|
||||
analysis_benchmark.json
|
||||
|
||||
# packages file containing multi-root paths
|
||||
.packages.generated
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins-dependencies
|
||||
**/generated_plugin_registrant.dart
|
||||
.packages
|
||||
.pub-preload-cache/
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
/coverage/
|
||||
build/
|
||||
flutter_*.png
|
||||
linked_*.ds
|
||||
unlinked.ds
|
||||
unlinked_spec.ds
|
||||
|
||||
# Symbolication related
|
||||
# Android related
|
||||
**/android/**/gradle-wrapper.jar
|
||||
.gradle/
|
||||
**/android/captures/
|
||||
**/android/gradlew
|
||||
**/android/gradlew.bat
|
||||
**/android/**/GeneratedPluginRegistrant.java
|
||||
**/android/key.properties
|
||||
*.jks
|
||||
local.properties
|
||||
**/.cxx/
|
||||
|
||||
# iOS/XCode related
|
||||
**/ios/**/*.mode1v3
|
||||
**/ios/**/*.mode2v3
|
||||
**/ios/**/*.moved-aside
|
||||
**/ios/**/*.pbxuser
|
||||
**/ios/**/*.perspectivev3
|
||||
**/ios/**/*sync/
|
||||
**/ios/**/.sconsign.dblite
|
||||
**/ios/**/.tags*
|
||||
**/ios/**/.vagrant/
|
||||
**/ios/**/DerivedData/
|
||||
**/ios/**/Icon?
|
||||
**/ios/**/Pods/
|
||||
**/ios/**/.symlinks/
|
||||
**/ios/**/profile
|
||||
**/ios/**/xcuserdata
|
||||
**/ios/.generated/
|
||||
**/ios/Flutter/.last_build_id
|
||||
**/ios/Flutter/App.framework
|
||||
**/ios/Flutter/Flutter.framework
|
||||
**/ios/Flutter/Flutter.podspec
|
||||
**/ios/Flutter/Generated.xcconfig
|
||||
**/ios/Flutter/ephemeral
|
||||
**/ios/Flutter/app.flx
|
||||
**/ios/Flutter/app.zip
|
||||
**/ios/Flutter/flutter_assets/
|
||||
**/ios/Flutter/flutter_export_environment.sh
|
||||
**/ios/ServiceDefinitions.json
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# macOS
|
||||
**/Flutter/ephemeral/
|
||||
**/Pods/
|
||||
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||
**/macos/Flutter/ephemeral
|
||||
**/xcuserdata/
|
||||
|
||||
# Windows
|
||||
**/windows/flutter/ephemeral/
|
||||
**/windows/flutter/generated_plugin_registrant.cc
|
||||
**/windows/flutter/generated_plugin_registrant.h
|
||||
**/windows/flutter/generated_plugins.cmake
|
||||
|
||||
# Linux
|
||||
**/linux/flutter/ephemeral/
|
||||
**/linux/flutter/generated_plugin_registrant.cc
|
||||
**/linux/flutter/generated_plugin_registrant.h
|
||||
**/linux/flutter/generated_plugins.cmake
|
||||
|
||||
# Coverage
|
||||
coverage/
|
||||
|
||||
# Symbols
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
# Exceptions to above rules.
|
||||
!**/ios/**/default.mode1v3
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
!**/ios/**/default.perspectivev3
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
!/dev/ci/**/Gemfile.lock
|
||||
!.vscode/settings.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
# Monorepo
|
||||
.cipd
|
||||
.gclient
|
||||
.gclient_entries
|
||||
.python-version
|
||||
.gclient_previous_custom_vars
|
||||
.gclient_previous_sync_commits
|
||||
@@ -1,28 +1,6 @@
|
||||
# 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.dev/lints.
|
||||
#
|
||||
# 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
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
prefer_single_quotes: true
|
||||
prefer_relative_imports: true
|
||||
|
||||
2
android/app/proguard-rules.pro
vendored
Normal file
2
android/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
-keep class io.flutter.plugins.sharedpreferences.** { *; }
|
||||
-keep class io.flutter.plugins.sharedpreferences.LegacySharedPreferencesPlugin { *; }
|
||||
@@ -1,4 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
|
||||
<application
|
||||
android:label="maps_bookmarks"
|
||||
android:name="${applicationName}"
|
||||
@@ -6,7 +8,7 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
@@ -25,20 +27,10 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:mimeType="text/*"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https"
|
||||
android:host="www.maps.google.com" />
|
||||
<data android:scheme="https"
|
||||
android:host="www.maps.app.goog.le" />
|
||||
<data android:mimeType="text/plain" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
@@ -56,5 +48,10 @@
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
<package android:name="com.google.android.apps.maps" />
|
||||
</queries>
|
||||
</manifest>
|
||||
|
||||
@@ -1,5 +1,47 @@
|
||||
package com.example.maps_bookmarks
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin
|
||||
|
||||
class MainActivity : FlutterActivity()
|
||||
class MainActivity: FlutterActivity() {
|
||||
private var sharedText: String? = null
|
||||
private val CHANNEL = "app.channel.shared.data"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
handleIntent(intent)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
handleIntent(intent)
|
||||
}
|
||||
|
||||
private fun handleIntent(intent: Intent) {
|
||||
val action = intent.action
|
||||
val type = intent.type
|
||||
|
||||
if (Intent.ACTION_SEND == action && "text/plain" == type) {
|
||||
sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)
|
||||
}
|
||||
}
|
||||
|
||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine)
|
||||
flutterEngine.plugins.add(SharedPreferencesPlugin())
|
||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
|
||||
.setMethodCallHandler { call, result ->
|
||||
if (call.method == "getSharedText") {
|
||||
result.success(sharedText)
|
||||
sharedText = null
|
||||
} else {
|
||||
result.notImplemented()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
|
||||
|
||||
3
devtools_options.yaml
Normal file
3
devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
description: This file stores settings for Dart & Flutter DevTools.
|
||||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||
extensions:
|
||||
3
l10n.yaml
Normal file
3
l10n.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
arb-dir: lib/l10n
|
||||
template-arb-file: app_en.arb
|
||||
output-localization-file: app_localizations.dart
|
||||
3
lib/assets/constants.dart
Normal file
3
lib/assets/constants.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
const String appName = 'Maps Bookmarks';
|
||||
const String jsonFileName = 'MapsBookmarksData.json';
|
||||
const String defaultAndroidExportDirectory = '/storage/emulated/0/Documents';
|
||||
43
lib/l10n/app_de.arb
Normal file
43
lib/l10n/app_de.arb
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"@@locale": "de",
|
||||
"addToCollection": "Speichern in {collection_name}",
|
||||
"@addToCollection": {
|
||||
"placeholders": {
|
||||
"collection_name" : {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cancel": "Abbrechen",
|
||||
"chooseCollection": "Sammlung auswählen",
|
||||
"collections": "Sammlungen",
|
||||
"tipCreateCollections": "Erstelle deine erste Sammlung!",
|
||||
"search": "Suche",
|
||||
"createBookmark": "Lesezeichen erstellen",
|
||||
"createCollection": "Sammlung erstellen",
|
||||
"create": "Erstellen",
|
||||
"delete": "Löschen",
|
||||
"add": "Hinzufügen",
|
||||
"startSearching": "Suche etwas",
|
||||
"tipNoResults": "Keine Suchergebnisse gefunden",
|
||||
"collectionName": "Name der Sammlung",
|
||||
"bookmarkTitle": "Titel des Lesezeichens",
|
||||
"url": "Url",
|
||||
"description": "Beschreibung",
|
||||
"settings": "Einstellungen",
|
||||
"appData": "App-Daten",
|
||||
"export": "Exportieren",
|
||||
"import": "Importieren",
|
||||
"activateJsonExport": "Immer als JSON speichern",
|
||||
|
||||
"@@comment": "Info",
|
||||
"exportSuccess": "Daten exportiert",
|
||||
"importSuccess": "Daten importiert",
|
||||
|
||||
"@@comment": "Errors",
|
||||
"errorStoragePermisson": "Zugriff auf Speicher verwehrt",
|
||||
"errorCouldNotLaunchUrl": "Konnte Url nicht öffnen",
|
||||
"errorInvalidUrl": "Fehlerhafte Url",
|
||||
"exportFailed": "Export fehlgeschlagen",
|
||||
"importFailed": "Import fehlgeschlagen"
|
||||
}
|
||||
44
lib/l10n/app_en.arb
Normal file
44
lib/l10n/app_en.arb
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"@@locale": "en",
|
||||
"addToCollection": "Add to {collection_name}",
|
||||
"@addToCollection": {
|
||||
"placeholders": {
|
||||
"collection_name" : {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cancel": "Cancel",
|
||||
"chooseCollection": "Choose Collection",
|
||||
"collections": "Collections",
|
||||
"tipCreateCollections": "Create your first Collection to get started!",
|
||||
"search": "Search",
|
||||
"createBookmark": "Create Bookmark",
|
||||
"createCollection": "Create Collection",
|
||||
"create": "Create",
|
||||
"delete": "Delete",
|
||||
"add": "Add",
|
||||
"startSearching": "Start searching",
|
||||
"tipNoResults": "There are no results that match your search",
|
||||
"collectionName": "Collection Name",
|
||||
"bookmarkTitle": "Bookmark Title",
|
||||
"url": "Url",
|
||||
"description": "Description",
|
||||
"settings": "Settings",
|
||||
"appData": "App data",
|
||||
"export": "Export",
|
||||
"import": "Import",
|
||||
"activateJsonExport": "Always save to JSON",
|
||||
|
||||
|
||||
"@@comment": "Info",
|
||||
"exportSuccess": "Exported data",
|
||||
"importSuccess": "Imported data",
|
||||
|
||||
"@@comment": "Errors",
|
||||
"errorStoragePermisson": "Storage permissions denied",
|
||||
"errorCouldNotLaunchUrl": "Could not launch Url",
|
||||
"errorInvalidUrl": "Invalid Url",
|
||||
"exportFailed": "Export failed",
|
||||
"importFailed": "Import failed"
|
||||
}
|
||||
@@ -1,19 +1,93 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'l10n/app_localizations.dart';
|
||||
import 'pages/collection_page.dart';
|
||||
import 'pages/collections_list_page.dart';
|
||||
import 'pages/search_page.dart';
|
||||
import 'pages/settings_page.dart';
|
||||
import 'service/search_provider.dart';
|
||||
import 'service/settings_provider.dart';
|
||||
import 'service/shared_link_provider.dart';
|
||||
import 'service/storage.dart';
|
||||
import 'service/share_intent_service.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Storage.initialize();
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (_) => SharedLinkProvider()),
|
||||
ChangeNotifierProvider(create: (_) => SearchProvider()),
|
||||
ChangeNotifierProvider(create: (_) => SettingsProvider()),
|
||||
],
|
||||
child: const MapsBookmarks(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
class MapsBookmarks extends StatefulWidget {
|
||||
const MapsBookmarks({super.key});
|
||||
|
||||
@override
|
||||
State<MapsBookmarks> createState() => _MapsBookmarksState();
|
||||
}
|
||||
|
||||
class _MapsBookmarksState extends State<MapsBookmarks>
|
||||
with WidgetsBindingObserver {
|
||||
final GlobalKey<NavigatorState> _navigatorKey = GlobalKey<NavigatorState>();
|
||||
final ShareIntentService _shareIntentService = ShareIntentService();
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
_checkForSharedContent();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_checkForSharedContent();
|
||||
}
|
||||
|
||||
Future<void> _checkForSharedContent() async {
|
||||
final sharedText = await _shareIntentService.getSharedMapsLink();
|
||||
|
||||
if (sharedText.isNotEmpty && mounted) {
|
||||
context.read<SharedLinkProvider>().setCurrentMapsLink(sharedText);
|
||||
}
|
||||
}
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
),
|
||||
localizationsDelegates: [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [Locale('en'), Locale('de')],
|
||||
navigatorKey: _navigatorKey,
|
||||
theme: lightTheme,
|
||||
darkTheme: darkTheme,
|
||||
initialRoute: CollectionsListPage.routeName,
|
||||
routes: {
|
||||
CollectionsListPage.routeName: (context) => const CollectionsListPage(),
|
||||
CollectionPage.routeName: (context) => const CollectionPage(),
|
||||
SearchPage.routeName: (context) => const SearchPage(),
|
||||
SettingsPage.routeName: (context) => const SettingsPage(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
45
lib/model/bookmark.dart
Normal file
45
lib/model/bookmark.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
class Bookmark {
|
||||
Bookmark({
|
||||
required this.collectionId,
|
||||
required this.name,
|
||||
required this.link,
|
||||
required this.description,
|
||||
int? createdAt,
|
||||
}) : createdAt = createdAt ?? DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
factory Bookmark.fromJson(Map<String, dynamic> json) => Bookmark(
|
||||
collectionId: json['collectionId'] as int,
|
||||
name: json['name'] as String,
|
||||
link: json['link'] as String,
|
||||
description: json['description'] as String,
|
||||
createdAt: json['createdAt'] as int,
|
||||
);
|
||||
|
||||
int collectionId;
|
||||
String link;
|
||||
String name;
|
||||
String description;
|
||||
int createdAt;
|
||||
|
||||
int get id => createdAt;
|
||||
|
||||
DateTime get createdDate => DateTime.fromMillisecondsSinceEpoch(createdAt);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'collectionId': collectionId,
|
||||
'name': name,
|
||||
'link': link,
|
||||
'description': description,
|
||||
'createdAt': createdAt,
|
||||
};
|
||||
|
||||
Bookmark copyWith({String? link, String? name, String? description}) {
|
||||
return Bookmark(
|
||||
collectionId: collectionId,
|
||||
name: name ?? this.name,
|
||||
link: link ?? this.link,
|
||||
description: description ?? this.description,
|
||||
createdAt: createdAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/model/collection.dart
Normal file
34
lib/model/collection.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
class Collection {
|
||||
Collection({required this.name, int? createdAt})
|
||||
: createdAt = createdAt ?? DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
factory Collection.fromJson(Map<String, dynamic> json) => Collection(
|
||||
name: json['name'] as String,
|
||||
createdAt: json['createdAt'] as int,
|
||||
);
|
||||
|
||||
int createdAt; // used as Id with millisecondsSinceEpoch
|
||||
String name;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (other is Collection) {
|
||||
return hashCode == other.hashCode;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
|
||||
int get id => createdAt;
|
||||
|
||||
DateTime get createdDate => DateTime.fromMillisecondsSinceEpoch(createdAt);
|
||||
|
||||
Map<String, dynamic> toJson() => {'name': name, 'createdAt': createdAt};
|
||||
|
||||
Collection copyWith({String? name}) {
|
||||
return Collection(name: name ?? this.name, createdAt: createdAt);
|
||||
}
|
||||
}
|
||||
26
lib/model/maps_link_metadata.dart
Normal file
26
lib/model/maps_link_metadata.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
class MapsLinkMetadata {
|
||||
final String url;
|
||||
final String placeName;
|
||||
final String latitude;
|
||||
final String longitude;
|
||||
final String address;
|
||||
final String description;
|
||||
|
||||
const MapsLinkMetadata({
|
||||
required this.url,
|
||||
this.placeName = '',
|
||||
this.latitude = '',
|
||||
this.longitude = '',
|
||||
this.address = '',
|
||||
this.description = '',
|
||||
});
|
||||
|
||||
String get coordinates {
|
||||
if (hasCoordinates) {
|
||||
return '$latitude, $longitude';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
bool get hasCoordinates => latitude.isNotEmpty && longitude.isNotEmpty;
|
||||
}
|
||||
39
lib/model/settings.dart
Normal file
39
lib/model/settings.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import '../assets/constants.dart' as constants;
|
||||
|
||||
class Settings {
|
||||
final String exportDirectoryPath;
|
||||
final bool alwaysExportEnabled;
|
||||
|
||||
Settings._({
|
||||
required this.exportDirectoryPath,
|
||||
required this.alwaysExportEnabled,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'exportDirectoryPath': exportDirectoryPath,
|
||||
'alwaysExportEnabled': alwaysExportEnabled,
|
||||
};
|
||||
}
|
||||
|
||||
factory Settings.fromJson(Map<String, dynamic> json) {
|
||||
return Settings._(
|
||||
exportDirectoryPath: json['exportDirectoryPath'] as String,
|
||||
alwaysExportEnabled: json['alwaysExportEnabled'] as bool,
|
||||
);
|
||||
}
|
||||
|
||||
factory Settings.defaults() {
|
||||
return Settings._(
|
||||
exportDirectoryPath: constants.defaultAndroidExportDirectory,
|
||||
alwaysExportEnabled: false,
|
||||
);
|
||||
}
|
||||
|
||||
Settings copyWith({String? exportDirectoryPath, bool? alwaysExportEnabled}) {
|
||||
return Settings._(
|
||||
exportDirectoryPath: exportDirectoryPath ?? this.exportDirectoryPath,
|
||||
alwaysExportEnabled: alwaysExportEnabled ?? this.alwaysExportEnabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
174
lib/pages/collection_page.dart
Normal file
174
lib/pages/collection_page.dart
Normal file
@@ -0,0 +1,174 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../model/bookmark.dart';
|
||||
import '../model/maps_link_metadata.dart';
|
||||
import '../service/bookmarks_provider.dart';
|
||||
import '../service/notifying.dart';
|
||||
import '../service/shared_link_provider.dart';
|
||||
import '../service/storage.dart';
|
||||
import '../service/url_launcher.dart';
|
||||
import '../widgets/collection_page_widgets/list_item_actions_widget.dart';
|
||||
import '../widgets/create_bookmark_dialog.dart';
|
||||
|
||||
class CollectionPage extends StatefulWidget {
|
||||
const CollectionPage({super.key});
|
||||
|
||||
static const String routeName = '/bookmarks';
|
||||
|
||||
@override
|
||||
State<CollectionPage> createState() => _CollectionPageState();
|
||||
}
|
||||
|
||||
class _CollectionPageState extends State<CollectionPage> {
|
||||
MapsLinkMetadata? selectedMapsLink;
|
||||
int selectedBookmarkId = -1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (selectedMapsLink != null) onAddButtonPressed();
|
||||
});
|
||||
}
|
||||
|
||||
void onAddButtonPressed() => showDialog(
|
||||
context: context,
|
||||
builder: (context) => CreateBookmarkDialog(
|
||||
collectionId: BookmarksProvider.selectedCollectionId!,
|
||||
onSavePressed: onBookmarkSaved,
|
||||
selectedMapsLink: selectedMapsLink,
|
||||
),
|
||||
);
|
||||
|
||||
void editBookmark(Bookmark selectedBookmark) => showDialog(
|
||||
context: context,
|
||||
builder: (context) => CreateBookmarkDialog(
|
||||
collectionId: BookmarksProvider.selectedCollectionId!,
|
||||
selectedBookmark: selectedBookmark,
|
||||
onSavePressed: onBookmarkSaved,
|
||||
onDeletePressed: () {
|
||||
Storage.deleteBookmarkById(
|
||||
selectedBookmark.id,
|
||||
).whenComplete(() => setState(() {}));
|
||||
},
|
||||
),
|
||||
).whenComplete(deselectBookmark);
|
||||
|
||||
void onBookmarkSaved(Bookmark bookmark) {
|
||||
Storage.addOrUpdateBookmark(bookmark);
|
||||
setState(() {});
|
||||
Provider.of<SharedLinkProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).removeCurrentMapsLink();
|
||||
}
|
||||
|
||||
Widget bookmarksListItemBuilder(BuildContext context, Bookmark bookmark) {
|
||||
final selected = selectedBookmarkId == bookmark.id;
|
||||
return ListTile(
|
||||
title: Text(bookmark.name),
|
||||
selected: selected,
|
||||
onTap: () {
|
||||
if (selected) {
|
||||
onCancelSelectionPressed();
|
||||
setState(() {});
|
||||
} else if (selectedBookmarkId != -1 && !selected) {
|
||||
selectedBookmarkId = bookmark.id;
|
||||
setState(() {});
|
||||
} else {
|
||||
launchUrlFromString(bookmark.link).then((errorCode) {
|
||||
if (context.mounted) {
|
||||
return Notifying.showUrlErrorSnackbar(context, errorCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onLongPress: () => setState(() {
|
||||
selectedBookmarkId = bookmark.id;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SharedLinkProvider provider = Provider.of<SharedLinkProvider>(context);
|
||||
selectedMapsLink = provider.currentMapsLinkMetadata;
|
||||
|
||||
if (BookmarksProvider.selectedCollectionId == null) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
final bookmarks = Storage.loadBookmarksForCollection(
|
||||
BookmarksProvider.selectedCollectionId!,
|
||||
);
|
||||
final collection = Storage.loadCollections().firstWhere(
|
||||
(c) => c.id == BookmarksProvider.selectedCollectionId,
|
||||
);
|
||||
|
||||
return PopScope(
|
||||
canPop: selectedBookmarkId == -1,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
if (didPop == false) deselectBookmark();
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: selectedMapsLink != null
|
||||
? Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
)!.addToCollection(collection.name),
|
||||
)
|
||||
: Text(collection.name),
|
||||
actions: [
|
||||
if (selectedMapsLink != null)
|
||||
TextButton(
|
||||
onPressed: () => provider.removeCurrentMapsLink(),
|
||||
child: Text(AppLocalizations.of(context)!.cancel),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: selectedBookmarkId > 0
|
||||
? ListItemActionsWidget(
|
||||
onDeletePressed: onDeleteBookmarkPressed,
|
||||
onCancelPressed: onCancelSelectionPressed,
|
||||
onEditPressed: () => editBookmark(
|
||||
bookmarks.firstWhere(
|
||||
(element) => element.id == selectedBookmarkId,
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (context, index) =>
|
||||
bookmarksListItemBuilder(context, bookmarks.elementAt(index)),
|
||||
itemCount: bookmarks.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: onAddButtonPressed,
|
||||
child: Icon(selectedMapsLink != null ? Icons.save : Icons.add),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onCancelSelectionPressed() => deselectBookmark();
|
||||
|
||||
void onDeleteBookmarkPressed() {
|
||||
Storage.deleteBookmarkById(
|
||||
selectedBookmarkId,
|
||||
).whenComplete(() => setState(() {}));
|
||||
deselectBookmark();
|
||||
}
|
||||
|
||||
void deselectBookmark() {
|
||||
selectedBookmarkId = -1;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
142
lib/pages/collections_list_page.dart
Normal file
142
lib/pages/collections_list_page.dart
Normal file
@@ -0,0 +1,142 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../model/collection.dart';
|
||||
import '../service/bookmarks_provider.dart';
|
||||
import '../service/shared_link_provider.dart';
|
||||
import '../service/storage.dart';
|
||||
import '../widgets/create_bookmark_collection_dialog.dart';
|
||||
import 'collection_page.dart';
|
||||
import 'search_page.dart' show SearchPage;
|
||||
import 'settings_page.dart';
|
||||
|
||||
class CollectionsListPage extends StatefulWidget {
|
||||
const CollectionsListPage({super.key});
|
||||
|
||||
static const String routeName = '/collections';
|
||||
|
||||
@override
|
||||
State<CollectionsListPage> createState() => _CollectionsListPageState();
|
||||
}
|
||||
|
||||
class _CollectionsListPageState extends State<CollectionsListPage> {
|
||||
bool addingNewBookmark = false;
|
||||
var bookmarkCountMap = <int, int>{};
|
||||
|
||||
Widget bottomSheetBuilder(BuildContext context) {
|
||||
final titleTextFieldController = TextEditingController(
|
||||
text: context
|
||||
.read<SharedLinkProvider>()
|
||||
.currentMapsLinkMetadata!
|
||||
.placeName,
|
||||
);
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: TextField(controller: titleTextFieldController),
|
||||
);
|
||||
}
|
||||
|
||||
void onAddButtonPressed() => showDialog(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
CreateBookmarkCollectionDialog(onSavePressed: onCollectionSaved),
|
||||
);
|
||||
|
||||
void onCollectionSaved(Collection collection) {
|
||||
Storage.addOrUpdateCollection(collection);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Widget collectionsListItemBuilder(
|
||||
BuildContext context,
|
||||
Collection collection,
|
||||
) {
|
||||
return ListTile(
|
||||
title: Text(collection.name),
|
||||
onTap: () => navigateToCollection(collection.id),
|
||||
onLongPress: () => onEditCollection(collection),
|
||||
leading: const Icon(Icons.list_rounded),
|
||||
trailing: Text(
|
||||
bookmarkCountMap[collection.id]?.toString() ?? '0',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void navigateToCollection(int collectionId) {
|
||||
BookmarksProvider.selectedCollectionId = collectionId;
|
||||
Navigator.pushNamed(context, CollectionPage.routeName);
|
||||
}
|
||||
|
||||
void onEditCollection(Collection selectedCollection) => showDialog(
|
||||
context: context,
|
||||
builder: (context) => CreateBookmarkCollectionDialog(
|
||||
selectedCollection: selectedCollection,
|
||||
onSavePressed: onCollectionSaved,
|
||||
onDeletePressed: () {
|
||||
Storage.deleteCollection(
|
||||
selectedCollection,
|
||||
).whenComplete(() => setState(() {}));
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final collections = Storage.loadCollections();
|
||||
bookmarkCountMap = Storage.loadPerCollectionBookmarkCount();
|
||||
addingNewBookmark =
|
||||
Provider.of<SharedLinkProvider>(context).currentMapsLinkMetadata !=
|
||||
null;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: addingNewBookmark
|
||||
? Text(AppLocalizations.of(context)!.chooseCollection)
|
||||
: Text(AppLocalizations.of(context)!.collections),
|
||||
actions: [
|
||||
if (addingNewBookmark)
|
||||
TextButton(
|
||||
onPressed: () => Provider.of<SharedLinkProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).removeCurrentMapsLink(),
|
||||
child: Text(AppLocalizations.of(context)!.cancel),
|
||||
)
|
||||
else
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed(SearchPage.routeName),
|
||||
icon: Icon(Icons.search_rounded),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed(SettingsPage.routeName),
|
||||
icon: Icon(Icons.settings_rounded),
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: onAddButtonPressed,
|
||||
child: Icon(Icons.add),
|
||||
),
|
||||
body: collections.isNotEmpty
|
||||
? Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (context, index) => collectionsListItemBuilder(
|
||||
context,
|
||||
collections.elementAt(index),
|
||||
),
|
||||
itemCount: collections.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: Text(AppLocalizations.of(context)!.tipCreateCollections),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
35
lib/pages/search_page.dart
Normal file
35
lib/pages/search_page.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../service/search_provider.dart';
|
||||
import '../widgets/search_widgets/search_bar_widget.dart';
|
||||
import '../widgets/search_widgets/search_results_widget.dart';
|
||||
|
||||
class SearchPage extends StatelessWidget {
|
||||
const SearchPage({super.key});
|
||||
|
||||
static const String routeName = '/search';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(AppLocalizations.of(context)!.search)),
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||
SearchBarWidget(
|
||||
onEditingComplete: context.read<SearchProvider>().setSearchText,
|
||||
onResetSearch: context.read<SearchProvider>().removeSearchText,
|
||||
),
|
||||
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||
Expanded(child: SearchResultsWidget()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
191
lib/pages/settings_page.dart
Normal file
191
lib/pages/settings_page.dart
Normal file
@@ -0,0 +1,191 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../service/notifying.dart';
|
||||
import '../service/permission_service.dart';
|
||||
import '../service/settings_provider.dart';
|
||||
import '../service/storage.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
static const routeName = '/settings';
|
||||
const SettingsPage({super.key});
|
||||
|
||||
@override
|
||||
State<SettingsPage> createState() => _SettingsPageState();
|
||||
}
|
||||
|
||||
class _SettingsPageState extends State<SettingsPage> {
|
||||
bool storagePermissionIsGranted = false;
|
||||
final tileSpacing = 16.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
PermissionService.storagePermissionStatus.then((value) {
|
||||
storagePermissionIsGranted = value.isGranted;
|
||||
if (context.mounted) setState(() {});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
// TODO: Localize
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final titlePadding = Theme.of(context).listTileTheme.contentPadding!;
|
||||
checkStoragePermission();
|
||||
final alwaysExportEnabled = context
|
||||
.watch<SettingsProvider>()
|
||||
.settings
|
||||
.alwaysExportEnabled;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(AppLocalizations.of(context)!.settings)),
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: titlePadding,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.appData,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
SizedBox(height: tileSpacing),
|
||||
ListTile(
|
||||
title: Text('Grant storage permisson'),
|
||||
subtitle: storagePermissionIsGranted
|
||||
? Text('Storage permission granted')
|
||||
: Text(
|
||||
'For app-data settings to work, you need to grant the app permissions to manage internal storage.',
|
||||
),
|
||||
onTap: () => PermissionService.requestStoragePermission
|
||||
.whenComplete(() => checkStoragePermission()),
|
||||
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||
enabled: !storagePermissionIsGranted,
|
||||
),
|
||||
SizedBox(height: tileSpacing),
|
||||
ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.import),
|
||||
subtitle: Text('Import app-data from a json file.'),
|
||||
onTap: () => onJsonImportPressed(),
|
||||
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||
enabled: storagePermissionIsGranted,
|
||||
),
|
||||
SizedBox(height: tileSpacing),
|
||||
ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.export),
|
||||
subtitle: Text(
|
||||
'Export app-data to a json file in the selected directory.',
|
||||
),
|
||||
onTap: () => onJsonExportPressed(),
|
||||
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||
enabled: storagePermissionIsGranted,
|
||||
),
|
||||
SizedBox(height: tileSpacing),
|
||||
ListTile(
|
||||
title: Text('Always save to file'),
|
||||
subtitle: Text(
|
||||
'Export app data to a directory, every time you make a change',
|
||||
),
|
||||
onTap: () => onAlwaysSaveToJsonPressed(),
|
||||
trailing: Checkbox(
|
||||
value: alwaysExportEnabled,
|
||||
onChanged: (value) {
|
||||
onAlwaysSaveToJsonPressed();
|
||||
},
|
||||
),
|
||||
enabled: storagePermissionIsGranted,
|
||||
),
|
||||
if (alwaysExportEnabled) SizedBox(height: tileSpacing),
|
||||
if (alwaysExportEnabled)
|
||||
ListTile(
|
||||
title: Text('Change export directory'),
|
||||
subtitle: Text(
|
||||
context
|
||||
.watch<SettingsProvider>()
|
||||
.settings
|
||||
.exportDirectoryPath,
|
||||
),
|
||||
onTap: () => onChangeExportDirectoryPressed(),
|
||||
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||
enabled: storagePermissionIsGranted,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onJsonExportPressed() async {
|
||||
if (!await checkStoragePermission()) return;
|
||||
Storage.exportToJsonFile().then(showExportInfo);
|
||||
}
|
||||
|
||||
void onJsonImportPressed() async {
|
||||
if (!await checkStoragePermission()) return;
|
||||
Storage.importFromJsonFile().then(showImportInfo);
|
||||
}
|
||||
|
||||
void onAlwaysSaveToJsonPressed() async {
|
||||
if (context.read<SettingsProvider>().settings.alwaysExportEnabled) {
|
||||
context.read<SettingsProvider>().setExportDirectoryPath('', silent: true);
|
||||
context.read<SettingsProvider>().setAlwaysExportEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!await PermissionService.storagePermissionStatus.isGranted) return;
|
||||
final dir = await Storage.selectDirectoryPath();
|
||||
if (dir.isEmpty || !context.mounted) return;
|
||||
|
||||
// ignore: use_build_context_synchronously
|
||||
context.read<SettingsProvider>().setExportDirectoryPath(dir, silent: true);
|
||||
|
||||
// ignore: use_build_context_synchronously
|
||||
Storage.saveDataToFile().whenComplete(
|
||||
// ignore: use_build_context_synchronously
|
||||
() => context.read<SettingsProvider>().setAlwaysExportEnabled(true),
|
||||
);
|
||||
}
|
||||
|
||||
void onChangeExportDirectoryPressed() async {
|
||||
if (!await PermissionService.storagePermissionStatus.isGranted) return;
|
||||
final dir = await Storage.selectDirectoryPath();
|
||||
if (dir.isEmpty || !context.mounted) return;
|
||||
|
||||
// ignore: use_build_context_synchronously
|
||||
context.read<SettingsProvider>().setExportDirectoryPath(dir);
|
||||
}
|
||||
|
||||
Future<bool> checkStoragePermission() async {
|
||||
PermissionService.storagePermissionStatus.then((value) {
|
||||
if (context.mounted && value.isGranted != storagePermissionIsGranted) {
|
||||
storagePermissionIsGranted = value.isGranted;
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
return storagePermissionIsGranted;
|
||||
}
|
||||
|
||||
void showExportInfo(bool success) => Notifying.showSnackbar(
|
||||
context,
|
||||
text: success
|
||||
? AppLocalizations.of(context)!.exportSuccess
|
||||
: AppLocalizations.of(context)!.exportFailed,
|
||||
isError: !success,
|
||||
);
|
||||
|
||||
void showImportInfo(bool success) => Notifying.showSnackbar(
|
||||
context,
|
||||
text: success
|
||||
? AppLocalizations.of(context)!.importSuccess
|
||||
: AppLocalizations.of(context)!.importFailed,
|
||||
isError: !success,
|
||||
);
|
||||
}
|
||||
3
lib/service/bookmarks_provider.dart
Normal file
3
lib/service/bookmarks_provider.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
class BookmarksProvider {
|
||||
static int? selectedCollectionId;
|
||||
}
|
||||
90
lib/service/json_file_service.dart
Normal file
90
lib/service/json_file_service.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../model/bookmark.dart';
|
||||
import '../model/collection.dart';
|
||||
import '../assets/constants.dart' as constants;
|
||||
|
||||
class JsonFileService {
|
||||
static Future<bool> exportToJson({
|
||||
required List<Collection> collections,
|
||||
required List<Bookmark> bookmarks,
|
||||
}) async {
|
||||
try {
|
||||
final dir = await selectDirectoryPath();
|
||||
if (dir.isEmpty) return false;
|
||||
|
||||
saveDataToFile(collections, bookmarks, dir);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static Future<({List<Collection> collections, List<Bookmark> bookmarks})>
|
||||
importFromJson() async {
|
||||
try {
|
||||
const typeGroup = XTypeGroup(label: 'json', extensions: <String>['json']);
|
||||
final XFile? file = await openFile(
|
||||
acceptedTypeGroups: <XTypeGroup>[typeGroup],
|
||||
);
|
||||
|
||||
if (file == null) {
|
||||
return (collections: <Collection>[], bookmarks: <Bookmark>[]);
|
||||
}
|
||||
|
||||
final jsonString = await file.readAsString();
|
||||
|
||||
final data = jsonDecode(jsonString) as Map<String, dynamic>;
|
||||
|
||||
final collections = (data['collections'] as List<dynamic>? ?? [])
|
||||
.map((json) => Collection.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
final bookmarks = (data['bookmarks'] as List<dynamic>? ?? [])
|
||||
.map((json) => Bookmark.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
return (collections: collections, bookmarks: bookmarks);
|
||||
} catch (e) {
|
||||
return (collections: <Collection>[], bookmarks: <Bookmark>[]);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> saveDataToFile(
|
||||
List<Collection> collections,
|
||||
List<Bookmark> bookmarks,
|
||||
String directory,
|
||||
) async {
|
||||
try {
|
||||
final data = jsonEncode({
|
||||
'collections': collections.map((c) => c.toJson()).toList(),
|
||||
'bookmarks': bookmarks.map((b) => b.toJson()).toList(),
|
||||
}).codeUnits;
|
||||
|
||||
final file = XFile.fromData(
|
||||
Uint8List.fromList(data),
|
||||
mimeType: 'application/json',
|
||||
name: constants.jsonFileName,
|
||||
);
|
||||
|
||||
file.saveTo('$directory/${constants.jsonFileName}');
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static Future<String> selectDirectoryPath() async {
|
||||
if (Platform.isAndroid) {
|
||||
return await getDirectoryPath(
|
||||
initialDirectory: constants.defaultAndroidExportDirectory,
|
||||
) ??
|
||||
'';
|
||||
}
|
||||
return await getDirectoryPath() ?? '';
|
||||
}
|
||||
}
|
||||
52
lib/service/maps_launcher_service.dart
Normal file
52
lib/service/maps_launcher_service.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:android_intent_plus/android_intent.dart';
|
||||
|
||||
class MapsLauncherService {
|
||||
static Future<bool> openInGoogleMaps(String url) async {
|
||||
if (!Platform.isAndroid) return false;
|
||||
|
||||
try {
|
||||
// Try to open in Google Maps app
|
||||
final intent = AndroidIntent(
|
||||
action: 'action_view',
|
||||
data: url,
|
||||
package: 'com.google.android.apps.maps',
|
||||
);
|
||||
|
||||
await intent.launch();
|
||||
return true;
|
||||
} catch (e) {
|
||||
// Google Maps not installed, try browser as fallback
|
||||
try {
|
||||
final browserIntent = AndroidIntent(action: 'action_view', data: url);
|
||||
await browserIntent.launch();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> shareLocation({
|
||||
required String text,
|
||||
String? subject,
|
||||
}) async {
|
||||
if (!Platform.isAndroid) return false;
|
||||
|
||||
try {
|
||||
final intent = AndroidIntent(
|
||||
action: 'action_send',
|
||||
type: 'text/plain',
|
||||
arguments: {
|
||||
'android.intent.extra.TEXT': text,
|
||||
if (subject != null) 'android.intent.extra.SUBJECT': subject,
|
||||
},
|
||||
);
|
||||
|
||||
await intent.launch();
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
lib/service/notifying.dart
Normal file
64
lib/service/notifying.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
import 'url_launcher.dart' show UrlLaunchErrorCode;
|
||||
|
||||
class Notifying {
|
||||
static void showSnackbar(
|
||||
BuildContext context, {
|
||||
required String text,
|
||||
bool isError = false,
|
||||
}) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: isError ? Theme.of(context).colorScheme.error : null,
|
||||
content: SizedBox(
|
||||
height: 30,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: isError
|
||||
? TextStyle(color: Theme.of(context).colorScheme.onError)
|
||||
: null,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar(),
|
||||
icon: Icon(
|
||||
Icons.close_rounded,
|
||||
color: isError ? Theme.of(context).colorScheme.onError : null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static void showUrlErrorSnackbar(
|
||||
BuildContext context,
|
||||
UrlLaunchErrorCode errorCode,
|
||||
) {
|
||||
String errorText = '';
|
||||
if (errorCode == UrlLaunchErrorCode.none) {
|
||||
return;
|
||||
} else if (errorCode == UrlLaunchErrorCode.couldNotLaunch) {
|
||||
errorText = AppLocalizations.of(context)!.errorCouldNotLaunchUrl;
|
||||
} else {
|
||||
errorText = AppLocalizations.of(context)!.errorInvalidUrl;
|
||||
}
|
||||
showSnackbar(context, text: errorText, isError: true);
|
||||
}
|
||||
|
||||
static void showErrorSnackbar(BuildContext context, String message) {
|
||||
showSnackbar(context, text: message, isError: true);
|
||||
}
|
||||
|
||||
static void showMessageSnackbar(BuildContext context, String message) {
|
||||
showSnackbar(context, text: message, isError: false);
|
||||
}
|
||||
}
|
||||
9
lib/service/permission_service.dart
Normal file
9
lib/service/permission_service.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class PermissionService {
|
||||
static Future<PermissionStatus> get storagePermissionStatus =>
|
||||
Permission.manageExternalStorage.status;
|
||||
|
||||
static Future<PermissionStatus> get requestStoragePermission =>
|
||||
Permission.manageExternalStorage.request();
|
||||
}
|
||||
17
lib/service/search_provider.dart
Normal file
17
lib/service/search_provider.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SearchProvider extends ChangeNotifier {
|
||||
String _searchText = '';
|
||||
|
||||
void setSearchText(String searchText, {bool silent = false}) {
|
||||
_searchText = searchText;
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
|
||||
void removeSearchText({bool silent = false}) {
|
||||
_searchText = '';
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
|
||||
String get searchText => _searchText;
|
||||
}
|
||||
24
lib/service/settings_provider.dart
Normal file
24
lib/service/settings_provider.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../model/settings.dart';
|
||||
import 'storage.dart';
|
||||
|
||||
class SettingsProvider extends ChangeNotifier {
|
||||
SettingsProvider() : _settings = Storage.loadSettings();
|
||||
|
||||
Settings _settings;
|
||||
|
||||
Settings get settings => _settings;
|
||||
|
||||
void setExportDirectoryPath(String path, {bool silent = false}) {
|
||||
_settings = _settings.copyWith(exportDirectoryPath: path);
|
||||
Storage.saveSettings(_settings);
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
|
||||
void setAlwaysExportEnabled(bool enabled, {bool silent = false}) {
|
||||
_settings = _settings.copyWith(alwaysExportEnabled: enabled);
|
||||
Storage.saveSettings(_settings);
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
}
|
||||
25
lib/service/share_intent_service.dart
Normal file
25
lib/service/share_intent_service.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class ShareIntentService {
|
||||
factory ShareIntentService() {
|
||||
_instance ??= ShareIntentService._internal();
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
ShareIntentService._internal();
|
||||
|
||||
static ShareIntentService? _instance;
|
||||
static const _platform = MethodChannel('app.channel.shared.data');
|
||||
|
||||
Future<String> getSharedMapsLink() async {
|
||||
final String? sharedText = await _platform.invokeMethod('getSharedText');
|
||||
if (sharedText != null && _isGoogleMapsLink(sharedText)) return sharedText;
|
||||
return '';
|
||||
}
|
||||
|
||||
bool _isGoogleMapsLink(String text) {
|
||||
return text.contains('maps.google.com') ||
|
||||
text.contains('maps.app.goo.gl') ||
|
||||
text.contains('goo.gl/maps');
|
||||
}
|
||||
}
|
||||
24
lib/service/shared_link_provider.dart
Normal file
24
lib/service/shared_link_provider.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:metadata_fetch/metadata_fetch.dart';
|
||||
|
||||
import '../model/maps_link_metadata.dart';
|
||||
|
||||
class SharedLinkProvider extends ChangeNotifier {
|
||||
MapsLinkMetadata? _currentMapsLinkMetadata;
|
||||
|
||||
void setCurrentMapsLink(String mapsLink, {bool silent = false}) async {
|
||||
final metadata = await MetadataFetch.extract(mapsLink);
|
||||
_currentMapsLinkMetadata = MapsLinkMetadata(
|
||||
url: mapsLink,
|
||||
placeName: metadata?.title ?? '',
|
||||
);
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
|
||||
void removeCurrentMapsLink({bool silent = false}) {
|
||||
_currentMapsLinkMetadata = null;
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
|
||||
MapsLinkMetadata? get currentMapsLinkMetadata => _currentMapsLinkMetadata;
|
||||
}
|
||||
221
lib/service/storage.dart
Normal file
221
lib/service/storage.dart
Normal file
@@ -0,0 +1,221 @@
|
||||
import 'dart:convert' show jsonDecode, jsonEncode;
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../model/bookmark.dart';
|
||||
import '../model/collection.dart';
|
||||
import '../model/settings.dart';
|
||||
import 'json_file_service.dart';
|
||||
|
||||
class Storage {
|
||||
static const String _bookmarksKey = 'bookmarks';
|
||||
static const String _collectionsKey = 'collections';
|
||||
static SharedPreferencesWithCache? _prefsWithCache;
|
||||
static const String _settingsKey = 'settings';
|
||||
static const String _statsKey = 'stats';
|
||||
static Settings _currentSettings = Settings.defaults();
|
||||
|
||||
static Future<void> initialize() async {
|
||||
_prefsWithCache = await SharedPreferencesWithCache.create(
|
||||
cacheOptions: const SharedPreferencesWithCacheOptions(
|
||||
allowList: <String>{
|
||||
_collectionsKey,
|
||||
_bookmarksKey,
|
||||
_statsKey,
|
||||
_settingsKey,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Settings loadSettings() {
|
||||
final jsonString = _prefs.getString(_settingsKey);
|
||||
if (jsonString != null) {
|
||||
final json = jsonDecode(jsonString) as Map<String, dynamic>;
|
||||
_currentSettings = Settings.fromJson(json);
|
||||
return _currentSettings;
|
||||
} else {
|
||||
final settings = Settings.defaults();
|
||||
saveSettings(settings);
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> saveSettings(Settings settings) {
|
||||
final json = jsonEncode(settings.toJson());
|
||||
_currentSettings = settings;
|
||||
return _prefs.setString(_settingsKey, json);
|
||||
}
|
||||
|
||||
static List<Collection> loadCollections() {
|
||||
final jsonString = _prefs.getString(_collectionsKey) ?? '[]';
|
||||
final jsonList = jsonDecode(jsonString) as List;
|
||||
return jsonList
|
||||
.map((json) => Collection.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
static List<Bookmark> loadBookmarks() {
|
||||
final jsonString = _prefs.getString(_bookmarksKey) ?? '[]';
|
||||
final jsonList = jsonDecode(jsonString) as List;
|
||||
return jsonList
|
||||
.map((json) => Bookmark.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
static Future<void> saveCollections(List<Collection> collections) async {
|
||||
final jsonList = collections.map((c) => c.toJson()).toList();
|
||||
await _prefs.setString(_collectionsKey, jsonEncode(jsonList));
|
||||
if (_currentSettings.alwaysExportEnabled) saveDataToFile();
|
||||
}
|
||||
|
||||
static Future<void> saveBookmarks(List<Bookmark> bookmarks) async {
|
||||
final jsonList = bookmarks.map((b) => b.toJson()).toList();
|
||||
await _prefs.setString(_bookmarksKey, jsonEncode(jsonList));
|
||||
if (_currentSettings.alwaysExportEnabled) saveDataToFile();
|
||||
}
|
||||
|
||||
static List<Bookmark> loadBookmarksForCollection(int collectionId) {
|
||||
final allBookmarks = loadBookmarks();
|
||||
return allBookmarks.where((b) => b.collectionId == collectionId).toList();
|
||||
}
|
||||
|
||||
static Map<int, int> loadPerCollectionBookmarkCount() {
|
||||
return loadBookmarks().fold(<int, int>{}, (map, bookmark) {
|
||||
map[bookmark.collectionId] ??= 0;
|
||||
map[bookmark.collectionId] = map[bookmark.collectionId]! + 1;
|
||||
return map;
|
||||
});
|
||||
}
|
||||
|
||||
static Future<void> addBookmark(Bookmark bookmark) async {
|
||||
final bookmarks = loadBookmarks();
|
||||
bookmarks.add(bookmark);
|
||||
await saveBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
static Future<void> addOrUpdateBookmark(Bookmark bookmark) async {
|
||||
final bookmarks = loadBookmarks();
|
||||
final index = bookmarks.indexWhere((b) => b.id == bookmark.id);
|
||||
|
||||
if (index == -1) {
|
||||
bookmarks.add(bookmark);
|
||||
} else if (index >= 0) {
|
||||
bookmarks[index] = bookmark;
|
||||
}
|
||||
await saveBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
static Future<void> addOrUpdateCollection(Collection collection) async {
|
||||
final collections = loadCollections();
|
||||
final index = collections.indexWhere((b) => b.id == collection.id);
|
||||
|
||||
if (index == -1) {
|
||||
collections.add(collection);
|
||||
} else if (index >= 0) {
|
||||
collections[index] = collection;
|
||||
}
|
||||
await saveCollections(collections);
|
||||
}
|
||||
|
||||
static Future<void> updateBookmarkById(
|
||||
int bookmarkId, {
|
||||
String? name,
|
||||
String? description,
|
||||
String? link,
|
||||
}) async {
|
||||
final bookmarks = loadBookmarks();
|
||||
final index = bookmarks.indexWhere((b) => b.id == bookmarkId);
|
||||
|
||||
if (index == -1) return;
|
||||
|
||||
if (name != null) bookmarks[index].name = name;
|
||||
if (description != null) bookmarks[index].description = description;
|
||||
if (link != null) bookmarks[index].link = link;
|
||||
|
||||
await saveBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
static Future<void> deleteBookmark(Bookmark bookmark) async {
|
||||
final bookmarks = loadBookmarks();
|
||||
bookmarks.remove(bookmark);
|
||||
await saveBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
static Future<void> deleteBookmarkById(int bookmarkId) async {
|
||||
final bookmarks = loadBookmarks();
|
||||
bookmarks.removeWhere((b) => b.id == bookmarkId);
|
||||
await saveBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
static Future<void> deleteBookmarksForCollection(int collectionId) async {
|
||||
final bookmarks = loadBookmarks();
|
||||
bookmarks.removeWhere((b) => b.collectionId == collectionId);
|
||||
await saveBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
static Future<void> deleteCollection(Collection collection) async {
|
||||
final collections = loadCollections();
|
||||
final bookmarks = loadBookmarks();
|
||||
bookmarks.removeWhere((bookmark) => bookmark.collectionId == collection.id);
|
||||
collections.remove(collection);
|
||||
await saveBookmarks(bookmarks);
|
||||
await saveCollections(collections);
|
||||
}
|
||||
|
||||
static Map<String, int> getStats() {
|
||||
final statsJson = _prefs.getString(_statsKey) ?? '{}';
|
||||
final stats = jsonDecode(statsJson) as Map<String, dynamic>;
|
||||
return {
|
||||
'totalCollections': stats['totalCollections'] ?? 0,
|
||||
'totalBookmarks': stats['totalBookmarks'] ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
static Future<void> updateStats() async {
|
||||
final collections = loadCollections();
|
||||
final bookmarks = loadBookmarks();
|
||||
|
||||
final stats = {
|
||||
'totalCollections': collections.length,
|
||||
'totalBookmarks': bookmarks.length,
|
||||
'lastUpdated': DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
|
||||
await _prefs.setString(_statsKey, jsonEncode(stats));
|
||||
}
|
||||
|
||||
static Future<bool> exportToJsonFile() => JsonFileService.exportToJson(
|
||||
collections: loadCollections(),
|
||||
bookmarks: loadBookmarks(),
|
||||
);
|
||||
|
||||
static Future<bool> importFromJsonFile() async {
|
||||
final import = await JsonFileService.importFromJson();
|
||||
|
||||
if (import.bookmarks.isNotEmpty || import.collections.isNotEmpty) {
|
||||
saveBookmarks(import.bookmarks);
|
||||
saveCollections(import.collections);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static Future<String> selectDirectoryPath() =>
|
||||
JsonFileService.selectDirectoryPath();
|
||||
|
||||
static Future<bool> saveDataToFile() => JsonFileService.saveDataToFile(
|
||||
loadCollections(),
|
||||
loadBookmarks(),
|
||||
_currentSettings.exportDirectoryPath,
|
||||
);
|
||||
|
||||
static SharedPreferencesWithCache get _prefs {
|
||||
if (_prefsWithCache == null) {
|
||||
throw StateError(
|
||||
'BookmarkStorage not initialized. Call initialize() first.',
|
||||
);
|
||||
}
|
||||
return _prefsWithCache!;
|
||||
}
|
||||
}
|
||||
14
lib/service/url_launcher.dart
Normal file
14
lib/service/url_launcher.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
Future<UrlLaunchErrorCode> launchUrlFromString(String url) async {
|
||||
final Uri? uri = Uri.tryParse(url);
|
||||
final isValid =
|
||||
uri != null && uri.hasAbsolutePath && uri.scheme.startsWith('http');
|
||||
if (!isValid) return UrlLaunchErrorCode.invalidUrl;
|
||||
if (!await launchUrl(uri, mode: LaunchMode.externalApplication)) {
|
||||
return UrlLaunchErrorCode.couldNotLaunch;
|
||||
}
|
||||
return UrlLaunchErrorCode.none;
|
||||
}
|
||||
|
||||
enum UrlLaunchErrorCode { none, couldNotLaunch, invalidUrl }
|
||||
30
lib/theme.dart
Normal file
30
lib/theme.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const _seed = Colors.deepPurple;
|
||||
|
||||
ColorScheme get _lightColorScheme =>
|
||||
ColorScheme.fromSeed(seedColor: _seed, brightness: Brightness.light);
|
||||
|
||||
ColorScheme get _darkColorScheme =>
|
||||
ColorScheme.fromSeed(seedColor: _seed, brightness: Brightness.dark);
|
||||
|
||||
ThemeData get lightTheme => _baseTheme(_lightColorScheme);
|
||||
|
||||
ThemeData get darkTheme => _baseTheme(_darkColorScheme);
|
||||
|
||||
ThemeData _baseTheme(ColorScheme scheme) =>
|
||||
ThemeData.from(colorScheme: scheme, useMaterial3: true).copyWith(
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
listTileTheme: ListTileThemeData(
|
||||
tileColor: scheme.surfaceContainer,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusGeometry.circular(12),
|
||||
),
|
||||
textColor: scheme.onPrimaryContainer,
|
||||
selectedTileColor: scheme.primaryContainer,
|
||||
selectedColor: scheme.onPrimaryContainer,
|
||||
contentPadding: EdgeInsetsDirectional.only(start: 16.0, end: 24.0),
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ListItemActionsWidget extends StatelessWidget {
|
||||
final VoidCallback _onDeletePressed;
|
||||
final VoidCallback _onCancelPressed;
|
||||
final VoidCallback _onEditPressed;
|
||||
|
||||
const ListItemActionsWidget({
|
||||
super.key,
|
||||
required void Function() onDeletePressed,
|
||||
required void Function() onCancelPressed,
|
||||
required void Function() onEditPressed,
|
||||
}) : _onEditPressed = onEditPressed,
|
||||
_onCancelPressed = onCancelPressed,
|
||||
_onDeletePressed = onDeletePressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsetsGeometry.fromLTRB(
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
MediaQuery.of(context).viewPadding.bottom,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _onCancelPressed,
|
||||
icon: const Icon(Icons.close_rounded),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _onDeletePressed,
|
||||
icon: const Icon(Icons.delete_forever_rounded),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _onEditPressed,
|
||||
icon: const Icon(Icons.edit_rounded),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
60
lib/widgets/create_bookmark_collection_dialog.dart
Normal file
60
lib/widgets/create_bookmark_collection_dialog.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../model/collection.dart';
|
||||
import 'edit_dialog_widgets/edit_dialog_actions.dart' show EditDialogActions;
|
||||
import 'edit_dialog_widgets/edit_dialog_title.dart';
|
||||
|
||||
class CreateBookmarkCollectionDialog extends StatelessWidget {
|
||||
const CreateBookmarkCollectionDialog({
|
||||
super.key,
|
||||
required this.onSavePressed,
|
||||
this.onDeletePressed,
|
||||
this.selectedCollection,
|
||||
});
|
||||
|
||||
final void Function()? onDeletePressed;
|
||||
final void Function(Collection collection) onSavePressed;
|
||||
final Collection? selectedCollection;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final nameController = TextEditingController();
|
||||
|
||||
if (selectedCollection != null) {
|
||||
nameController.text = selectedCollection!.name;
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: EditDialogTitle(
|
||||
dialogType: DialogType.collection,
|
||||
onDeletePressed: onDeletePressed,
|
||||
),
|
||||
content: TextField(
|
||||
controller: nameController,
|
||||
autofocus: true,
|
||||
maxLines: 1,
|
||||
maxLength: 50,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9äöüÄÖÜß\s]')),
|
||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.collectionName,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
EditDialogActions(
|
||||
onSavePressed: () {
|
||||
final bookmark =
|
||||
selectedCollection?.copyWith(name: nameController.text) ??
|
||||
Collection(name: nameController.text);
|
||||
onSavePressed(bookmark);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
119
lib/widgets/create_bookmark_dialog.dart
Normal file
119
lib/widgets/create_bookmark_dialog.dart
Normal file
@@ -0,0 +1,119 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../model/bookmark.dart';
|
||||
import '../model/maps_link_metadata.dart';
|
||||
import 'edit_dialog_widgets/edit_dialog_actions.dart';
|
||||
import 'edit_dialog_widgets/edit_dialog_title.dart';
|
||||
|
||||
class CreateBookmarkDialog extends StatelessWidget {
|
||||
const CreateBookmarkDialog({
|
||||
super.key,
|
||||
required this.collectionId,
|
||||
this.onSavePressed,
|
||||
this.onDeletePressed,
|
||||
this.selectedBookmark,
|
||||
this.selectedMapsLink,
|
||||
});
|
||||
|
||||
final void Function(Bookmark bookmark)? onSavePressed;
|
||||
final void Function()? onDeletePressed;
|
||||
final int collectionId;
|
||||
final Bookmark? selectedBookmark;
|
||||
final MapsLinkMetadata? selectedMapsLink;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final nameController = TextEditingController();
|
||||
final linkController = TextEditingController();
|
||||
final descriptionController = TextEditingController();
|
||||
|
||||
if (selectedMapsLink != null) {
|
||||
nameController.text = selectedMapsLink!.placeName;
|
||||
linkController.text = selectedMapsLink!.url;
|
||||
descriptionController.text = selectedMapsLink!.description;
|
||||
} else if (selectedBookmark != null) {
|
||||
nameController.text = selectedBookmark!.name;
|
||||
linkController.text = selectedBookmark!.link;
|
||||
descriptionController.text = selectedBookmark!.description;
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: EditDialogTitle(
|
||||
dialogType: DialogType.bookmark,
|
||||
onDeletePressed: onDeletePressed,
|
||||
),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||
TextField(
|
||||
controller: nameController,
|
||||
autofocus: true,
|
||||
maxLines: 1,
|
||||
maxLength: 50,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'[a-zA-Z0-9äöüÄÖÜß\s]'),
|
||||
),
|
||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.bookmarkTitle,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
controller: linkController,
|
||||
maxLines: 1,
|
||||
maxLength: 50,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'[a-zA-Z0-9äöüÄÖÜß\s/:\.]'),
|
||||
),
|
||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.url,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
controller: descriptionController,
|
||||
maxLines: 3,
|
||||
maxLength: 300,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'[a-zA-Z0-9äöüÄÖÜß\s]'),
|
||||
),
|
||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.description,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
EditDialogActions(
|
||||
onSavePressed: () {
|
||||
final bookmark =
|
||||
selectedBookmark?.copyWith(
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
) ??
|
||||
Bookmark(
|
||||
collectionId: collectionId,
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
);
|
||||
onSavePressed?.call(bookmark);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
24
lib/widgets/edit_dialog_widgets/edit_dialog_actions.dart
Normal file
24
lib/widgets/edit_dialog_widgets/edit_dialog_actions.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart'
|
||||
show TextButton, FloatingActionButton, Icons;
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
class EditDialogActions extends StatelessWidget {
|
||||
const EditDialogActions({super.key, required this.onSavePressed});
|
||||
final VoidCallback onSavePressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(AppLocalizations.of(context)!.cancel),
|
||||
),
|
||||
FloatingActionButton(onPressed: onSavePressed, child: Icon(Icons.save)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
41
lib/widgets/edit_dialog_widgets/edit_dialog_title.dart
Normal file
41
lib/widgets/edit_dialog_widgets/edit_dialog_title.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart' show TextButton, Theme;
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
class EditDialogTitle extends StatelessWidget {
|
||||
const EditDialogTitle({
|
||||
super.key,
|
||||
this.onDeletePressed,
|
||||
required this.dialogType,
|
||||
});
|
||||
final VoidCallback? onDeletePressed;
|
||||
final DialogType dialogType;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (dialogType == DialogType.bookmark)
|
||||
Text(AppLocalizations.of(context)!.createBookmark)
|
||||
else
|
||||
Text(AppLocalizations.of(context)!.createCollection),
|
||||
|
||||
if (onDeletePressed != null)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
onDeletePressed!.call();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum DialogType { bookmark, collection }
|
||||
37
lib/widgets/search_widgets/search_bar_widget.dart
Normal file
37
lib/widgets/search_widgets/search_bar_widget.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
class SearchBarWidget extends StatelessWidget {
|
||||
const SearchBarWidget({
|
||||
super.key,
|
||||
required this.onEditingComplete,
|
||||
required this.onResetSearch,
|
||||
});
|
||||
|
||||
final Function(String searchString) onEditingComplete;
|
||||
final Function() onResetSearch;
|
||||
|
||||
void onChanged(String text, BuildContext context) {
|
||||
if (context.mounted) onEditingComplete(text);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final searchTextController = TextEditingController();
|
||||
return TextField(
|
||||
controller: searchTextController,
|
||||
onChanged: (text) => onChanged(text, context),
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
searchTextController.clear();
|
||||
onResetSearch();
|
||||
},
|
||||
icon: Icon(Icons.delete_outline_outlined),
|
||||
),
|
||||
labelText: AppLocalizations.of(context)!.search,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
58
lib/widgets/search_widgets/search_results_widget.dart
Normal file
58
lib/widgets/search_widgets/search_results_widget.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../model/bookmark.dart';
|
||||
import '../../service/notifying.dart';
|
||||
import '../../service/search_provider.dart';
|
||||
import '../../service/storage.dart' show Storage;
|
||||
import '../../service/url_launcher.dart';
|
||||
|
||||
class SearchResultsWidget extends StatefulWidget {
|
||||
const SearchResultsWidget({super.key});
|
||||
|
||||
@override
|
||||
State<SearchResultsWidget> createState() => _SearchResultsWidgetState();
|
||||
}
|
||||
|
||||
class _SearchResultsWidgetState extends State<SearchResultsWidget> {
|
||||
final List<Bookmark> allBookmarks = Storage.loadBookmarks();
|
||||
|
||||
@override
|
||||
void deactivate() {
|
||||
context.read<SearchProvider>().removeSearchText(silent: true);
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
Widget bookmarkListItemBuilder(BuildContext context, int index) {
|
||||
final bookmark = filteredBookmarks.elementAt(index);
|
||||
return ListTile(
|
||||
title: Text(bookmark.name),
|
||||
onTap: () => launchUrlFromString(bookmark.link).then((errorCode) {
|
||||
if (context.mounted && errorCode != UrlLaunchErrorCode.none) {
|
||||
Notifying.showUrlErrorSnackbar(context, errorCode);
|
||||
} else if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Iterable<Bookmark> get filteredBookmarks => allBookmarks.where(
|
||||
(bookmark) => bookmark.name.toLowerCase().contains(
|
||||
context.watch<SearchProvider>().searchText.toLowerCase(),
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (filteredBookmarks.isNotEmpty) {
|
||||
return ListView.separated(
|
||||
itemBuilder: bookmarkListItemBuilder,
|
||||
itemCount: filteredBookmarks.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||
);
|
||||
}
|
||||
return Center(child: Text(AppLocalizations.of(context)!.tipNoResults));
|
||||
}
|
||||
}
|
||||
422
pubspec.lock
422
pubspec.lock
@@ -1,6 +1,14 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
android_intent_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: android_intent_plus
|
||||
sha256: "14a9f94c5825a528e8c38ee89a33dbeba947efbbf76f066c174f4f3ae4f48feb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -41,6 +49,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cross_file
|
||||
sha256: "701dcfc06da0882883a2657c445103380e53e647060ad8d9dfb710c100996608"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.5+1"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csslib
|
||||
sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -57,6 +81,86 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.3"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.1"
|
||||
file_selector:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: file_selector
|
||||
sha256: bd15e43e9268db636b53eeaca9f56324d1622af30e5c34d6e267649758c84d9a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
file_selector_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_android
|
||||
sha256: "51e8fd0446de75e4b62c065b76db2210c704562d072339d333bd89c57a7f8a7c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.2+4"
|
||||
file_selector_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_ios
|
||||
sha256: e2ecf2885c121691ce13b60db3508f53c01f869fb6e8dc5c1cfa771e4c46aeca
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.3+5"
|
||||
file_selector_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_linux
|
||||
sha256: "2567f398e06ac72dcf2e98a0c95df2a9edd03c2c2e0cacd4780f20cdf56263a0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.4"
|
||||
file_selector_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_macos
|
||||
sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.5"
|
||||
file_selector_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_platform_interface
|
||||
sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
file_selector_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_web
|
||||
sha256: c4c0ea4224d97a60a7067eca0c8fd419e708ff830e0c83b11a48faf566cec3e7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.4+2"
|
||||
file_selector_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_windows
|
||||
sha256: "62197474ae75893a62df75939c777763d39c2bc5f73ce5b88497208bc269abfd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.3+5"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -66,15 +170,57 @@ packages:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
|
||||
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
version: "6.0.0"
|
||||
flutter_localizations:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: html
|
||||
sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.15.6"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.20.2"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -103,10 +249,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
|
||||
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.1"
|
||||
version: "6.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -127,10 +273,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
|
||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
version: "1.17.0"
|
||||
metadata_fetch:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: metadata_fetch
|
||||
sha256: "24a713eaddbebea3dc3036a6c1d6f7c57e187fff5f0ef07be3e3ebbb7820c3e7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.2"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -139,6 +301,86 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
permission_handler:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: permission_handler
|
||||
sha256: bc917da36261b00137bbc8896bf1482169cd76f866282368948f032c8c1caae1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.0.1"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.0.1"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.7"
|
||||
permission_handler_html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_html
|
||||
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3+5"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.3.0"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -147,14 +389,70 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
receive_sharing_intent:
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: receive_sharing_intent
|
||||
sha256: ec76056e4d258ad708e76d85591d933678625318e411564dcb9059048ca3a593
|
||||
name: provider
|
||||
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "6.1.5+1"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: shared_preferences
|
||||
sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.3"
|
||||
shared_preferences_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_android
|
||||
sha256: "83af5c682796c0f7719c2bbf74792d113e40ae97981b8f266fa84574573556bc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.18"
|
||||
shared_preferences_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_foundation
|
||||
sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.6"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_linux
|
||||
sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shared_preferences_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_platform_interface
|
||||
sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shared_preferences_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_web
|
||||
sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.3"
|
||||
shared_preferences_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_windows
|
||||
sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -192,6 +490,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
string_validator:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_validator
|
||||
sha256: "240f4c98027dfbe8639c8271ef18cc9de735b47067aa15a720cfed9576a512b1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -204,10 +510,82 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
|
||||
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.6"
|
||||
version: "0.7.7"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.2"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "767344bf3063897b5cf0db830e94f904528e6dd50a6dfaf839f0abf509009611"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.28"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: cfde38aa257dae62ffe79c87fab20165dfdf6988c1d31b58ebf59b9106062aad
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.6"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.5"
|
||||
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: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.5"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -224,6 +602,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.0.2"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
sdks:
|
||||
dart: ">=3.9.2 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
dart: ">=3.10.0 <4.0.0"
|
||||
flutter: ">=3.38.0"
|
||||
|
||||
17
pubspec.yaml
17
pubspec.yaml
@@ -3,7 +3,7 @@ description: "A new way to save google maps bookmarks"
|
||||
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.0.0+1
|
||||
version: 0.0.18
|
||||
|
||||
environment:
|
||||
sdk: ^3.9.2
|
||||
@@ -13,14 +13,23 @@ dependencies:
|
||||
sdk: flutter
|
||||
|
||||
cupertino_icons: ^1.0.8
|
||||
receive_sharing_intent: ^1.8.1
|
||||
android_intent_plus: ^6.0.0
|
||||
shared_preferences: ^2.3.2
|
||||
provider: ^6.1.5+1
|
||||
metadata_fetch: ^0.4.2
|
||||
url_launcher: ^6.3.2
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
intl: any
|
||||
permission_handler: ^12.0.1
|
||||
file_selector: ^1.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
flutter_lints: ^5.0.0
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
flutter:
|
||||
|
||||
generate: true
|
||||
uses-material-design: true
|
||||
Reference in New Issue
Block a user