mirror of
https://github.com/rainloreley/shlink-manager.git
synced 2025-04-19 22:39:38 +02:00
Compare commits
No commits in common. "main" and "v1.1.0" have entirely different histories.
16
.metadata
16
.metadata
@ -1,11 +1,11 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
# This file should be version controlled.
|
||||
|
||||
version:
|
||||
revision: "2f708eb8396e362e280fac22cf171c2cb467343c"
|
||||
channel: "stable"
|
||||
revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
|
||||
@ -13,11 +13,11 @@ project_type: app
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
|
||||
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
|
||||
- platform: linux
|
||||
create_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
|
||||
base_revision: 2f708eb8396e362e280fac22cf171c2cb467343c
|
||||
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
|
||||
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
|
||||
- platform: android
|
||||
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
|
||||
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
|
||||
|
||||
# User provided section
|
||||
|
||||
|
14
README.md
14
README.md
@ -12,22 +12,22 @@ Shlink Manager is an app for Android to see and manage all shortened URLs create
|
||||
<img src="https://raw.githubusercontent.com/steverichey/google-play-badge-svg/master/img/en_get.svg" alt="Play Store download" width="30%"/>
|
||||
</a>
|
||||
|
||||
[](https://codemagic.io/apps/66096ec96d57699debb805f8/66096ec96d57699debb805f7/latest_build)
|
||||
|
||||
## 📱 Current Features
|
||||
|
||||
✅ List all short URLs<br/>
|
||||
✅ Create, edit and delete short URLs<br/>
|
||||
✅ Create new short URLs<br/>
|
||||
✅ Delete short URLs<br/>
|
||||
✅ See overall statistics<br/>
|
||||
✅ Detailed statistics for each short URL<br/>
|
||||
✅ Display tags & QR code<br/>
|
||||
✅ Display tags<br/>
|
||||
✅ Display QR code<br/>
|
||||
✅ Dark mode support<br/>
|
||||
✅ Quickly create Short URL via Share Sheet<br/>
|
||||
✅ View rule-based redirects (no editing yet)<br/>
|
||||
✅ Use multiple Shlink instances<br/>
|
||||
✅ Edit existing short URLs<br/>
|
||||
|
||||
## 🔨 To Do
|
||||
- [ ] Add support for iOS (maybe in the future)
|
||||
- [ ] add tags
|
||||
- [ ] specify individual long URLs per device
|
||||
- [ ] improve app icon
|
||||
- [ ] Refactor code
|
||||
- [ ] ...and more
|
||||
|
@ -52,12 +52,10 @@ android {
|
||||
applicationId "dev.abmgrt.shlink_app"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion //flutter.minSdkVersion
|
||||
minSdkVersion 19 //flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@ -81,5 +79,4 @@ flutter {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
|
||||
</queries>
|
||||
<application
|
||||
android:label="Shlink Manager"
|
||||
@ -34,11 +33,17 @@
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<intent-filter
|
||||
android:label="Create Short URL">
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ProcessURLActivity"
|
||||
android:label="Shorten URL"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.NoDisplay"
|
||||
tools:targetApi="cupcake">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT" />
|
||||
<data android:mimeType="text/plain"/>
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
// Generated file.
|
||||
//
|
||||
// If you wish to remove Flutter's multidex support, delete this entire file.
|
||||
//
|
||||
// Modifications to this file should be done in a copy under a different name
|
||||
// as this file may be regenerated.
|
||||
|
||||
package io.flutter.app;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.multidex.MultiDex;
|
||||
|
||||
/**
|
||||
* Extension of {@link android.app.Application}, adding multidex support.
|
||||
*/
|
||||
public class FlutterMultiDexApplication extends Application {
|
||||
@Override
|
||||
@CallSuper
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(this);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||
|
@ -1,41 +0,0 @@
|
||||
enum ConditionDeviceType {
|
||||
IOS,
|
||||
ANDROID,
|
||||
DESKTOP;
|
||||
|
||||
static ConditionDeviceType fromApi(String api) {
|
||||
switch (api) {
|
||||
case "ios":
|
||||
return ConditionDeviceType.IOS;
|
||||
case "android":
|
||||
return ConditionDeviceType.ANDROID;
|
||||
case "desktop":
|
||||
return ConditionDeviceType.DESKTOP;
|
||||
}
|
||||
throw ArgumentError("Invalid type $api");
|
||||
}
|
||||
}
|
||||
|
||||
extension ConditionTypeExtension on ConditionDeviceType {
|
||||
String get api {
|
||||
switch (this) {
|
||||
case ConditionDeviceType.IOS:
|
||||
return "ios";
|
||||
case ConditionDeviceType.ANDROID:
|
||||
return "android";
|
||||
case ConditionDeviceType.DESKTOP:
|
||||
return "desktop";
|
||||
}
|
||||
}
|
||||
|
||||
String get humanReadable {
|
||||
switch (this) {
|
||||
case ConditionDeviceType.IOS:
|
||||
return "iOS";
|
||||
case ConditionDeviceType.ANDROID:
|
||||
return "Android";
|
||||
case ConditionDeviceType.DESKTOP:
|
||||
return "Desktop";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule_condition.dart';
|
||||
|
||||
/// Single redirect rule for a short URL.
|
||||
class RedirectRule {
|
||||
String longUrl;
|
||||
int priority;
|
||||
List<RedirectRuleCondition> conditions;
|
||||
|
||||
RedirectRule(this.longUrl, this.priority, this.conditions);
|
||||
|
||||
RedirectRule.fromJson(Map<String, dynamic> json)
|
||||
: longUrl = json["longUrl"],
|
||||
priority = json["priority"],
|
||||
conditions = (json["conditions"] as List<dynamic>)
|
||||
.map((e) => RedirectRuleCondition.fromJson(e))
|
||||
.toList();
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"longUrl": longUrl,
|
||||
"conditions": conditions.map((e) => e.toJson()).toList()
|
||||
};
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule_condition_type.dart';
|
||||
|
||||
class RedirectRuleCondition {
|
||||
RedirectRuleConditionType type;
|
||||
String matchValue;
|
||||
String? matchKey;
|
||||
|
||||
RedirectRuleCondition(String type, this.matchValue, this.matchKey)
|
||||
: type = RedirectRuleConditionType.fromApi(type);
|
||||
|
||||
RedirectRuleCondition.fromJson(Map<String, dynamic> json)
|
||||
: type = RedirectRuleConditionType.fromApi(json["type"]),
|
||||
matchValue = json["matchValue"],
|
||||
matchKey = json["matchKey"];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {"type": type.api, "matchValue": matchValue, "matchKey": matchKey};
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
enum RedirectRuleConditionType {
|
||||
DEVICE,
|
||||
LANGUAGE,
|
||||
QUERY_PARAM;
|
||||
|
||||
static RedirectRuleConditionType fromApi(String api) {
|
||||
switch (api) {
|
||||
case "device":
|
||||
return RedirectRuleConditionType.DEVICE;
|
||||
case "language":
|
||||
return RedirectRuleConditionType.LANGUAGE;
|
||||
case "query-param":
|
||||
return RedirectRuleConditionType.QUERY_PARAM;
|
||||
}
|
||||
throw ArgumentError("Invalid type $api");
|
||||
}
|
||||
}
|
||||
|
||||
extension ConditionTypeExtension on RedirectRuleConditionType {
|
||||
String get api {
|
||||
switch (this) {
|
||||
case RedirectRuleConditionType.DEVICE:
|
||||
return "device";
|
||||
case RedirectRuleConditionType.LANGUAGE:
|
||||
return "language";
|
||||
case RedirectRuleConditionType.QUERY_PARAM:
|
||||
return "query-param";
|
||||
}
|
||||
}
|
||||
|
||||
String get humanReadable {
|
||||
switch (this) {
|
||||
case RedirectRuleConditionType.DEVICE:
|
||||
return "Device";
|
||||
case RedirectRuleConditionType.LANGUAGE:
|
||||
return "Language";
|
||||
case RedirectRuleConditionType.QUERY_PARAM:
|
||||
return "Query parameter";
|
||||
}
|
||||
}
|
||||
}
|
23
lib/API/Classes/ShortURL/device_long_urls.dart
Normal file
23
lib/API/Classes/ShortURL/device_long_urls.dart
Normal file
@ -0,0 +1,23 @@
|
||||
/// Data about device-specific long URLs for one short URL
|
||||
class DeviceLongUrls {
|
||||
/// Custom URL for Android devices
|
||||
final String? android;
|
||||
|
||||
/// Custom URL for iOS devices
|
||||
final String? ios;
|
||||
|
||||
/// Custom URL for desktop
|
||||
final String? desktop;
|
||||
|
||||
DeviceLongUrls(this.android, this.ios, this.desktop);
|
||||
|
||||
/// Converts JSON data from the API to an instance of [DeviceLongUrls]
|
||||
DeviceLongUrls.fromJson(Map<String, dynamic> json)
|
||||
: android = json["android"],
|
||||
ios = json["ios"],
|
||||
desktop = json["desktop"];
|
||||
|
||||
/// Converts data from this class to an JSON object of type
|
||||
Map<String, dynamic> toJson() =>
|
||||
{"android": android, "ios": ios, "desktop": desktop};
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
import 'package:shlink_app/API/Classes/ShortURL/device_long_urls.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/short_url_meta.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/visits_summary.dart';
|
||||
|
||||
import 'RedirectRule/redirect_rule.dart';
|
||||
|
||||
/// Data about a short URL
|
||||
class ShortURL {
|
||||
/// Slug of the short URL used in the URL
|
||||
@ -14,6 +13,9 @@ class ShortURL {
|
||||
/// Long URL where the user gets redirected to
|
||||
String longUrl;
|
||||
|
||||
/// Device-specific long URLs
|
||||
DeviceLongUrls deviceLongUrls;
|
||||
|
||||
/// Creation date of the short URL
|
||||
DateTime dateCreated;
|
||||
|
||||
@ -35,12 +37,11 @@ class ShortURL {
|
||||
/// Whether the short URL is crawlable by a web crawler
|
||||
bool crawlable;
|
||||
|
||||
List<RedirectRule>? redirectRules;
|
||||
|
||||
ShortURL(
|
||||
this.shortCode,
|
||||
this.shortUrl,
|
||||
this.longUrl,
|
||||
this.deviceLongUrls,
|
||||
this.dateCreated,
|
||||
this.visitsSummary,
|
||||
this.tags,
|
||||
@ -54,25 +55,24 @@ class ShortURL {
|
||||
: shortCode = json["shortCode"],
|
||||
shortUrl = json["shortUrl"],
|
||||
longUrl = json["longUrl"],
|
||||
deviceLongUrls = DeviceLongUrls.fromJson(json["deviceLongUrls"]),
|
||||
dateCreated = DateTime.parse(json["dateCreated"]),
|
||||
visitsSummary = VisitsSummary.fromJson(json["visitsSummary"]),
|
||||
tags =
|
||||
(json["tags"] as List<dynamic>).map((e) => e.toString()).toList(),
|
||||
tags = (json["tags"] as List<dynamic>).map((e) => e.toString()).toList(),
|
||||
meta = ShortURLMeta.fromJson(json["meta"]),
|
||||
domain = json["domain"],
|
||||
title = json["title"],
|
||||
crawlable = json["crawlable"];
|
||||
|
||||
/// Returns an empty class of [ShortURL]
|
||||
ShortURL.empty()
|
||||
: shortCode = "",
|
||||
shortUrl = "",
|
||||
longUrl = "",
|
||||
dateCreated = DateTime.now(),
|
||||
visitsSummary = VisitsSummary(0, 0, 0),
|
||||
tags = [],
|
||||
meta = ShortURLMeta(DateTime.now(), DateTime.now(), 0),
|
||||
domain = "",
|
||||
title = "",
|
||||
crawlable = false;
|
||||
: shortCode = "",
|
||||
shortUrl = "",
|
||||
longUrl = "",
|
||||
deviceLongUrls = DeviceLongUrls("", "", ""),
|
||||
dateCreated = DateTime.now(),
|
||||
visitsSummary = VisitsSummary(0, 0, 0),
|
||||
tags = [],
|
||||
meta = ShortURLMeta(DateTime.now(), DateTime.now(), 0),
|
||||
domain = "",
|
||||
title = "",
|
||||
crawlable = false;
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
import '../ShortURL/device_long_urls.dart';
|
||||
|
||||
/// Data for a short URL which can be submitted to the server
|
||||
class ShortURLSubmission {
|
||||
/// Long URL to redirect to
|
||||
String longUrl;
|
||||
|
||||
/// Device-specific long URLs
|
||||
DeviceLongUrls? deviceLongUrls;
|
||||
|
||||
/// Date since when this short URL is valid in ISO8601 format
|
||||
String? validSince;
|
||||
|
||||
@ -38,6 +43,7 @@ class ShortURLSubmission {
|
||||
|
||||
ShortURLSubmission(
|
||||
{required this.longUrl,
|
||||
required this.deviceLongUrls,
|
||||
this.validSince,
|
||||
this.validUntil,
|
||||
this.maxVisits,
|
||||
@ -54,6 +60,7 @@ class ShortURLSubmission {
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"longUrl": longUrl,
|
||||
"deviceLongUrls": deviceLongUrls?.toJson(),
|
||||
"validSince": validSince,
|
||||
"validUntil": validUntil,
|
||||
"maxVisits": maxVisits,
|
||||
|
@ -1,20 +0,0 @@
|
||||
import 'package:shlink_app/API/Classes/ShortURL/visits_summary.dart';
|
||||
|
||||
/// Tag with stats data
|
||||
class TagWithStats {
|
||||
/// Tag name
|
||||
String tag;
|
||||
|
||||
/// Amount of short URLs using this tag
|
||||
int shortUrlsCount;
|
||||
|
||||
/// visits summary for tag
|
||||
VisitsSummary visitsSummary;
|
||||
|
||||
TagWithStats(this.tag, this.shortUrlsCount, this.visitsSummary);
|
||||
|
||||
TagWithStats.fromJson(Map<String, dynamic> json)
|
||||
: tag = json["tag"] as String,
|
||||
shortUrlsCount = json["shortUrlsCount"] as int,
|
||||
visitsSummary = VisitsSummary.fromJson(json["visitsSummary"]);
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule.dart';
|
||||
import '../server_manager.dart';
|
||||
|
||||
/// Gets redirect rules for a given short URL (code).
|
||||
FutureOr<Either<List<RedirectRule>, Failure>> apiGetRedirectRules(
|
||||
String shortCode,
|
||||
String? apiKey,
|
||||
String? serverUrl,
|
||||
String apiVersion) async {
|
||||
try {
|
||||
final response = await http.get(
|
||||
Uri.parse(
|
||||
"$serverUrl/rest/v$apiVersion/short-urls/$shortCode/redirect-rules"),
|
||||
headers: {
|
||||
"X-Api-Key": apiKey ?? "",
|
||||
});
|
||||
if (response.statusCode == 200) {
|
||||
// get returned redirect rules
|
||||
var jsonBody = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
|
||||
// convert json array to object array
|
||||
List<RedirectRule> redirectRules =
|
||||
(jsonBody["redirectRules"] as List<dynamic>)
|
||||
.map((e) => RedirectRule.fromJson(e))
|
||||
.toList();
|
||||
|
||||
return left(redirectRules);
|
||||
} else {
|
||||
try {
|
||||
var jsonBody = jsonDecode(response.body);
|
||||
return right(ApiFailure(
|
||||
type: jsonBody["type"],
|
||||
detail: jsonBody["detail"],
|
||||
title: jsonBody["title"],
|
||||
status: jsonBody["status"],
|
||||
invalidElements: jsonBody["invalidElements"]));
|
||||
} catch (resErr) {
|
||||
return right(RequestFailure(response.statusCode, resErr.toString()));
|
||||
}
|
||||
}
|
||||
} catch (reqErr) {
|
||||
return right(RequestFailure(0, reqErr.toString()));
|
||||
}
|
||||
}
|
@ -9,11 +9,11 @@ import '../server_manager.dart';
|
||||
/// Gets statistics about the Shlink server
|
||||
FutureOr<Either<ShlinkStats, Failure>> apiGetShlinkStats(
|
||||
String? apiKey, String? serverUrl, String apiVersion) async {
|
||||
VisitsSummary? nonOrphanVisits;
|
||||
VisitsSummary? orphanVisits;
|
||||
int shortUrlsCount = 0;
|
||||
int tagsCount = 0;
|
||||
Failure? failure;
|
||||
var nonOrphanVisits;
|
||||
var orphanVisits;
|
||||
var shortUrlsCount;
|
||||
var tagsCount;
|
||||
var failure;
|
||||
|
||||
var visitStatsResponse = await _getVisitStats(apiKey, serverUrl, apiVersion);
|
||||
visitStatsResponse.fold((l) {
|
||||
@ -46,10 +46,10 @@ FutureOr<Either<ShlinkStats, Failure>> apiGetShlinkStats(
|
||||
}
|
||||
|
||||
if (failure != null) {
|
||||
return right(failure!);
|
||||
return right(failure);
|
||||
}
|
||||
return left(
|
||||
ShlinkStats(nonOrphanVisits!, orphanVisits!, shortUrlsCount, tagsCount));
|
||||
ShlinkStats(nonOrphanVisits, orphanVisits, shortUrlsCount, tagsCount));
|
||||
}
|
||||
|
||||
class _ShlinkVisitStats {
|
||||
|
@ -1,68 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:shlink_app/API/Classes/Tag/tag_with_stats.dart';
|
||||
import '../server_manager.dart';
|
||||
|
||||
/// Gets all tags
|
||||
FutureOr<Either<List<TagWithStats>, Failure>> apiGetTagsWithStats(
|
||||
String? apiKey, String? serverUrl, String apiVersion) async {
|
||||
var currentPage = 1;
|
||||
var maxPages = 2;
|
||||
List<TagWithStats> allTags = [];
|
||||
|
||||
Failure? error;
|
||||
|
||||
while (currentPage <= maxPages) {
|
||||
final response =
|
||||
await _getTagsWithStatsPage(currentPage, apiKey, serverUrl, apiVersion);
|
||||
response.fold((l) {
|
||||
allTags.addAll(l.tags);
|
||||
maxPages = l.totalPages;
|
||||
currentPage++;
|
||||
}, (r) {
|
||||
maxPages = 0;
|
||||
error = r;
|
||||
});
|
||||
}
|
||||
if (error == null) {
|
||||
return left(allTags);
|
||||
} else {
|
||||
return right(error!);
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets all tags from a specific page
|
||||
FutureOr<Either<TagsWithStatsPageResponse, Failure>> _getTagsWithStatsPage(
|
||||
int page, String? apiKey, String? serverUrl, String apiVersion) async {
|
||||
try {
|
||||
final response = await http.get(
|
||||
Uri.parse("$serverUrl/rest/v$apiVersion/tags/stats?page=$page"),
|
||||
headers: {
|
||||
"X-Api-Key": apiKey ?? "",
|
||||
});
|
||||
if (response.statusCode == 200) {
|
||||
var jsonResponse = jsonDecode(response.body);
|
||||
var pagesCount = jsonResponse["tags"]["pagination"]["pagesCount"] as int;
|
||||
List<TagWithStats> tags =
|
||||
(jsonResponse["tags"]["data"] as List<dynamic>).map((e) {
|
||||
return TagWithStats.fromJson(e);
|
||||
}).toList();
|
||||
return left(TagsWithStatsPageResponse(tags, pagesCount));
|
||||
} else {
|
||||
try {
|
||||
var jsonBody = jsonDecode(response.body);
|
||||
return right(ApiFailure(
|
||||
type: jsonBody["type"],
|
||||
detail: jsonBody["detail"],
|
||||
title: jsonBody["title"],
|
||||
status: jsonBody["status"]));
|
||||
} catch (resErr) {
|
||||
return right(RequestFailure(response.statusCode, resErr.toString()));
|
||||
}
|
||||
}
|
||||
} catch (reqErr) {
|
||||
return right(RequestFailure(0, reqErr.toString()));
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule.dart';
|
||||
import '../server_manager.dart';
|
||||
|
||||
/// Saves the redirect rules for a given short URL (code).
|
||||
FutureOr<Either<bool, Failure>> apiSetRedirectRules(
|
||||
String shortCode,
|
||||
List<RedirectRule> redirectRules,
|
||||
String? apiKey,
|
||||
String? serverUrl,
|
||||
String apiVersion) async {
|
||||
try {
|
||||
Map<String, dynamic> body = {};
|
||||
List<Map<String, dynamic>> redirectRulesJson =
|
||||
redirectRules.map((e) => e.toJson()).toList();
|
||||
body["redirectRules"] = redirectRulesJson;
|
||||
final response = await http.post(
|
||||
Uri.parse(
|
||||
"$serverUrl/rest/v$apiVersion/short-urls/$shortCode/redirect-rules"),
|
||||
headers: {
|
||||
"X-Api-Key": apiKey ?? "",
|
||||
},
|
||||
body: jsonEncode(body));
|
||||
if (response.statusCode == 200) {
|
||||
return left(true);
|
||||
} else {
|
||||
try {
|
||||
var jsonBody = jsonDecode(response.body);
|
||||
return right(ApiFailure(
|
||||
type: jsonBody["type"],
|
||||
detail: jsonBody["detail"],
|
||||
title: jsonBody["title"],
|
||||
status: jsonBody["status"],
|
||||
invalidElements: jsonBody["invalidElements"]));
|
||||
} catch (resErr) {
|
||||
return right(RequestFailure(response.statusCode, resErr.toString()));
|
||||
}
|
||||
}
|
||||
} catch (reqErr) {
|
||||
return right(RequestFailure(0, reqErr.toString()));
|
||||
}
|
||||
}
|
@ -7,11 +7,8 @@ import 'package:shlink_app/API/Classes/ShortURLSubmission/short_url_submission.d
|
||||
import '../server_manager.dart';
|
||||
|
||||
/// Submits a short URL to a server for it to be added
|
||||
FutureOr<Either<ShortURL, Failure>> apiSubmitShortUrl(
|
||||
ShortURLSubmission shortUrl,
|
||||
String? apiKey,
|
||||
String? serverUrl,
|
||||
String apiVersion) async {
|
||||
FutureOr<Either<ShortURL, Failure>> apiSubmitShortUrl(ShortURLSubmission shortUrl,
|
||||
String? apiKey, String? serverUrl, String apiVersion) async {
|
||||
try {
|
||||
final response =
|
||||
await http.post(Uri.parse("$serverUrl/rest/v$apiVersion/short-urls"),
|
||||
|
@ -7,11 +7,7 @@ import 'package:shlink_app/API/Classes/ShortURLSubmission/short_url_submission.d
|
||||
import '../server_manager.dart';
|
||||
|
||||
/// Updates an existing short URL
|
||||
FutureOr<Either<ShortURL, Failure>> apiUpdateShortUrl(
|
||||
ShortURLSubmission shortUrl,
|
||||
String? apiKey,
|
||||
String? serverUrl,
|
||||
String apiVersion) async {
|
||||
FutureOr<Either<ShortURL, Failure>> apiUpdateShortUrl(ShortURLSubmission shortUrl, String? apiKey, String? serverUrl, String apiVersion) async {
|
||||
String shortCode = shortUrl.customSlug ?? "";
|
||||
if (shortCode == "") {
|
||||
return right(RequestFailure(0, "Missing short code"));
|
||||
@ -20,12 +16,11 @@ FutureOr<Either<ShortURL, Failure>> apiUpdateShortUrl(
|
||||
shortUrlData.remove("shortCode");
|
||||
shortUrlData.remove("shortUrl");
|
||||
try {
|
||||
final response = await http.patch(
|
||||
Uri.parse("$serverUrl/rest/v$apiVersion/short-urls/$shortCode"),
|
||||
headers: {
|
||||
"X-Api-Key": apiKey ?? "",
|
||||
},
|
||||
body: jsonEncode(shortUrlData));
|
||||
final response = await http.patch(Uri.parse("$serverUrl/rest/v$apiVersion/short-urls/$shortCode"),
|
||||
headers: {
|
||||
"X-Api-Key": apiKey ?? "",
|
||||
},
|
||||
body: jsonEncode(shortUrlData));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// get returned short url
|
||||
@ -47,4 +42,4 @@ FutureOr<Either<ShortURL, Failure>> apiUpdateShortUrl(
|
||||
} catch (reqErr) {
|
||||
return right(RequestFailure(0, reqErr.toString()));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +1,15 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:shlink_app/API/Classes/ShlinkStats/shlink_stats.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/short_url.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURLSubmission/short_url_submission.dart';
|
||||
import 'package:shlink_app/API/Classes/Tag/tag_with_stats.dart';
|
||||
import 'package:shlink_app/API/Methods/connect.dart';
|
||||
import 'package:shlink_app/API/Methods/get_recent_short_urls.dart';
|
||||
import 'package:shlink_app/API/Methods/get_redirect_rules.dart';
|
||||
import 'package:shlink_app/API/Methods/get_server_health.dart';
|
||||
import 'package:shlink_app/API/Methods/get_shlink_stats.dart';
|
||||
import 'package:shlink_app/API/Methods/get_short_urls.dart';
|
||||
import 'package:shlink_app/API/Methods/get_tags_with_stats.dart';
|
||||
import 'package:shlink_app/API/Methods/set_redirect_rules.dart';
|
||||
import 'package:shlink_app/API/Methods/update_short_url.dart';
|
||||
|
||||
import 'Methods/delete_short_url.dart';
|
||||
@ -47,41 +41,10 @@ class ServerManager {
|
||||
}
|
||||
|
||||
/// Logs out the user and removes data about the Shlink server
|
||||
Future<void> logOut(String url) async {
|
||||
Future<void> logOut() async {
|
||||
const storage = FlutterSecureStorage();
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
String? serverMapSerialized = await storage.read(key: "server_map");
|
||||
|
||||
if (serverMapSerialized != null) {
|
||||
Map<String, String> serverMap =
|
||||
Map.castFrom(jsonDecode(serverMapSerialized));
|
||||
serverMap.remove(url);
|
||||
if (serverMap.isEmpty) {
|
||||
storage.delete(key: "server_map");
|
||||
} else {
|
||||
storage.write(key: "server_map", value: jsonEncode(serverMap));
|
||||
}
|
||||
if (serverUrl == url) {
|
||||
serverUrl = null;
|
||||
apiKey = null;
|
||||
prefs.remove("lastusedserver");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns all servers saved in the app
|
||||
Future<List<String>> getAvailableServers() async {
|
||||
const storage = FlutterSecureStorage();
|
||||
String? serverMapSerialized = await storage.read(key: "server_map");
|
||||
|
||||
if (serverMapSerialized != null) {
|
||||
Map<String, String> serverMap =
|
||||
Map.castFrom(jsonDecode(serverMapSerialized));
|
||||
return serverMap.keys.toList();
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
await storage.delete(key: "shlink_url");
|
||||
await storage.delete(key: "shlink_apikey");
|
||||
}
|
||||
|
||||
/// Loads the server credentials from [FlutterSecureStorage]
|
||||
@ -90,72 +53,21 @@ class ServerManager {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
if (prefs.getBool('first_run') ?? true) {
|
||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
||||
|
||||
await storage.deleteAll();
|
||||
|
||||
prefs.setBool('first_run', false);
|
||||
} else {
|
||||
if (await _replaceDeprecatedStorageMethod()) {
|
||||
_loadCredentials();
|
||||
return;
|
||||
}
|
||||
|
||||
String? serverMapSerialized = await storage.read(key: "server_map");
|
||||
String? lastUsedServer = prefs.getString("lastusedserver");
|
||||
|
||||
if (serverMapSerialized != null) {
|
||||
Map<String, String> serverMap =
|
||||
Map.castFrom(jsonDecode(serverMapSerialized));
|
||||
if (lastUsedServer != null) {
|
||||
serverUrl = lastUsedServer;
|
||||
apiKey = serverMap[lastUsedServer]!;
|
||||
} else {
|
||||
List<String> availableServers = serverMap.keys.toList();
|
||||
if (availableServers.isNotEmpty) {
|
||||
serverUrl = availableServers.first;
|
||||
apiKey = serverMap[serverUrl];
|
||||
prefs.setString("lastusedserver", serverUrl!);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _replaceDeprecatedStorageMethod() async {
|
||||
const storage = FlutterSecureStorage();
|
||||
// deprecated data storage method, replaced because of multi-server support
|
||||
var v1DataServerurl = await storage.read(key: "shlink_url");
|
||||
var v1DataApikey = await storage.read(key: "shlink_apikey");
|
||||
|
||||
if (v1DataServerurl != null && v1DataApikey != null) {
|
||||
// conversion to new data storage method
|
||||
Map<String, String> serverMap = {};
|
||||
serverMap[v1DataServerurl] = v1DataApikey;
|
||||
|
||||
storage.write(key: "server_map", value: jsonEncode(serverMap));
|
||||
|
||||
storage.delete(key: "shlink_url");
|
||||
storage.delete(key: "shlink_apikey");
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
serverUrl = await storage.read(key: "shlink_url");
|
||||
apiKey = await storage.read(key: "shlink_apikey");
|
||||
}
|
||||
|
||||
/// Saves the provided server credentials to [FlutterSecureStorage]
|
||||
void _saveCredentials(String url, String apiKey) async {
|
||||
const storage = FlutterSecureStorage();
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
String? serverMapSerialized = await storage.read(key: "server_map");
|
||||
Map<String, String> serverMap;
|
||||
if (serverMapSerialized != null) {
|
||||
serverMap = Map.castFrom(jsonDecode(serverMapSerialized));
|
||||
} else {
|
||||
serverMap = {};
|
||||
}
|
||||
serverMap[url] = apiKey;
|
||||
storage.write(key: "server_map", value: jsonEncode(serverMap));
|
||||
prefs.setString("lastusedserver", url);
|
||||
storage.write(key: "shlink_url", value: url);
|
||||
storage.write(key: "shlink_apikey", value: apiKey);
|
||||
}
|
||||
|
||||
/// Saves provided server credentials and tries to establish a connection
|
||||
@ -167,7 +79,7 @@ class ServerManager {
|
||||
_saveCredentials(url, apiKey);
|
||||
final result = await connect();
|
||||
result.fold((l) => null, (r) {
|
||||
logOut(url);
|
||||
logOut();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@ -183,11 +95,6 @@ class ServerManager {
|
||||
return apiGetShortUrls(apiKey, serverUrl, apiVersion);
|
||||
}
|
||||
|
||||
/// Gets all tags from the server
|
||||
FutureOr<Either<List<TagWithStats>, Failure>> getTags() async {
|
||||
return apiGetTagsWithStats(apiKey, serverUrl, apiVersion);
|
||||
}
|
||||
|
||||
/// Gets statistics about the Shlink instance
|
||||
FutureOr<Either<ShlinkStats, Failure>> getShlinkStats() async {
|
||||
return apiGetShlinkStats(apiKey, serverUrl, apiVersion);
|
||||
@ -218,19 +125,6 @@ class ServerManager {
|
||||
FutureOr<Either<List<ShortURL>, Failure>> getRecentShortUrls() async {
|
||||
return apiGetRecentShortUrls(apiKey, serverUrl, apiVersion);
|
||||
}
|
||||
|
||||
/// Gets redirect rules for a given short URL (code)
|
||||
FutureOr<Either<List<RedirectRule>, Failure>> getRedirectRules(
|
||||
String shortCode) async {
|
||||
return apiGetRedirectRules(shortCode, apiKey, serverUrl, apiVersion);
|
||||
}
|
||||
|
||||
/// Sets redirect rules for a given short URL (code)
|
||||
FutureOr<Either<bool, Failure>> setRedirectRules(
|
||||
String shortCode, List<RedirectRule> redirectRules) async {
|
||||
return apiSetRedirectRules(
|
||||
shortCode, redirectRules, apiKey, serverUrl, apiVersion);
|
||||
}
|
||||
}
|
||||
|
||||
/// Server response data type about a page of short URLs from the server
|
||||
@ -241,14 +135,6 @@ class ShortURLPageResponse {
|
||||
ShortURLPageResponse(this.urls, this.totalPages);
|
||||
}
|
||||
|
||||
/// Server response data type about a page of tags from the server
|
||||
class TagsWithStatsPageResponse {
|
||||
List<TagWithStats> tags;
|
||||
int totalPages;
|
||||
|
||||
TagsWithStatsPageResponse(this.tags, this.totalPages);
|
||||
}
|
||||
|
||||
/// Server response data type about the health status of the server
|
||||
class ServerHealthResponse {
|
||||
String status;
|
||||
|
@ -1,71 +0,0 @@
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GlobalTheme {
|
||||
static final Color _lightFocusColor = Colors.black.withOpacity(0.12);
|
||||
static final Color _darkFocusColor = Colors.white.withOpacity(0.12);
|
||||
static ThemeData lightThemeData(ColorScheme? dynamicColorScheme) {
|
||||
return themeData(lightColorScheme, dynamicColorScheme, _lightFocusColor);
|
||||
}
|
||||
static ThemeData darkThemeData(ColorScheme? dynamicColorScheme) {
|
||||
return themeData(darkColorScheme, dynamicColorScheme, _darkFocusColor);
|
||||
}
|
||||
|
||||
static ThemeData themeData(ColorScheme colorScheme, ColorScheme? dynamic,
|
||||
Color focusColor) {
|
||||
return ThemeData(
|
||||
colorScheme: colorScheme,
|
||||
canvasColor: colorScheme.surface,
|
||||
scaffoldBackgroundColor: colorScheme.surface,
|
||||
highlightColor: Colors.transparent,
|
||||
dividerColor: colorScheme.shadow,
|
||||
focusColor: focusColor,
|
||||
useMaterial3: true,
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: colorScheme.surface,
|
||||
foregroundColor: colorScheme.onSurface,
|
||||
elevation: 0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
static ColorScheme get lightColorScheme {
|
||||
return ColorScheme(
|
||||
primary: Color(0xff747ab5),
|
||||
onPrimary: Colors.white,
|
||||
secondary: Color(0x335d63a6),// Color(0xFFDDE0E0),
|
||||
onSecondary: Color(0xFF322942),
|
||||
tertiary: Colors.grey[300],
|
||||
onTertiary: Colors.grey[700],
|
||||
surfaceContainer: (Colors.grey[100])!,
|
||||
outline: (Colors.grey[500])!,
|
||||
shadow: (Colors.grey[300])!,
|
||||
error: (Colors.red[400])!,
|
||||
onError: Colors.white,
|
||||
surface: Color(0xFFFAFBFB),
|
||||
onSurface: Color(0xFF241E30),
|
||||
brightness: Brightness.light,
|
||||
);
|
||||
}
|
||||
|
||||
static ColorScheme get darkColorScheme {
|
||||
return ColorScheme(
|
||||
primary: Color(0xff5d63a6),
|
||||
secondary: Colors.blue.shade500,
|
||||
secondaryContainer: Color(0xff1c1c1c),
|
||||
surface: Colors.black,
|
||||
surfaceContainer: Color(0xff0f0f0f),
|
||||
onSurfaceVariant: Colors.grey[400],
|
||||
tertiary: Colors.grey[900],
|
||||
onTertiary: Colors.grey,
|
||||
outline: (Colors.grey[700])!,
|
||||
shadow: (Colors.grey[800])!,
|
||||
error: (Colors.red[400])!,
|
||||
onError: Colors.white,
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: (Colors.grey[400])!,
|
||||
onSurface: Colors.white,
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shlink_app/global_theme.dart';
|
||||
import 'package:shlink_app/views/login_view.dart';
|
||||
import 'package:shlink_app/views/navigationbar_view.dart';
|
||||
import 'globals.dart' as globals;
|
||||
@ -12,13 +11,11 @@ void main() {
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
static final ColorScheme _defaultLightColorScheme =
|
||||
ColorScheme.fromSeed(seedColor: Colors.blue);
|
||||
static const _defaultLightColorScheme = ColorScheme
|
||||
.light(); //.fromSwatch(primarySwatch: Colors.blue, backgroundColor: Colors.white);
|
||||
|
||||
static final _defaultDarkColorScheme = ColorScheme.fromSeed(
|
||||
brightness: Brightness.dark,
|
||||
seedColor: Colors.blue,
|
||||
background: Colors.black);
|
||||
static final _defaultDarkColorScheme =
|
||||
ColorScheme.fromSwatch(brightness: Brightness.dark);
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
@ -27,9 +24,7 @@ class MyApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
title: 'Shlink',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: GlobalTheme.lightThemeData(lightColorScheme),
|
||||
darkTheme: GlobalTheme.darkThemeData(darkColorScheme),
|
||||
/*theme: ThemeData(
|
||||
theme: ThemeData(
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: Color(0xfffafafa),
|
||||
),
|
||||
@ -41,10 +36,10 @@ class MyApp extends StatelessWidget {
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
),
|
||||
colorScheme: darkColorScheme?.copyWith(surface: Colors.black) ??
|
||||
colorScheme: darkColorScheme?.copyWith(background: Colors.black) ??
|
||||
_defaultDarkColorScheme,
|
||||
useMaterial3: true,
|
||||
),*/
|
||||
),
|
||||
home: const InitialPage());
|
||||
});
|
||||
}
|
||||
@ -67,13 +62,11 @@ class _InitialPageState extends State<InitialPage> {
|
||||
void checkLogin() async {
|
||||
bool result = await globals.serverManager.checkLogin();
|
||||
if (result) {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (context) => const NavigationBarView()),
|
||||
(Route<dynamic> route) => false);
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (context) => const NavigationBarView()));
|
||||
} else {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (context) => const LoginView()),
|
||||
(Route<dynamic> route) => false);
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (context) => const LoginView()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
|
||||
SnackBar buildApiErrorSnackbar(Failure r, BuildContext context) {
|
||||
var text = "";
|
||||
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
if ((r).invalidElements != null) {
|
||||
text = "$text: ${(r).invalidElements}";
|
||||
}
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text, style: TextStyle(color: Theme.of(context).colorScheme.onError)),
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
behavior: SnackBarBehavior.floating);
|
||||
|
||||
return snackBar;
|
||||
}
|
@ -28,7 +28,7 @@ class LicenseUtil {
|
||||
return [
|
||||
const License(
|
||||
name: r'cupertino_icons',
|
||||
license: r'''
|
||||
license: r'''
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Vladimir Kharlampidi
|
||||
@ -50,11 +50,12 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.''',
|
||||
version: r'^1.0.5',
|
||||
repository: r'https://github.com/flutter/packages/tree/main/third_party/packages/cupertino_icons',
|
||||
repository:
|
||||
r'https://github.com/flutter/packages/tree/main/third_party/packages/cupertino_icons',
|
||||
),
|
||||
const License(
|
||||
name: r'dartz',
|
||||
license: r'''
|
||||
license: r'''
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021 Björn Sperber
|
||||
@ -82,7 +83,7 @@ SOFTWARE.
|
||||
),
|
||||
const License(
|
||||
name: r'dynamic_color',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
@ -286,11 +287,12 @@ SOFTWARE.
|
||||
limitations under the License.
|
||||
''',
|
||||
version: r'^1.6.6',
|
||||
repository: r'https://github.com/material-foundation/flutter-packages/tree/main/packages/dynamic_color',
|
||||
repository:
|
||||
r'https://github.com/material-foundation/flutter-packages/tree/main/packages/dynamic_color',
|
||||
),
|
||||
const License(
|
||||
name: r'flutter',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -322,7 +324,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
),
|
||||
const License(
|
||||
name: r'flutter_launcher_icons',
|
||||
license: r'''
|
||||
license: r'''
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Mark O'Sullivan
|
||||
@ -345,13 +347,14 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
''',
|
||||
version: r'^0.13.1',
|
||||
version: r'0.13.1',
|
||||
homepage: r'https://github.com/fluttercommunity/flutter_launcher_icons',
|
||||
repository: r'https://github.com/fluttercommunity/flutter_launcher_icons/',
|
||||
repository:
|
||||
r'https://github.com/fluttercommunity/flutter_launcher_icons/',
|
||||
),
|
||||
const License(
|
||||
name: r'flutter_lints',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -378,45 +381,46 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''',
|
||||
version: r'^3.0.1',
|
||||
repository: r'https://github.com/flutter/packages/tree/main/packages/flutter_lints',
|
||||
version: r'^2.0.2',
|
||||
repository:
|
||||
r'https://github.com/flutter/packages/tree/main/packages/flutter_lints',
|
||||
),
|
||||
const License(
|
||||
name: r'flutter_process_text',
|
||||
license: r'''
|
||||
BSD 3-Clause License
|
||||
|
||||
(c) Copyright 2021 divshekhar (Divyanshu Shekhar)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
license: r'''
|
||||
BSD 3-Clause License
|
||||
|
||||
(c) Copyright 2021 divshekhar (Divyanshu Shekhar)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.''',
|
||||
version: r'^1.1.2',
|
||||
repository: r'https://github.com/DevsOnFlutter/flutter_process_text',
|
||||
),
|
||||
const License(
|
||||
name: r'flutter_secure_storage',
|
||||
license: r'''
|
||||
license: r'''
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright 2017 German Saprykin
|
||||
@ -446,219 +450,13 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.''',
|
||||
version: r'^9.0.0',
|
||||
repository: r'https://github.com/mogol/flutter_secure_storage/tree/develop/flutter_secure_storage',
|
||||
),
|
||||
const License(
|
||||
name: r'flutter_sharing_intent',
|
||||
license: r'''
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.''',
|
||||
version: r'^1.1.1',
|
||||
homepage: r'https://github.com/bhagat-techind/flutter_sharing_intent.git',
|
||||
version: r'^8.0.0',
|
||||
repository:
|
||||
r'https://github.com/mogol/flutter_secure_storage/tree/develop/flutter_secure_storage',
|
||||
),
|
||||
const License(
|
||||
name: r'flutter_test',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -690,7 +488,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
),
|
||||
const License(
|
||||
name: r'http',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2014, the Dart project authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -719,12 +517,12 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''',
|
||||
version: r'^1.1.0',
|
||||
version: r'^0.13.6',
|
||||
repository: r'https://github.com/dart-lang/http/tree/master/pkgs/http',
|
||||
),
|
||||
const License(
|
||||
name: r'intl',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2013, the Dart project authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -753,12 +551,12 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''',
|
||||
version: r'^0.19.0',
|
||||
version: r'^0.18.1',
|
||||
repository: r'https://github.com/dart-lang/i18n/tree/main/pkgs/intl',
|
||||
),
|
||||
const License(
|
||||
name: r'license_generator',
|
||||
license: r'''
|
||||
license: r'''
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 icapps
|
||||
@ -781,12 +579,12 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
''',
|
||||
version: r'^2.0.0',
|
||||
version: r'^1.0.5',
|
||||
homepage: r'https://github.com/icapps/flutter-icapps-license',
|
||||
),
|
||||
const License(
|
||||
name: r'package_info_plus',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -817,11 +615,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''',
|
||||
version: r'^4.0.2',
|
||||
homepage: r'https://plus.fluttercommunity.dev/',
|
||||
repository: r'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/package_info_plus/package_info_plus',
|
||||
repository:
|
||||
r'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/',
|
||||
),
|
||||
const License(
|
||||
name: r'qr_flutter',
|
||||
license: r'''
|
||||
license: r'''
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2020, Luke Freeman.
|
||||
@ -857,7 +656,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
),
|
||||
const License(
|
||||
name: r'shared_preferences',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -885,11 +684,12 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''',
|
||||
version: r'^2.2.2',
|
||||
repository: r'https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences',
|
||||
repository:
|
||||
r'https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences',
|
||||
),
|
||||
const License(
|
||||
name: r'tuple',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright (c) 2014, the tuple project authors.
|
||||
All rights reserved.
|
||||
|
||||
@ -917,7 +717,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.''',
|
||||
),
|
||||
const License(
|
||||
name: r'url_launcher',
|
||||
license: r'''
|
||||
license: r'''
|
||||
Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -944,8 +744,9 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
''',
|
||||
version: r'^6.2.4',
|
||||
repository: r'https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher',
|
||||
version: r'6.1.9',
|
||||
repository:
|
||||
r'https://github.com/flutter/plugins/tree/main/packages/url_launcher/url_launcher',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ Color stringToColor(String string) {
|
||||
return const Color(0xff000000);
|
||||
}
|
||||
return Color.fromARGB(1, rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
}
|
@ -1,15 +1,9 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_sharing_intent/flutter_sharing_intent.dart';
|
||||
import 'package:flutter_sharing_intent/model/sharing_file.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:shlink_app/API/Classes/ShlinkStats/shlink_stats.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/views/short_url_edit_view.dart';
|
||||
import 'package:shlink_app/views/url_list_view.dart';
|
||||
import 'package:shlink_app/widgets/available_servers_bottom_sheet.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import '../API/Classes/ShortURL/short_url.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
@ -28,33 +22,15 @@ class _HomeViewState extends State<HomeView> {
|
||||
bool _qrCodeShown = false;
|
||||
String _qrUrl = "";
|
||||
|
||||
late StreamSubscription _intentDataStreamSubscription;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
initializeActionProcessText();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadAllData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> initializeActionProcessText() async {
|
||||
_intentDataStreamSubscription =
|
||||
FlutterSharingIntent.instance.getMediaStream().listen(_handleIntentUrl);
|
||||
|
||||
FlutterSharingIntent.instance.getInitialSharing().then(_handleIntentUrl);
|
||||
}
|
||||
|
||||
Future<void> _handleIntentUrl(List<SharedFile> value) async {
|
||||
String inputUrlText = value.firstOrNull?.value ?? "";
|
||||
if (await canLaunchUrlString(inputUrlText)) {
|
||||
await Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => ShortURLEditView(longUrl: inputUrlText)));
|
||||
await loadAllData();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadAllData() async {
|
||||
await loadShlinkStats();
|
||||
await loadRecentShortUrls();
|
||||
@ -68,9 +44,18 @@ class _HomeViewState extends State<HomeView> {
|
||||
shlinkStats = l;
|
||||
});
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
var text = "";
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text),
|
||||
backgroundColor: Colors.red[400],
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
});
|
||||
}
|
||||
|
||||
@ -82,9 +67,18 @@ class _HomeViewState extends State<HomeView> {
|
||||
shortUrlsLoaded = true;
|
||||
});
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
var text = "";
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text),
|
||||
backgroundColor: Colors.red[400],
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
});
|
||||
}
|
||||
|
||||
@ -104,25 +98,15 @@ class _HomeViewState extends State<HomeView> {
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverAppBar.medium(
|
||||
automaticallyImplyLeading: false,
|
||||
expandedHeight: 160,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text("Shlink",
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return const AvailableServerBottomSheet();
|
||||
});
|
||||
},
|
||||
child: Text(globals.serverManager.getServerUrl(),
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Theme.of(context).colorScheme.onTertiary)),
|
||||
)
|
||||
Text(globals.serverManager.getServerUrl(),
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Colors.grey[600]))
|
||||
],
|
||||
)),
|
||||
SliverToBoxAdapter(
|
||||
@ -171,7 +155,7 @@ class _HomeViewState extends State<HomeView> {
|
||||
'Create one by tapping the "+" button below',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.onSecondary),
|
||||
color: Colors.grey[600]),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -233,12 +217,18 @@ class _HomeViewState extends State<HomeView> {
|
||||
eyeStyle: QrEyeStyle(
|
||||
eyeShape: QrEyeShape.square,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimary
|
||||
MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
dataModuleStyle: QrDataModuleStyle(
|
||||
dataModuleShape: QrDataModuleShape.square,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimary
|
||||
MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
))),
|
||||
),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/main.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
class LoginView extends StatefulWidget {
|
||||
@ -59,7 +58,6 @@ class _LoginViewState extends State<LoginView> {
|
||||
return Scaffold(
|
||||
extendBody: true,
|
||||
body: CustomScrollView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
const SliverAppBar.medium(
|
||||
title: Text("Add server",
|
||||
@ -67,107 +65,79 @@ class _LoginViewState extends State<LoginView> {
|
||||
SliverFillRemaining(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Stack(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Align(
|
||||
child: Column(
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 8),
|
||||
child: Text(
|
||||
"Server URL",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
)),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.dns_outlined),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _serverUrlController,
|
||||
keyboardType: TextInputType.url,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: "https://shlink.example.com"),
|
||||
))
|
||||
],
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: Text("API Key",
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.key),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _apiKeyController,
|
||||
keyboardType: TextInputType.text,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), labelText: "..."),
|
||||
))
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 8),
|
||||
child: Text(
|
||||
"Server URL",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
)),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.dns_outlined),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _serverUrlController,
|
||||
keyboardType: TextInputType.url,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: "https://shlink.example.com"),
|
||||
))
|
||||
],
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: Text("API Key",
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.key),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _apiKeyController,
|
||||
keyboardType: TextInputType.text,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), labelText: "..."),
|
||||
))
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FilledButton.tonal(
|
||||
onPressed: () => {_connect()},
|
||||
child: _isLoggingIn
|
||||
? Container(
|
||||
FilledButton.tonal(
|
||||
onPressed: () => {_connect()},
|
||||
child: _isLoggingIn
|
||||
? Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: const CircularProgressIndicator(),
|
||||
)
|
||||
: const Text("Connect",
|
||||
style: TextStyle(fontSize: 20)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(_errorMessage,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onError),
|
||||
textAlign: TextAlign.center))
|
||||
],
|
||||
),
|
||||
),
|
||||
: const Text("Connect",
|
||||
style: TextStyle(fontSize: 20)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: TextButton(
|
||||
onPressed: () async {
|
||||
final Uri url = Uri.parse('https://shlink.io/documentation/api-docs/authentication/');
|
||||
try {
|
||||
if (!await launchUrl(url)) {
|
||||
throw Exception();
|
||||
}
|
||||
} catch (e) {
|
||||
final snackBar = SnackBar(
|
||||
content: Text("Unable to launch url. See Shlink docs for more information.",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onError)),
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
snackBar);
|
||||
}
|
||||
},
|
||||
child: Text("How to create an API Key"),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(_errorMessage,
|
||||
style: const TextStyle(color: Colors.red),
|
||||
textAlign: TextAlign.center))
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
|
@ -40,7 +40,9 @@ class _OpenSourceLicensesViewState extends State<OpenSourceLicensesView> {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.grey[100]
|
||||
: Colors.grey[900],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
@ -52,13 +54,13 @@ class _OpenSourceLicensesViewState extends State<OpenSourceLicensesView> {
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 18)),
|
||||
Text("Version: ${currentLicense.version ?? "N/A"}",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onTertiary)),
|
||||
style: const TextStyle(color: Colors.grey)),
|
||||
const SizedBox(height: 8),
|
||||
Divider(color: Theme.of(context).dividerColor),
|
||||
const Divider(),
|
||||
const SizedBox(height: 8),
|
||||
Text(currentLicense.license,
|
||||
textAlign: TextAlign.justify,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onTertiary)),
|
||||
style: const TextStyle(color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -67,12 +69,12 @@ class _OpenSourceLicensesViewState extends State<OpenSourceLicensesView> {
|
||||
);
|
||||
}, childCount: LicenseUtil.getLicenses().length),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
const SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 8, bottom: 20),
|
||||
child: Text(
|
||||
"Thank you to all maintainers of these repositories 💝",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onTertiary),
|
||||
style: TextStyle(color: Colors.grey),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
))
|
||||
|
@ -1,267 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/condition_device_type.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule_condition.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/RedirectRule/redirect_rule_condition_type.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/short_url.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../API/Classes/ShortURL/RedirectRule/redirect_rule.dart';
|
||||
|
||||
class RedirectRulesDetailView extends StatefulWidget {
|
||||
const RedirectRulesDetailView({super.key, required this.shortURL});
|
||||
|
||||
final ShortURL shortURL;
|
||||
|
||||
@override
|
||||
State<RedirectRulesDetailView> createState() =>
|
||||
_RedirectRulesDetailViewState();
|
||||
}
|
||||
|
||||
class _RedirectRulesDetailViewState extends State<RedirectRulesDetailView> {
|
||||
List<RedirectRule> redirectRules = [];
|
||||
|
||||
bool redirectRulesLoaded = false;
|
||||
|
||||
bool isSaving = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => loadRedirectRules());
|
||||
}
|
||||
|
||||
Future<void> loadRedirectRules() async {
|
||||
final response =
|
||||
await globals.serverManager.getRedirectRules(widget.shortURL.shortCode);
|
||||
response.fold((l) {
|
||||
setState(() {
|
||||
redirectRules = l;
|
||||
redirectRulesLoaded = true;
|
||||
});
|
||||
_sortListByPriority();
|
||||
return true;
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void _saveRedirectRules() async {
|
||||
final response = await globals.serverManager
|
||||
.setRedirectRules(widget.shortURL.shortCode, redirectRules);
|
||||
response.fold((l) {
|
||||
Navigator.pop(context);
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void _sortListByPriority() {
|
||||
setState(() {
|
||||
redirectRules.sort((a, b) => a.priority - b.priority);
|
||||
});
|
||||
}
|
||||
|
||||
void _fixPriorities() {
|
||||
for (int i = 0; i < redirectRules.length; i++) {
|
||||
setState(() {
|
||||
redirectRules[i].priority = i + 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
floatingActionButton: Wrap(
|
||||
spacing: 16,
|
||||
children: [
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
if (!isSaving & redirectRulesLoaded) {
|
||||
setState(() {
|
||||
isSaving = true;
|
||||
});
|
||||
_saveRedirectRules();
|
||||
}
|
||||
},
|
||||
child: isSaving
|
||||
? const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: CircularProgressIndicator(strokeWidth: 3, color: Colors.white))
|
||||
: const Icon(Icons.save))
|
||||
],
|
||||
),
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
const SliverAppBar.medium(
|
||||
expandedHeight: 120,
|
||||
title: Text(
|
||||
"Redirect Rules",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
if (redirectRulesLoaded && redirectRules.isEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
"No Redirect Rules",
|
||||
style: TextStyle(
|
||||
fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'Adding redirect rules will be supported soon!',
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Theme.of(context).colorScheme.onSecondary),
|
||||
),
|
||||
)
|
||||
],
|
||||
))))
|
||||
else
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return _ListCell(
|
||||
redirectRule: redirectRules[index],
|
||||
moveUp: index == 0
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
redirectRules[index].priority -= 1;
|
||||
redirectRules[index - 1].priority += 1;
|
||||
});
|
||||
_sortListByPriority();
|
||||
},
|
||||
moveDown: index == (redirectRules.length - 1)
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
redirectRules[index].priority += 1;
|
||||
redirectRules[index + 1].priority -= 1;
|
||||
});
|
||||
_sortListByPriority();
|
||||
},
|
||||
delete: () {
|
||||
setState(() {
|
||||
redirectRules.removeAt(index);
|
||||
});
|
||||
_fixPriorities();
|
||||
},
|
||||
);
|
||||
}, childCount: redirectRules.length))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ListCell extends StatefulWidget {
|
||||
const _ListCell(
|
||||
{required this.redirectRule,
|
||||
required this.moveUp,
|
||||
required this.moveDown,
|
||||
required this.delete});
|
||||
|
||||
final VoidCallback? moveUp;
|
||||
final VoidCallback? moveDown;
|
||||
final VoidCallback delete;
|
||||
final RedirectRule redirectRule;
|
||||
|
||||
@override
|
||||
State<_ListCell> createState() => _ListCellState();
|
||||
}
|
||||
|
||||
class _ListCellState extends State<_ListCell> {
|
||||
String _conditionToTagString(RedirectRuleCondition condition) {
|
||||
switch (condition.type) {
|
||||
case RedirectRuleConditionType.DEVICE:
|
||||
return "Device is ${ConditionDeviceType.fromApi(condition.matchValue).humanReadable}";
|
||||
case RedirectRuleConditionType.LANGUAGE:
|
||||
return "Language is ${condition.matchValue}";
|
||||
case RedirectRuleConditionType.QUERY_PARAM:
|
||||
return "Query string contains ${condition.matchKey}=${condition.matchValue}";
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 8, right: 8, top: 16, bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).dividerColor)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text("Long URL ",
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text(widget.redirectRule.longUrl)
|
||||
],
|
||||
),
|
||||
const Text("Conditions:",
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Wrap(
|
||||
children:
|
||||
widget.redirectRule.conditions.map((condition) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 4, top: 4),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4, bottom: 4, left: 12, right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
color:
|
||||
Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
child: Text(_conditionToTagString(condition)),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Wrap(
|
||||
children: [
|
||||
IconButton(
|
||||
disabledColor:
|
||||
Theme.of(context).disabledColor,
|
||||
onPressed: widget.moveUp,
|
||||
icon: const Icon(Icons.arrow_upward),
|
||||
),
|
||||
IconButton(
|
||||
disabledColor:
|
||||
Theme.of(context).disabledColor,
|
||||
onPressed: widget.moveDown,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: widget.delete,
|
||||
icon: const Icon(Icons.delete, color: Colors.red),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/views/login_view.dart';
|
||||
import 'package:shlink_app/views/opensource_licenses_view.dart';
|
||||
import 'package:shlink_app/widgets/available_servers_bottom_sheet.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
@ -31,7 +31,7 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
void getServerHealth() async {
|
||||
var packageInfo = await PackageInfo.fromPlatform();
|
||||
setState(() {
|
||||
this.packageInfo = packageInfo;
|
||||
packageInfo = packageInfo;
|
||||
});
|
||||
final response = await globals.serverManager.getServerHealth();
|
||||
response.fold((l) {
|
||||
@ -43,9 +43,19 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
setState(() {
|
||||
_serverStatus = ServerStatus.disconnected;
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
|
||||
var text = "";
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text),
|
||||
backgroundColor: Colors.red[400],
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
});
|
||||
}
|
||||
|
||||
@ -54,84 +64,97 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
const SliverAppBar.medium(
|
||||
SliverAppBar.medium(
|
||||
expandedHeight: 120,
|
||||
title: Text(
|
||||
title: const Text(
|
||||
"Settings",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
actions: [
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
const PopupMenuItem(
|
||||
value: 0,
|
||||
child:
|
||||
Text("Log out...", style: TextStyle(color: Colors.red)),
|
||||
)
|
||||
];
|
||||
},
|
||||
onSelected: (value) {
|
||||
if (value == 0) {
|
||||
globals.serverManager.logOut().then((value) =>
|
||||
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||
builder: (context) => const LoginView())));
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return const AvailableServerBottomSheet();
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.dns_outlined,
|
||||
color: (() {
|
||||
switch (_serverStatus) {
|
||||
case ServerStatus.connected:
|
||||
return Colors.green;
|
||||
case ServerStatus.connecting:
|
||||
return Colors.orange;
|
||||
case ServerStatus.disconnected:
|
||||
return Colors.red;
|
||||
}
|
||||
}())),
|
||||
const SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Connected to",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onTertiary)),
|
||||
Text(globals.serverManager.getServerUrl(),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16)),
|
||||
Row(
|
||||
children: [
|
||||
Text("API Version: ",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onTertiary,
|
||||
fontWeight: FontWeight.w600)),
|
||||
Text(globals.serverManager.getApiVersion(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onTertiary)),
|
||||
const SizedBox(width: 16),
|
||||
Text("Server Version: ",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onTertiary,
|
||||
fontWeight: FontWeight.w600)),
|
||||
Text(_serverVersion,
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).colorScheme.onTertiary))
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.grey[100]
|
||||
: Colors.grey[900],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.dns_outlined,
|
||||
color: (() {
|
||||
switch (_serverStatus) {
|
||||
case ServerStatus.connected:
|
||||
return Colors.green;
|
||||
case ServerStatus.connecting:
|
||||
return Colors.orange;
|
||||
case ServerStatus.disconnected:
|
||||
return Colors.red;
|
||||
}
|
||||
}())),
|
||||
const SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text("Connected to",
|
||||
style: TextStyle(color: Colors.grey)),
|
||||
Text(globals.serverManager.getServerUrl(),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16)),
|
||||
Row(
|
||||
children: [
|
||||
const Text("API Version: ",
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w600)),
|
||||
Text(globals.serverManager.getApiVersion(),
|
||||
style:
|
||||
const TextStyle(color: Colors.grey)),
|
||||
const SizedBox(width: 16),
|
||||
const Text("Server Version: ",
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w600)),
|
||||
Text(_serverVersion,
|
||||
style:
|
||||
const TextStyle(color: Colors.grey))
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Divider(color: Theme.of(context).dividerColor),
|
||||
const Divider(),
|
||||
const SizedBox(height: 8),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
@ -142,7 +165,9 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.grey[100]
|
||||
: Colors.grey[900],
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(
|
||||
@ -176,7 +201,9 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.grey[100]
|
||||
: Colors.grey[900],
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(
|
||||
@ -202,7 +229,7 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var url = Uri.parse(
|
||||
"https://wiki.abmgrt.dev/de/projects/shlink-manager/privacy");
|
||||
"https://abmgrt.dev/shlink-manager/privacy");
|
||||
if (await canLaunchUrl(url)) {
|
||||
launchUrl(url, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
@ -210,7 +237,9 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.grey[100]
|
||||
: Colors.grey[900],
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(
|
||||
@ -237,19 +266,10 @@ class _SettingsViewState extends State<SettingsView> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8, right: 8, top: 4, bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color:
|
||||
Theme.of(context).colorScheme.surfaceContainer
|
||||
),
|
||||
child: Text(
|
||||
"${packageInfo.appName}, v${packageInfo.version} (${packageInfo.buildNumber})",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSecondary),
|
||||
),
|
||||
)
|
||||
Text(
|
||||
"${packageInfo.appName}, v${packageInfo.version} (${packageInfo.buildNumber})",
|
||||
style: const TextStyle(color: Colors.grey),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
@ -1,21 +1,15 @@
|
||||
import 'package:dartz/dartz.dart' as dartz;
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/short_url.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURLSubmission/short_url_submission.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import 'package:shlink_app/util/string_to_color.dart';
|
||||
import 'package:shlink_app/views/tag_selector_view.dart';
|
||||
import 'package:shlink_app/widgets/url_tags_list_widget.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
class ShortURLEditView extends StatefulWidget {
|
||||
const ShortURLEditView({super.key, this.shortUrl, this.longUrl});
|
||||
const ShortURLEditView({super.key, this.shortUrl});
|
||||
|
||||
final ShortURL? shortUrl;
|
||||
final String? longUrl;
|
||||
|
||||
@override
|
||||
State<ShortURLEditView> createState() => _ShortURLEditViewState();
|
||||
@ -27,7 +21,6 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
||||
final customSlugController = TextEditingController();
|
||||
final titleController = TextEditingController();
|
||||
final randomSlugLengthController = TextEditingController(text: "5");
|
||||
List<String> tags = [];
|
||||
|
||||
bool randomSlug = true;
|
||||
bool isCrawlable = true;
|
||||
@ -50,9 +43,6 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
||||
duration: const Duration(milliseconds: 500),
|
||||
);
|
||||
loadExistingUrl();
|
||||
if (widget.longUrl != null) {
|
||||
longUrlController.text = widget.longUrl!;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@ -69,7 +59,6 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
||||
if (widget.shortUrl != null) {
|
||||
longUrlController.text = widget.shortUrl!.longUrl;
|
||||
isCrawlable = widget.shortUrl!.crawlable;
|
||||
tags = widget.shortUrl!.tags;
|
||||
// for some reason this attribute is not returned by the api
|
||||
forwardQuery = true;
|
||||
titleController.text = widget.shortUrl!.title ?? "";
|
||||
@ -79,38 +68,11 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
||||
}
|
||||
}
|
||||
|
||||
void _saveButtonPressed() {
|
||||
if (!isSaving) {
|
||||
setState(() {
|
||||
isSaving = true;
|
||||
longUrlError = "";
|
||||
randomSlugLengthError = "";
|
||||
});
|
||||
if (longUrlController.text == "") {
|
||||
setState(() {
|
||||
longUrlError = "URL cannot be empty";
|
||||
isSaving = false;
|
||||
});
|
||||
return;
|
||||
} else if (int.tryParse(randomSlugLengthController.text) ==
|
||||
null ||
|
||||
int.tryParse(randomSlugLengthController.text)! < 1 ||
|
||||
int.tryParse(randomSlugLengthController.text)! > 50) {
|
||||
setState(() {
|
||||
randomSlugLengthError = "invalid number";
|
||||
isSaving = false;
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
_submitShortUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _submitShortUrl() async {
|
||||
var newSubmission = ShortURLSubmission(
|
||||
longUrl: longUrlController.text,
|
||||
tags: tags,
|
||||
deviceLongUrls: null,
|
||||
tags: [],
|
||||
crawlable: isCrawlable,
|
||||
forwardQuery: forwardQuery,
|
||||
findIfExists: true,
|
||||
@ -154,9 +116,22 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
||||
isSaving = false;
|
||||
});
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
var text = "";
|
||||
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
if ((r).invalidElements != null) {
|
||||
text = "$text: ${(r).invalidElements}";
|
||||
}
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text),
|
||||
backgroundColor: Colors.red[400],
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@ -166,239 +141,211 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverAppBar.medium(
|
||||
title: Text("${disableSlugEditor ? "Edit" : "New"} Short URL",
|
||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SliverAppBar.medium(
|
||||
title: Text("New Short URL",
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 16, left: 8, right: 8),
|
||||
child: Wrap(
|
||||
runSpacing: 16,
|
||||
children: [
|
||||
TextField(
|
||||
controller: longUrlController,
|
||||
decoration: InputDecoration(
|
||||
errorText: longUrlError != "" ? longUrlError : null,
|
||||
border: const OutlineInputBorder(),
|
||||
label: const Row(
|
||||
children: [
|
||||
Icon(Icons.public),
|
||||
SizedBox(width: 8),
|
||||
Text("Long URL")
|
||||
],
|
||||
)),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: !disableSlugEditor,
|
||||
controller: customSlugController,
|
||||
style: TextStyle(
|
||||
color: randomSlug
|
||||
? Theme.of(context).colorScheme.onTertiary
|
||||
: Theme.of(context).colorScheme.onPrimary),
|
||||
onChanged: (_) {
|
||||
if (randomSlug) {
|
||||
setState(() {
|
||||
randomSlug = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
label: Row(
|
||||
children: [
|
||||
const Icon(Icons.link),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
"${randomSlug ? "Random" : "Custom"} slug",
|
||||
style: TextStyle(
|
||||
fontStyle: randomSlug
|
||||
? FontStyle.italic
|
||||
: FontStyle.normal),
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
|
||||
if (widget.shortUrl == null)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: RotationTransition(
|
||||
turns: Tween(begin: 0.0, end: 3.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _customSlugDiceAnimationController,
|
||||
curve: Curves.easeInOutExpo)),
|
||||
child: IconButton(
|
||||
onPressed: disableSlugEditor
|
||||
? null
|
||||
: () {
|
||||
if (randomSlug) {
|
||||
_customSlugDiceAnimationController.reverse(
|
||||
from: 1);
|
||||
} else {
|
||||
_customSlugDiceAnimationController.forward(
|
||||
from: 0);
|
||||
}
|
||||
setState(() {
|
||||
randomSlug = !randomSlug;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
randomSlug ? Icons.casino : Icons.casino_outlined,
|
||||
color: randomSlug ? Colors.green : Colors.grey)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (randomSlug && widget.shortUrl == null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Random slug length"),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: TextField(
|
||||
controller: randomSlugLengthController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
errorText:
|
||||
randomSlugLengthError != "" ? "" : null,
|
||||
border: const OutlineInputBorder(),
|
||||
label: const Row(
|
||||
children: [
|
||||
Icon(Icons.tag),
|
||||
SizedBox(width: 8),
|
||||
Text("Length")
|
||||
],
|
||||
)),
|
||||
))
|
||||
],
|
||||
),
|
||||
TextField(
|
||||
controller: titleController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
label: Row(
|
||||
children: [
|
||||
Icon(Icons.badge),
|
||||
SizedBox(width: 8),
|
||||
Text("Title")
|
||||
],
|
||||
)),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
List<String>? selectedTags = await Navigator.of(context).
|
||||
push(MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
TagSelectorView(alreadySelectedTags: tags)));
|
||||
if (selectedTags != null) {
|
||||
setState(() {
|
||||
tags = selectedTags;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: InputDecorator(
|
||||
isEmpty: tags.isEmpty,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: longUrlController,
|
||||
decoration: InputDecoration(
|
||||
errorText: longUrlError != "" ? longUrlError : null,
|
||||
border: const OutlineInputBorder(),
|
||||
label: const Row(
|
||||
children: [
|
||||
Icon(Icons.public),
|
||||
SizedBox(width: 8),
|
||||
Text("Long URL")
|
||||
],
|
||||
)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: !disableSlugEditor,
|
||||
controller: customSlugController,
|
||||
style: TextStyle(
|
||||
color: randomSlug
|
||||
? Colors.grey
|
||||
: Theme.of(context).brightness ==
|
||||
Brightness.light
|
||||
? Colors.black
|
||||
: Colors.white),
|
||||
onChanged: (_) {
|
||||
if (randomSlug) {
|
||||
setState(() {
|
||||
randomSlug = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
label: Row(
|
||||
children: [
|
||||
Icon(Icons.label_outline),
|
||||
SizedBox(width: 8),
|
||||
Text("Tags")
|
||||
const Icon(Icons.link),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
"${randomSlug ? "Random" : "Custom"} slug",
|
||||
style: TextStyle(
|
||||
fontStyle: randomSlug
|
||||
? FontStyle.italic
|
||||
: FontStyle.normal),
|
||||
)
|
||||
],
|
||||
)),
|
||||
child: Wrap(
|
||||
runSpacing: 8,
|
||||
spacing: 8,
|
||||
children: tags.map((tag) {
|
||||
var boxColor = stringToColor(tag)
|
||||
.harmonizeWith(Theme.of(context).colorScheme.
|
||||
primary);
|
||||
var textColor = boxColor.computeLuminance() < 0.5
|
||||
? Colors.white
|
||||
: Colors.black;
|
||||
return InputChip(
|
||||
label: Text(tag, style: TextStyle(
|
||||
color: textColor
|
||||
)),
|
||||
backgroundColor: boxColor,
|
||||
deleteIcon: Icon(Icons.close,
|
||||
size: 18,
|
||||
color: textColor),
|
||||
onDeleted: () {
|
||||
setState(() {
|
||||
tags.remove(tag);
|
||||
});
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
RotationTransition(
|
||||
turns: Tween(begin: 0.0, end: 3.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _customSlugDiceAnimationController,
|
||||
curve: Curves.easeInOutExpo)),
|
||||
child: IconButton(
|
||||
onPressed: disableSlugEditor ? null : () {
|
||||
if (randomSlug) {
|
||||
_customSlugDiceAnimationController.reverse(
|
||||
from: 1);
|
||||
} else {
|
||||
_customSlugDiceAnimationController.forward(
|
||||
from: 0);
|
||||
}
|
||||
setState(() {
|
||||
randomSlug = !randomSlug;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
randomSlug ? Icons.casino : Icons.casino_outlined,
|
||||
color: randomSlug ? Colors.green : Colors.grey)),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (randomSlug) const SizedBox(height: 16),
|
||||
if (randomSlug)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Crawlable"),
|
||||
Switch(
|
||||
value: isCrawlable,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
isCrawlable = !isCrawlable;
|
||||
});
|
||||
},
|
||||
)
|
||||
const Text("Random slug length"),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: TextField(
|
||||
controller: randomSlugLengthController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
errorText:
|
||||
randomSlugLengthError != "" ? "" : null,
|
||||
border: const OutlineInputBorder(),
|
||||
label: const Row(
|
||||
children: [
|
||||
Icon(Icons.tag),
|
||||
SizedBox(width: 8),
|
||||
Text("Length")
|
||||
],
|
||||
)),
|
||||
))
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Forward query params"),
|
||||
Switch(
|
||||
value: forwardQuery,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
forwardQuery = !forwardQuery;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Copy to clipboard"),
|
||||
Switch(
|
||||
value: copyToClipboard,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
copyToClipboard = !copyToClipboard;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 150)
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
const SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: titleController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
label: Row(
|
||||
children: [
|
||||
Icon(Icons.badge),
|
||||
SizedBox(width: 8),
|
||||
Text("Title")
|
||||
],
|
||||
)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Crawlable"),
|
||||
Switch(
|
||||
value: isCrawlable,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
isCrawlable = !isCrawlable;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Forward query params"),
|
||||
Switch(
|
||||
value: forwardQuery,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
forwardQuery = !forwardQuery;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text("Copy to clipboard"),
|
||||
Switch(
|
||||
value: copyToClipboard,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
copyToClipboard = !copyToClipboard;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
_saveButtonPressed();
|
||||
if (!isSaving) {
|
||||
setState(() {
|
||||
isSaving = true;
|
||||
longUrlError = "";
|
||||
randomSlugLengthError = "";
|
||||
});
|
||||
if (longUrlController.text == "") {
|
||||
setState(() {
|
||||
longUrlError = "URL cannot be empty";
|
||||
isSaving = false;
|
||||
});
|
||||
return;
|
||||
} else if (int.tryParse(randomSlugLengthController.text) ==
|
||||
null ||
|
||||
int.tryParse(randomSlugLengthController.text)! < 1 ||
|
||||
int.tryParse(randomSlugLengthController.text)! > 50) {
|
||||
setState(() {
|
||||
randomSlugLengthError = "invalid number";
|
||||
isSaving = false;
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
_submitShortUrl();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: isSaving
|
||||
? const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: CircularProgressIndicator(strokeWidth: 3,
|
||||
color: Colors.white))
|
||||
child: CircularProgressIndicator(strokeWidth: 3))
|
||||
: const Icon(Icons.save)),
|
||||
);
|
||||
}
|
||||
|
@ -1,246 +0,0 @@
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/visits_summary.dart';
|
||||
import 'package:shlink_app/API/Classes/Tag/tag_with_stats.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import 'package:shlink_app/util/string_to_color.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
class TagSelectorView extends StatefulWidget {
|
||||
const TagSelectorView({super.key, this.alreadySelectedTags = const []});
|
||||
|
||||
final List<String> alreadySelectedTags;
|
||||
|
||||
@override
|
||||
State<TagSelectorView> createState() => _TagSelectorViewState();
|
||||
}
|
||||
|
||||
class _TagSelectorViewState extends State<TagSelectorView> {
|
||||
|
||||
final FocusNode searchTagFocusNode = FocusNode();
|
||||
final searchTagController = TextEditingController();
|
||||
|
||||
List<TagWithStats> availableTags = [];
|
||||
List<TagWithStats> selectedTags = [];
|
||||
List<TagWithStats> filteredTags = [];
|
||||
|
||||
bool tagsLoaded = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
selectedTags = [];
|
||||
searchTagController.text = "";
|
||||
filteredTags = [];
|
||||
searchTagFocusNode.requestFocus();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => loadTags());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
searchTagFocusNode.dispose();
|
||||
searchTagController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> loadTags() async {
|
||||
final response =
|
||||
await globals.serverManager.getTags();
|
||||
response.fold((l) {
|
||||
|
||||
List<TagWithStats> mappedAlreadySelectedTags =
|
||||
widget.alreadySelectedTags.map((e) {
|
||||
return l.firstWhere((t) => t.tag == e, orElse: () {
|
||||
// account for newly created tags
|
||||
return TagWithStats(e, 0, VisitsSummary(0,0,0));
|
||||
});
|
||||
}).toList();
|
||||
|
||||
setState(() {
|
||||
availableTags = (l + [... mappedAlreadySelectedTags]).toSet().toList();
|
||||
selectedTags = [...mappedAlreadySelectedTags];
|
||||
filteredTags = availableTags;
|
||||
tagsLoaded = true;
|
||||
});
|
||||
|
||||
_sortLists();
|
||||
return true;
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void _sortLists() {
|
||||
setState(() {
|
||||
availableTags.sort((a, b) => a.tag.compareTo(b.tag));
|
||||
filteredTags.sort((a, b) => a.tag.compareTo(b.tag));
|
||||
});
|
||||
}
|
||||
|
||||
void _searchTextChanged(String text) {
|
||||
if (text == "") {
|
||||
setState(() {
|
||||
filteredTags = availableTags;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
filteredTags = availableTags.where((t) => t.tag.toLowerCase()
|
||||
.contains(text.toLowerCase())).toList();
|
||||
});
|
||||
}
|
||||
_sortLists();
|
||||
}
|
||||
|
||||
void _addNewTag(String tag) {
|
||||
bool tagExists = availableTags.where((t) => t.tag == tag).toList().isNotEmpty;
|
||||
if (tag != "" && !tagExists) {
|
||||
TagWithStats tagWithStats = TagWithStats(tag, 0, VisitsSummary(0, 0, 0));
|
||||
setState(() {
|
||||
availableTags.add(tagWithStats);
|
||||
selectedTags.add(tagWithStats);
|
||||
_searchTextChanged(tag);
|
||||
});
|
||||
_sortLists();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: TextField(
|
||||
controller: searchTagController,
|
||||
focusNode: searchTagFocusNode,
|
||||
onChanged: _searchTextChanged,
|
||||
decoration: const InputDecoration(
|
||||
hintText: "Start typing...",
|
||||
border: InputBorder.none,
|
||||
icon: Icon(Icons.label_outline),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context, selectedTags.map((t) => t.tag).toList());
|
||||
},
|
||||
icon: const Icon(Icons.check),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
if (!tagsLoaded)
|
||||
const SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: CircularProgressIndicator(strokeWidth: 3),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (tagsLoaded && availableTags.isEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
"No Tags",
|
||||
style: TextStyle(
|
||||
fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'Start typing to add new tags!',
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Theme.of(context).colorScheme.onSecondary),
|
||||
),
|
||||
)
|
||||
],
|
||||
))))
|
||||
else
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
bool _isSelected = selectedTags.contains(filteredTags[index]);
|
||||
TagWithStats _tag = filteredTags[index];
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (_isSelected) {
|
||||
setState(() {
|
||||
selectedTags.remove(_tag);
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
selectedTags.add(_tag);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16,
|
||||
top: 16, bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: _isSelected ? Theme.of(context).colorScheme.primary : null,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).dividerColor)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Wrap(
|
||||
spacing: 10,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: stringToColor(_tag.tag)
|
||||
.harmonizeWith(Theme.of(context).colorScheme.primary),
|
||||
borderRadius: BorderRadius.circular(15)
|
||||
),
|
||||
|
||||
),
|
||||
Text(_tag.tag)
|
||||
],
|
||||
),
|
||||
Text("${_tag.shortUrlsCount} short URL"
|
||||
"${_tag.shortUrlsCount == 1 ? "" : "s"}",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onTertiary,
|
||||
fontSize: 12
|
||||
),)
|
||||
],
|
||||
)
|
||||
)
|
||||
);
|
||||
}, childCount: filteredTags.length
|
||||
),
|
||||
),
|
||||
if (searchTagController.text != "" &&
|
||||
!availableTags.contains(searchTagController.text))
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 8,
|
||||
left: 16, right: 16),
|
||||
child: Center(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
_addNewTag(searchTagController.text);
|
||||
},
|
||||
child: Text('Add tag "${searchTagController.text}"'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/short_url.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import 'package:shlink_app/views/redirect_rules_detail_view.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/views/short_url_edit_view.dart';
|
||||
import 'package:shlink_app/widgets/url_tags_list_widget.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
class URLDetailView extends StatefulWidget {
|
||||
@ -18,6 +16,7 @@ class URLDetailView extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _URLDetailViewState extends State<URLDetailView> {
|
||||
|
||||
ShortURL shortURL = ShortURL.empty();
|
||||
@override
|
||||
void initState() {
|
||||
@ -67,9 +66,18 @@ class _URLDetailViewState extends State<URLDetailView> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
return true;
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
var text = "";
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text),
|
||||
backgroundColor: Colors.red[400],
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
@ -91,16 +99,17 @@ class _URLDetailViewState extends State<URLDetailView> {
|
||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
ShortURL updatedUrl = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
ShortURLEditView(shortUrl: shortURL)));
|
||||
setState(() {
|
||||
shortURL = updatedUrl;
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.edit)),
|
||||
onPressed: () async {
|
||||
ShortURL updatedUrl = await Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => ShortURLEditView(shortUrl: shortURL)));
|
||||
setState(() {
|
||||
shortURL = updatedUrl;
|
||||
});
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.edit
|
||||
)
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
showDeletionConfirmation();
|
||||
@ -113,27 +122,40 @@ class _URLDetailViewState extends State<URLDetailView> {
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
|
||||
child: UrlTagsListWidget(tags: shortURL.tags)),
|
||||
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
|
||||
child: UrlTagsListWidget(tags: shortURL.tags)
|
||||
),
|
||||
),
|
||||
_ListCell(title: "Short Code", content: shortURL.shortCode),
|
||||
_ListCell(title: "Short URL", content: shortURL.shortUrl),
|
||||
_ListCell(title: "Long URL", content: shortURL.longUrl),
|
||||
_ListCell(
|
||||
title: "Short URL", content: shortURL.shortUrl, isUrl: true),
|
||||
_ListCell(title: "Long URL", content: shortURL.longUrl, isUrl: true),
|
||||
_ListCell(title: "Creation Date", content: shortURL.dateCreated),
|
||||
title: "iOS",
|
||||
content: shortURL.deviceLongUrls.ios,
|
||||
sub: true),
|
||||
_ListCell(
|
||||
title: "Redirect Rules",
|
||||
content: null,
|
||||
clickableDetailView: RedirectRulesDetailView(shortURL: shortURL)),
|
||||
title: "Android",
|
||||
content: shortURL.deviceLongUrls.android,
|
||||
sub: true),
|
||||
_ListCell(
|
||||
title: "Desktop",
|
||||
content: shortURL.deviceLongUrls.desktop,
|
||||
sub: true),
|
||||
_ListCell(
|
||||
title: "Creation Date", content: shortURL.dateCreated),
|
||||
const _ListCell(title: "Visits", content: ""),
|
||||
_ListCell(
|
||||
title: "Total", content: shortURL.visitsSummary.total, sub: true),
|
||||
title: "Total",
|
||||
content: shortURL.visitsSummary.total,
|
||||
sub: true),
|
||||
_ListCell(
|
||||
title: "Non-Bots",
|
||||
content: shortURL.visitsSummary.nonBots,
|
||||
sub: true),
|
||||
_ListCell(
|
||||
title: "Bots", content: shortURL.visitsSummary.bots, sub: true),
|
||||
title: "Bots",
|
||||
content: shortURL.visitsSummary.bots,
|
||||
sub: true),
|
||||
const _ListCell(title: "Meta", content: ""),
|
||||
_ListCell(
|
||||
title: "Valid Since",
|
||||
@ -144,9 +166,14 @@ class _URLDetailViewState extends State<URLDetailView> {
|
||||
content: shortURL.meta.validUntil,
|
||||
sub: true),
|
||||
_ListCell(
|
||||
title: "Max Visits", content: shortURL.meta.maxVisits, sub: true),
|
||||
title: "Max Visits",
|
||||
content: shortURL.meta.maxVisits,
|
||||
sub: true),
|
||||
_ListCell(title: "Domain", content: shortURL.domain),
|
||||
_ListCell(title: "Crawlable", content: shortURL.crawlable, last: true)
|
||||
_ListCell(
|
||||
title: "Crawlable",
|
||||
content: shortURL.crawlable,
|
||||
last: true)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -158,16 +185,12 @@ class _ListCell extends StatefulWidget {
|
||||
{required this.title,
|
||||
required this.content,
|
||||
this.sub = false,
|
||||
this.last = false,
|
||||
this.isUrl = false,
|
||||
this.clickableDetailView});
|
||||
this.last = false});
|
||||
|
||||
final String title;
|
||||
final dynamic content;
|
||||
final bool sub;
|
||||
final bool last;
|
||||
final bool isUrl;
|
||||
final Widget? clickableDetailView;
|
||||
|
||||
@override
|
||||
State<_ListCell> createState() => _ListCellState();
|
||||
@ -178,77 +201,65 @@ class _ListCellState extends State<_ListCell> {
|
||||
Widget build(BuildContext context) {
|
||||
return SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 16, bottom: widget.last ? 30 : 0),
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
if (widget.clickableDetailView != null) {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => widget.clickableDetailView!));
|
||||
} else if (widget.content is String) {
|
||||
Uri? parsedUrl = Uri.tryParse(widget.content);
|
||||
if (widget.isUrl &&
|
||||
parsedUrl != null &&
|
||||
await canLaunchUrl(parsedUrl)) {
|
||||
launchUrl(parsedUrl);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 16, left: 8, right: 8),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Theme.of(context).dividerColor)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
if (widget.sub)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 4),
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 6,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
widget.title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (widget.content is bool)
|
||||
Icon(widget.content ? Icons.check : Icons.close,
|
||||
color: widget.content ? Colors.green : Colors.red)
|
||||
else if (widget.content is int)
|
||||
Text(widget.content.toString())
|
||||
else if (widget.content is String)
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.content,
|
||||
textAlign: TextAlign.end,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
padding: EdgeInsets.only(top: 16, bottom: widget.last ? 30 : 0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 16, left: 8, right: 8),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.grey[800]!
|
||||
: Colors.grey[300]!)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
if (widget.sub)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 4),
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 6,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.grey[700]
|
||||
: Colors.grey[300],
|
||||
),
|
||||
)
|
||||
else if (widget.content is DateTime)
|
||||
Text(DateFormat('yyyy-MM-dd - HH:mm')
|
||||
.format(widget.content))
|
||||
else if (widget.clickableDetailView != null)
|
||||
const Icon(Icons.chevron_right)
|
||||
else
|
||||
const Text("N/A")
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
widget.title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (widget.content is bool)
|
||||
Icon(widget.content ? Icons.check : Icons.close,
|
||||
color: widget.content ? Colors.green : Colors.red)
|
||||
else if (widget.content is int)
|
||||
Text(widget.content.toString())
|
||||
else if (widget.content is String)
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.content,
|
||||
textAlign: TextAlign.end,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
)));
|
||||
)
|
||||
else if (widget.content is DateTime)
|
||||
Text(DateFormat('yyyy-MM-dd - HH:mm').format(widget.content))
|
||||
else
|
||||
const Text("N/A")
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:shlink_app/API/Classes/ShortURL/short_url.dart';
|
||||
import 'package:shlink_app/util/build_api_error_snackbar.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/views/short_url_edit_view.dart';
|
||||
import 'package:shlink_app/views/url_detail_view.dart';
|
||||
import 'package:shlink_app/widgets/url_tags_list_widget.dart';
|
||||
@ -38,9 +38,18 @@ class _URLListViewState extends State<URLListView> {
|
||||
});
|
||||
return true;
|
||||
}, (r) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
buildApiErrorSnackbar(r, context)
|
||||
);
|
||||
var text = "";
|
||||
if (r is RequestFailure) {
|
||||
text = r.description;
|
||||
} else {
|
||||
text = (r as ApiFailure).detail;
|
||||
}
|
||||
|
||||
final snackBar = SnackBar(
|
||||
content: Text(text),
|
||||
backgroundColor: Colors.red[400],
|
||||
behavior: SnackBarBehavior.floating);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@ -90,7 +99,7 @@ class _URLListViewState extends State<URLListView> {
|
||||
'Create one by tapping the "+" button below',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.onSecondary),
|
||||
color: Colors.grey[600]),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -142,11 +151,18 @@ class _URLListViewState extends State<URLListView> {
|
||||
eyeStyle: QrEyeStyle(
|
||||
eyeShape: QrEyeShape.square,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimary,
|
||||
MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
dataModuleStyle: QrDataModuleStyle(
|
||||
dataModuleShape: QrDataModuleShape.square,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
color:
|
||||
MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
))),
|
||||
),
|
||||
@ -178,11 +194,11 @@ class _ShortURLCellState extends State<ShortURLCell> {
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
await Navigator.of(context)
|
||||
.push(MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
URLDetailView(shortURL: widget.shortURL)))
|
||||
.then((a) => {widget.reload()});
|
||||
await Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => URLDetailView(shortURL: widget.shortURL)))
|
||||
.then((a) => {
|
||||
widget.reload()
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
@ -193,7 +209,10 @@ class _ShortURLCellState extends State<ShortURLCell> {
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).dividerColor)),
|
||||
color: MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.grey[800]!
|
||||
: Colors.grey[300]!)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@ -212,7 +231,7 @@ class _ShortURLCellState extends State<ShortURLCell> {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textScaleFactor: 0.9,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onTertiary),
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
),
|
||||
// List tags in a row
|
||||
UrlTagsListWidget(tags: widget.shortURL.tags)
|
||||
|
@ -1,133 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:shlink_app/main.dart';
|
||||
import 'package:shlink_app/views/login_view.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
class AvailableServerBottomSheet extends StatefulWidget {
|
||||
const AvailableServerBottomSheet({super.key});
|
||||
|
||||
@override
|
||||
State<AvailableServerBottomSheet> createState() =>
|
||||
_AvailableServerBottomSheetState();
|
||||
}
|
||||
|
||||
class _AvailableServerBottomSheetState
|
||||
extends State<AvailableServerBottomSheet> {
|
||||
List<String> availableServers = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadServers();
|
||||
}
|
||||
|
||||
Future<void> _loadServers() async {
|
||||
List<String> savedServers =
|
||||
await globals.serverManager.getAvailableServers();
|
||||
setState(() {
|
||||
availableServers = savedServers;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
const SliverAppBar.medium(
|
||||
expandedHeight: 120,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
"Available Servers",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
SliverList(
|
||||
delegate:
|
||||
SliverChildBuilderDelegate((BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString("lastusedserver", availableServers[index]);
|
||||
await Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (context) => const InitialPage()),
|
||||
(Route<dynamic> route) => false);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 8),
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 8, right: 8, top: 16, bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color:
|
||||
MediaQuery.of(context).platformBrightness ==
|
||||
Brightness.dark
|
||||
? Colors.grey[800]!
|
||||
: Colors.grey[300]!)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.dns_outlined),
|
||||
Text(availableServers[index])
|
||||
],
|
||||
),
|
||||
Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
if (availableServers[index] ==
|
||||
globals.serverManager.serverUrl)
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green,
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
globals.serverManager
|
||||
.logOut(availableServers[index]);
|
||||
if (availableServers[index] ==
|
||||
globals.serverManager.serverUrl) {
|
||||
await Navigator.of(context)
|
||||
.pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const InitialPage()),
|
||||
(Route<dynamic> route) => false);
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.logout, color: Colors.red),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
))),
|
||||
);
|
||||
}, childCount: availableServers.length)),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
await Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (context) => const LoginView()));
|
||||
},
|
||||
child: const Text("Add server..."),
|
||||
),
|
||||
),
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -16,26 +16,27 @@ class _UrlTagsListWidgetState extends State<UrlTagsListWidget> {
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
children: widget.tags.map((tag) {
|
||||
var boxColor = stringToColor(tag)
|
||||
.harmonizeWith(Theme.of(context).colorScheme.primary);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 4, top: 4),
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 4, bottom: 4, left: 12, right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
color: boxColor,
|
||||
),
|
||||
child: Text(
|
||||
tag,
|
||||
style: TextStyle(
|
||||
color: boxColor.computeLuminance() < 0.5
|
||||
? Colors.white
|
||||
: Colors.black),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList());
|
||||
var boxColor = stringToColor(tag)
|
||||
.harmonizeWith(
|
||||
Theme.of(context).colorScheme.primary);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 4, top: 4),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 4, bottom: 4, left: 12, right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
color: boxColor,
|
||||
),
|
||||
child: Text(
|
||||
tag,
|
||||
style: TextStyle(
|
||||
color: boxColor.computeLuminance() < 0.5
|
||||
? Colors.white
|
||||
: Colors.black),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList());
|
||||
}
|
||||
}
|
||||
|
281
pubspec.lock
281
pubspec.lock
@ -5,18 +5,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: archive
|
||||
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
|
||||
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.6.1"
|
||||
version: "3.4.10"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
|
||||
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.4.2"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -69,10 +69,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.18.0"
|
||||
version: "1.17.2"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -85,10 +93,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
version: "1.0.6"
|
||||
dartz:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -101,10 +109,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dynamic_color
|
||||
sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d
|
||||
sha256: a866f1f8947bfdaf674d7928e769eac7230388a2e7a2542824fad4bb5b87be3b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.6.9"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -117,10 +125,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
|
||||
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
version: "2.1.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -137,19 +145,20 @@ packages:
|
||||
flutter_launcher_icons:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_launcher_icons
|
||||
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: "feat/monochrome-icons-support"
|
||||
resolved-ref: "1902eba83da89b0350a70672ac7c963cd995e017"
|
||||
url: "https://github.com/OutdatedGuy/flutter_launcher_icons.git"
|
||||
source: git
|
||||
version: "0.13.1"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
|
||||
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "3.0.1"
|
||||
flutter_process_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -162,58 +171,50 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_secure_storage
|
||||
sha256: "165164745e6afb5c0e3e3fcc72a012fb9e58496fb26ffb92cf22e16a821e85d0"
|
||||
sha256: "22dbf16f23a4bcf9d35e51be1c84ad5bb6f627750565edd70dab70f3ff5fff8f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.2.2"
|
||||
version: "8.1.0"
|
||||
flutter_secure_storage_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_secure_storage_linux
|
||||
sha256: "4d91bfc23047422cbcd73ac684bc169859ee766482517c22172c86596bf1464b"
|
||||
sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
version: "1.2.0"
|
||||
flutter_secure_storage_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_secure_storage_macos
|
||||
sha256: "1693ab11121a5f925bbea0be725abfcfbbcf36c1e29e571f84a0c0f436147a81"
|
||||
sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
version: "3.0.1"
|
||||
flutter_secure_storage_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_secure_storage_platform_interface
|
||||
sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8
|
||||
sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "1.0.2"
|
||||
flutter_secure_storage_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_secure_storage_web
|
||||
sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9
|
||||
sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
version: "1.1.2"
|
||||
flutter_secure_storage_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_secure_storage_windows
|
||||
sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709
|
||||
sha256: "38f9501c7cb6f38961ef0e1eacacee2b2d4715c63cc83fe56449c4d3d0b47255"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
flutter_sharing_intent:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_sharing_intent
|
||||
sha256: "785ffc391822641457f930eb477c91c2f598a888f50b8fbb40d481ee01c7e719"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
version: "2.1.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -228,10 +229,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
|
||||
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
version: "0.13.6"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -244,18 +245,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
|
||||
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.0"
|
||||
version: "4.1.4"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.19.0"
|
||||
version: "0.18.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -268,122 +269,74 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.4"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "4.8.1"
|
||||
license_generator:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: license_generator
|
||||
sha256: "0b111c03cbccfa36a68a8738e3b2a54392a269673b5258d5fc6a83302d675a9e"
|
||||
sha256: "147605cac9b1ca9ab7f52ed235498927fe7a9edaef56d1b4687f22b9b03f6bad"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "1.0.5"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
|
||||
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "3.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.16+1"
|
||||
version: "0.12.16"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
version: "0.5.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.0"
|
||||
version: "1.9.1"
|
||||
package_info_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info_plus
|
||||
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0
|
||||
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.0.0"
|
||||
version: "4.2.0"
|
||||
package_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_info_plus_platform_interface
|
||||
sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e
|
||||
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "2.0.1"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "30c5aa827a6ae95ce2853cdc5fe3971daaac00f6f081c419c013f7f57bff2f5e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.7"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
version: "1.8.3"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -404,26 +357,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
|
||||
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
version: "2.2.1"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
|
||||
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.2"
|
||||
version: "5.4.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
|
||||
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.5"
|
||||
version: "3.1.4"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -432,14 +385,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
pointycastle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.7.4"
|
||||
qr:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: qr
|
||||
sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445"
|
||||
sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
version: "3.0.1"
|
||||
qr_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -452,26 +413,26 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: shared_preferences
|
||||
sha256: d3bbe5553a986e83980916ded2f0b435ef2e1893dfaa29d5a7a790d0eca12180
|
||||
sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.3"
|
||||
version: "2.2.2"
|
||||
shared_preferences_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_android
|
||||
sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577"
|
||||
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.3"
|
||||
version: "2.2.1"
|
||||
shared_preferences_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_foundation
|
||||
sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7"
|
||||
sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
version: "2.3.5"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -484,18 +445,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_platform_interface
|
||||
sha256: "034650b71e73629ca08a0bd789fd1d83cc63c2d1e405946f7cef7bc37432f93a"
|
||||
sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
version: "2.3.2"
|
||||
shared_preferences_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_web
|
||||
sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a"
|
||||
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
version: "2.2.1"
|
||||
shared_preferences_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -521,18 +482,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
version: "1.11.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -553,10 +514,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
version: "0.6.0"
|
||||
tuple:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -577,26 +538,26 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3"
|
||||
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
version: "6.1.9"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "95d8027db36a0e52caf55680f91e33ea6aa12a3ce608c90b06f4e429a21067ac"
|
||||
sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.5"
|
||||
version: "6.2.2"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e
|
||||
sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.1"
|
||||
version: "6.2.4"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -609,34 +570,34 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de"
|
||||
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
version: "3.1.0"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
version: "2.3.1"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a"
|
||||
sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
version: "2.2.0"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185"
|
||||
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
version: "3.1.1"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -645,30 +606,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.1"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
|
||||
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.1"
|
||||
version: "0.1.4-beta"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
|
||||
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.5.1"
|
||||
version: "5.1.1"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -681,10 +634,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
||||
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
version: "6.3.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -694,5 +647,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.4.0 <4.0.0"
|
||||
flutter: ">=3.22.0"
|
||||
dart: ">=3.1.0 <4.0.0"
|
||||
flutter: ">=3.13.0"
|
||||
|
24
pubspec.yaml
24
pubspec.yaml
@ -16,10 +16,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.4.0+11
|
||||
version: 1.1.0+6
|
||||
|
||||
environment:
|
||||
sdk: ^3.0.0
|
||||
sdk: ^2.19.0
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
@ -31,26 +31,28 @@ dependencies:
|
||||
#
|
||||
|
||||
cupertino_icons: ^1.0.5
|
||||
http: ^1.1.0
|
||||
http: ^0.13.6
|
||||
flutter_process_text: ^1.1.2
|
||||
flutter_secure_storage: ^9.0.0
|
||||
flutter_secure_storage: ^8.0.0
|
||||
dartz: ^0.10.1
|
||||
qr_flutter: ^4.1.0
|
||||
tuple: ^2.0.2
|
||||
intl: ^0.19.0
|
||||
intl: ^0.18.1
|
||||
dynamic_color: ^1.6.6
|
||||
url_launcher: ^6.2.4
|
||||
package_info_plus: ^8.0.0
|
||||
url_launcher: 6.1.9
|
||||
package_info_plus: ^4.0.2
|
||||
shared_preferences: ^2.2.2
|
||||
flutter_sharing_intent: ^1.1.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
license_generator: ^2.0.0
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
license_generator: ^1.0.5
|
||||
flutter_launcher_icons:
|
||||
git:
|
||||
url: https://github.com/OutdatedGuy/flutter_launcher_icons.git
|
||||
ref: feat/monochrome-icons-support
|
||||
|
||||
flutter_lints: ^4.0.0
|
||||
flutter_lints: ^3.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user