|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
import 'dart:convert';
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
+import 'package:collection/collection.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
@@ -59,7 +60,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
final enteColorScheme = getEnteColorScheme(context);
|
|
final enteColorScheme = getEnteColorScheme(context);
|
|
- final PublicURL url = widget.collection?.publicURLs?.first;
|
|
|
|
|
|
+ final PublicURL url = widget.collection?.publicURLs?.firstOrNull;
|
|
return Scaffold(
|
|
return Scaffold(
|
|
backgroundColor: Theme.of(context).backgroundColor,
|
|
backgroundColor: Theme.of(context).backgroundColor,
|
|
appBar: AppBar(
|
|
appBar: AppBar(
|
|
@@ -128,9 +129,9 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
|
|
menuItemColor: getEnteColorScheme(context).fillFaint,
|
|
menuItemColor: getEnteColorScheme(context).fillFaint,
|
|
pressedColor: getEnteColorScheme(context).fillFaint,
|
|
pressedColor: getEnteColorScheme(context).fillFaint,
|
|
trailingSwitch: Switch.adaptive(
|
|
trailingSwitch: Switch.adaptive(
|
|
- value:
|
|
|
|
- widget.collection.publicURLs?.first?.enableDownload ??
|
|
|
|
- true,
|
|
|
|
|
|
+ value: widget.collection.publicURLs?.firstOrNull
|
|
|
|
+ ?.enableDownload ??
|
|
|
|
+ true,
|
|
onChanged: (value) async {
|
|
onChanged: (value) async {
|
|
if (!value) {
|
|
if (!value) {
|
|
final choice = await showChoiceDialog(
|
|
final choice = await showChoiceDialog(
|
|
@@ -177,8 +178,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
|
|
menuItemColor: getEnteColorScheme(context).fillFaint,
|
|
menuItemColor: getEnteColorScheme(context).fillFaint,
|
|
pressedColor: getEnteColorScheme(context).fillFaint,
|
|
pressedColor: getEnteColorScheme(context).fillFaint,
|
|
trailingSwitch: Switch.adaptive(
|
|
trailingSwitch: Switch.adaptive(
|
|
- value: widget
|
|
|
|
- .collection.publicURLs?.first?.passwordEnabled ??
|
|
|
|
|
|
+ value: widget.collection.publicURLs?.firstOrNull
|
|
|
|
+ ?.passwordEnabled ??
|
|
false,
|
|
false,
|
|
onChanged: (enablePassword) async {
|
|
onChanged: (enablePassword) async {
|
|
if (enablePassword) {
|
|
if (enablePassword) {
|
|
@@ -471,7 +472,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
|
|
}
|
|
}
|
|
|
|
|
|
Text _getLinkExpiryTimeWidget() {
|
|
Text _getLinkExpiryTimeWidget() {
|
|
- final int validTill = widget.collection.publicURLs?.first?.validTill ?? 0;
|
|
|
|
|
|
+ final int validTill =
|
|
|
|
+ widget.collection.publicURLs?.firstOrNull?.validTill ?? 0;
|
|
if (validTill == 0) {
|
|
if (validTill == 0) {
|
|
return const Text(
|
|
return const Text(
|
|
'Never',
|
|
'Never',
|