Compare commits
9 Commits
f64ed77b75
...
4970836c60
| Author | SHA1 | Date | |
|---|---|---|---|
| 4970836c60 | |||
| 90539932ec | |||
| 69c00cca3e | |||
| 603060fe58 | |||
| ef9a369df1 | |||
| 651e52485c | |||
| fbec875334 | |||
| 56e277593d | |||
| 0502d82509 |
@@ -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
|
||||
|
||||
@@ -27,18 +27,8 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/*"/>
|
||||
<data android:mimeType="text/plain" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<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" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
|
||||
@@ -1,5 +1,44 @@
|
||||
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
|
||||
|
||||
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) {
|
||||
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
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'pages/collections_page.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
runApp(const MapsBookmarks());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
class MapsBookmarks extends StatelessWidget {
|
||||
const MapsBookmarks({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
),
|
||||
initialRoute: CollectionsPage.routeName,
|
||||
routes: {CollectionsPage.routeName: (context) => const CollectionsPage()},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
13
lib/model/bookmark.dart
Normal file
13
lib/model/bookmark.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class Bookmark extends HiveObject {
|
||||
Bookmark({required this.name, required this.link});
|
||||
|
||||
factory Bookmark.fromJson(Map<String, dynamic> json) =>
|
||||
Bookmark(name: json['name'] as String, link: json['link'] as String);
|
||||
|
||||
String link;
|
||||
String name;
|
||||
|
||||
Map<String, dynamic> toJson() => {'name': name, 'link': link};
|
||||
}
|
||||
12
lib/model/collection.dart
Normal file
12
lib/model/collection.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class Collection extends HiveObject {
|
||||
Collection({required this.name});
|
||||
|
||||
factory Collection.fromJson(Map<String, dynamic> json) =>
|
||||
Collection(name: json['name'] as String);
|
||||
|
||||
String name;
|
||||
|
||||
Map<String, dynamic> toJson() => {'name': name};
|
||||
}
|
||||
33
lib/pages/collections_page.dart
Normal file
33
lib/pages/collections_page.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../widgets/create_bookmark_collection_dialog.dart';
|
||||
|
||||
class CollectionsPage extends StatefulWidget {
|
||||
const CollectionsPage({super.key});
|
||||
static const String routeName = '/collections';
|
||||
|
||||
@override
|
||||
State<CollectionsPage> createState() => _CollectionsPageState();
|
||||
}
|
||||
|
||||
class _CollectionsPageState extends State<CollectionsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => CreateBookmarkCollectionDialog(),
|
||||
),
|
||||
child: Icon(Icons.add),
|
||||
),
|
||||
body: ListView(),
|
||||
);
|
||||
}
|
||||
|
||||
void onAddButtonPressed() => showDialog(
|
||||
context: context,
|
||||
builder: (context) => CreateBookmarkCollectionDialog(),
|
||||
);
|
||||
}
|
||||
29
lib/widgets/create_bookmark_collection_dialog.dart
Normal file
29
lib/widgets/create_bookmark_collection_dialog.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class CreateBookmarkCollectionDialog extends StatelessWidget {
|
||||
const CreateBookmarkCollectionDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('Create Collection'),
|
||||
content: TextField(
|
||||
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: 'Collection Name',
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FloatingActionButton(onPressed: () {}, child: Icon(Icons.save)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
24
pubspec.lock
24
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:
|
||||
@@ -139,22 +147,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
plugin_platform_interface:
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||
name: platform
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
receive_sharing_intent:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: receive_sharing_intent
|
||||
sha256: ec76056e4d258ad708e76d85591d933678625318e411564dcb9059048ca3a593
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "3.1.6"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
||||
@@ -13,7 +13,7 @@ dependencies:
|
||||
sdk: flutter
|
||||
|
||||
cupertino_icons: ^1.0.8
|
||||
receive_sharing_intent: ^1.8.1
|
||||
android_intent_plus: ^6.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user