Refactor: Clean up unused widgets + lint fixes (#928)
This commit is contained in:
commit
cb1e5ebb72
7 changed files with 11 additions and 129 deletions
|
@ -131,7 +131,8 @@ class BonusDetails {
|
||||||
|
|
||||||
factory BonusDetails.fromJson(Map<String, dynamic> json) => BonusDetails(
|
factory BonusDetails.fromJson(Map<String, dynamic> json) => BonusDetails(
|
||||||
referralStats: List<ReferralStat>.from(
|
referralStats: List<ReferralStat>.from(
|
||||||
json["referralStats"].map((x) => ReferralStat.fromJson(x))),
|
json["referralStats"].map((x) => ReferralStat.fromJson(x)),
|
||||||
|
),
|
||||||
bonuses:
|
bonuses:
|
||||||
List<Bonus>.from(json["bonuses"].map((x) => Bonus.fromJson(x))),
|
List<Bonus>.from(json["bonuses"].map((x) => Bonus.fromJson(x))),
|
||||||
refCount: json["refCount"],
|
refCount: json["refCount"],
|
||||||
|
|
|
@ -137,7 +137,10 @@ class FavoritesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateFavorites(
|
Future<void> updateFavorites(
|
||||||
BuildContext context, List<File> files, bool favFlag) async {
|
BuildContext context,
|
||||||
|
List<File> files,
|
||||||
|
bool favFlag,
|
||||||
|
) async {
|
||||||
final int currentUserID = Configuration.instance.getUserID()!;
|
final int currentUserID = Configuration.instance.getUserID()!;
|
||||||
if (files.any((f) => f.uploadedFileID == null)) {
|
if (files.any((f) => f.uploadedFileID == null)) {
|
||||||
throw AssertionError("Can only favorite uploaded items");
|
throw AssertionError("Can only favorite uploaded items");
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:photos/core/event_bus.dart';
|
import 'package:photos/core/event_bus.dart';
|
||||||
import 'package:photos/core/network/network.dart';
|
|
||||||
import 'package:photos/data/holidays.dart';
|
import 'package:photos/data/holidays.dart';
|
||||||
import 'package:photos/data/months.dart';
|
import 'package:photos/data/months.dart';
|
||||||
import 'package:photos/data/years.dart';
|
import 'package:photos/data/years.dart';
|
||||||
|
@ -21,7 +20,6 @@ import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
class SearchService {
|
class SearchService {
|
||||||
Future<List<File>>? _cachedFilesFuture;
|
Future<List<File>>? _cachedFilesFuture;
|
||||||
final _enteDio = NetworkClient.instance.enteDio;
|
|
||||||
final _logger = Logger((SearchService).toString());
|
final _logger = Logger((SearchService).toString());
|
||||||
final _collectionService = CollectionsService.instance;
|
final _collectionService = CollectionsService.instance;
|
||||||
static const _maximumResultsLimit = 20;
|
static const _maximumResultsLimit = 20;
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class DividerWithPadding extends StatelessWidget {
|
|
||||||
final double left, top, right, bottom, thickness;
|
|
||||||
|
|
||||||
const DividerWithPadding({
|
|
||||||
Key? key,
|
|
||||||
this.left = 0,
|
|
||||||
this.top = 0,
|
|
||||||
this.right = 0,
|
|
||||||
this.bottom = 0,
|
|
||||||
this.thickness = 0.5,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(left, top, right, bottom),
|
|
||||||
child: Divider(
|
|
||||||
thickness: thickness,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,97 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:photos/utils/dialog_util.dart';
|
|
||||||
|
|
||||||
class RenameDialog extends StatefulWidget {
|
|
||||||
final String? name;
|
|
||||||
final String type;
|
|
||||||
final int maxLength;
|
|
||||||
|
|
||||||
const RenameDialog(this.name, this.type, {Key? key, this.maxLength = 100})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<RenameDialog> createState() => _RenameDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RenameDialogState extends State<RenameDialog> {
|
|
||||||
String? _newName;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_newName = widget.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text("Enter a new name"),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: '${widget.type} name',
|
|
||||||
hintStyle: const TextStyle(
|
|
||||||
color: Colors.white30,
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.all(12),
|
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_newName = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
autocorrect: false,
|
|
||||||
keyboardType: TextInputType.text,
|
|
||||||
initialValue: _newName,
|
|
||||||
autofocus: true,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
child: const Text(
|
|
||||||
"Cancel",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.redAccent,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop(null);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: Text(
|
|
||||||
"Rename",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (_newName!.trim().isEmpty) {
|
|
||||||
showErrorDialog(
|
|
||||||
context,
|
|
||||||
"Empty name",
|
|
||||||
"${widget.type} name cannot be empty",
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_newName!.trim().length > widget.maxLength) {
|
|
||||||
showErrorDialog(
|
|
||||||
context,
|
|
||||||
"Name too large",
|
|
||||||
"${widget.type} name should be less than ${widget.maxLength} characters",
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Navigator.of(context).pop(_newName!.trim());
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -135,9 +135,10 @@ class _ApplyCodeScreenState extends State<ApplyCodeScreen> {
|
||||||
Logger('$runtimeType')
|
Logger('$runtimeType')
|
||||||
.severe("failed to apply referral", e);
|
.severe("failed to apply referral", e);
|
||||||
showErrorDialogForException(
|
showErrorDialogForException(
|
||||||
context: context,
|
context: context,
|
||||||
exception: e as Exception,
|
exception: e as Exception,
|
||||||
apiErrorPrefix: "Failed to apply code");
|
apiErrorPrefix: "Failed to apply code",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,7 +43,7 @@ class _ReferralScreenState extends State<ReferralScreen> {
|
||||||
await UserService.instance.getUserDetailsV2(memoryCount: false);
|
await UserService.instance.getUserDetailsV2(memoryCount: false);
|
||||||
final referralView =
|
final referralView =
|
||||||
await StorageBonusService.instance.getGateway().getReferralView();
|
await StorageBonusService.instance.getGateway().getReferralView();
|
||||||
return Tuple2(referralView, cachedUserDetails!);
|
return Tuple2(referralView, cachedUserDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Add table
Reference in a new issue