Skip to content

Commit

Permalink
Upgrade freezed
Browse files Browse the repository at this point in the history
  • Loading branch information
esDotDev committed Mar 16, 2021
1 parent a27eb94 commit 90127f3
Show file tree
Hide file tree
Showing 27 changed files with 1,271 additions and 858 deletions.
8 changes: 6 additions & 2 deletions lib/_spikes/popup_menu_spike/popup_panel_spike.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ class PopupPanelSpike extends StatefulWidget {

class _PopupPanelSpikeState extends State<PopupPanelSpike> {
PlacedScrapItem _item = PlacedScrapItem(
rot: 30,
boxStyle: BoxStyle(font: BoxFonts.Caveat, align: TextAlign.center, fgColor: Colors.red, bgColor: Colors.blue));
rot: 30,
boxStyle: BoxStyle(font: BoxFonts.Caveat, align: TextAlign.center, fgColor: Colors.red, bgColor: Colors.blue),
scale: 1,
lastModifiedTime: 0,
dy: 0,
);
@override
Widget build(BuildContext context) {
return MaterialApp(
Expand Down
2 changes: 1 addition & 1 deletion lib/app_keys.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @dart=2.9

class AppKeys {
static String cloudinaryCloud = "flutterfoliodemo";
static String cloudinaryPreset = "ujszrrfn";
Expand Down
3 changes: 2 additions & 1 deletion lib/commands/books/upload_image_scraps_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class UploadImageScrapsCommand extends BaseAppCommand {
// Now that we have urls, replace the newScraps with ones that have a url
List<ScrapItem> items = uploads.map((u) {
ScrapItem s = newScraps.removeAt(0); // Take first element from list
String origPath = paths.firstWhereOrDefault((element) => element.contains(u.originalFilename));
List<String?> p = List.from(paths);
String? origPath = p.firstWhere((element) => element?.contains(u.originalFilename) ?? false, orElse: () => null);
double aspect = 1;
// Try and calculate the aspect ratio from the file on disk
if (origPath != null && origPath.contains("http") == false) {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/pick_images_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PickImagesCommand extends BaseAppCommand {
} else {
int maxImages = 24; // Need to pick some limit
paths = (await MultiImagePicker.pickImages(enableCamera: enableCamera, maxImages: allowMultiple ? maxImages : 1))
.map((asset) => asset.identifier)
.map((asset) => asset.identifier!)
.toList();
}
paths.removeWhere((p) => StringUtils.isEmpty(p));
Expand Down
2 changes: 1 addition & 1 deletion lib/core_packages.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @dart=2.9

export 'package:darq/darq.dart'; // Extra list sorting methods sortByDescending, etc
export 'package:flutter_folio/styled_widgets/styled_widgets.dart';
export 'package:provider/provider.dart'; // Context extensions for Provider, .watch() etc
Expand Down
21 changes: 10 additions & 11 deletions lib/data/app_user.dart
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
// @dart=2.9
import 'package:flutter_folio/_utils/string_utils.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'app_user.freezed.dart';
part 'app_user.g.dart';

@freezed
abstract class AppUser with _$AppUser {
class AppUser with _$AppUser {
static String kDefaultImageUrl =
"https://images.unsplash.com/photo-1481627834876-b7833e8f5570?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=50&q=80";
const AppUser._();
factory AppUser({
@nullable String documentId,
@required String email,
@required String fireId,
String firstName,
String lastName,
String imageUrl,
@Default("") String documentId,
required String email,
required String fireId,
String? firstName,
String? lastName,
String? imageUrl,
}) = _AppUser;

factory AppUser.fromJson(Map<String, dynamic> json) => _$AppUserFromJson(json);

String getDisplayName() {
String result = firstName ?? null;
if (StringUtils.isNotEmpty(lastName)) result += " $lastName";
String? getDisplayName() {
String? result = firstName ?? null;
if (StringUtils.isNotEmpty(lastName)) result = (result ?? "") + " $lastName";
return result;
}
}
Loading

0 comments on commit 90127f3

Please sign in to comment.