Skip to content

Commit fb7ced0

Browse files
committed
Fix id
1 parent 15db4e7 commit fb7ced0

File tree

17 files changed

+625
-1073
lines changed

17 files changed

+625
-1073
lines changed

api/lib/helpers/mapper.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:typed_data';
2+
13
import 'package:dart_leap/dart_leap.dart';
24
import 'package:dart_mappable/dart_mappable.dart';
35

@@ -17,3 +19,23 @@ class SecondsDateTimeMapper extends SimpleMapper<DateTime> {
1719
return self?.secondsSinceEpoch;
1820
}
1921
}
22+
23+
class Uint8ListConverter extends SimpleMapper<Uint8List> {
24+
const Uint8ListConverter();
25+
26+
@override
27+
Uint8List decode(Object value) {
28+
if (value is Uint8List) {
29+
return value;
30+
}
31+
if (value is List) {
32+
return Uint8List.fromList(value.cast<int>());
33+
}
34+
return Uint8List(0);
35+
}
36+
37+
@override
38+
Object? encode(Uint8List self) {
39+
return self;
40+
}
41+
}

api/lib/helpers/setup.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import 'package:dart_mappable/dart_mappable.dart';
22
import 'package:flow_api/helpers/mapper.dart';
33

44
void setupAPI() {
5-
MapperContainer.globals.use(SecondsDateTimeMapper());
5+
MapperContainer.globals
6+
.useAll([SecondsDateTimeMapper(), Uint8ListConverter()]);
67
}

api/lib/models/label/model.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:dart_leap/dart_leap.dart';
12
import 'package:dart_mappable/dart_mappable.dart';
23
import 'dart:typed_data';
34
import 'package:flow_api/models/model.dart';
@@ -10,13 +11,13 @@ class Label with LabelMappable, IdentifiedModel, NamedModel, DescriptiveModel {
1011
final Uint8List? id;
1112
@override
1213
final String name, description;
13-
final int color;
14+
final SRGBColor color;
1415

1516
const Label({
1617
this.id,
1718
this.name = '',
1819
this.description = '',
19-
this.color = kColorBlack,
20+
this.color = SRGBColor.black,
2021
});
2122

2223
factory Label.fromDatabase(Map<String, dynamic> row) => LabelMapper.fromMap({

api/lib/models/label/model.mapper.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class LabelMapper extends ClassMapperBase<Label> {
2828
static String _$description(Label v) => v.description;
2929
static const Field<Label, String> _f$description =
3030
Field('description', _$description, opt: true, def: '');
31-
static int _$color(Label v) => v.color;
32-
static const Field<Label, int> _f$color =
33-
Field('color', _$color, opt: true, def: kColorBlack);
31+
static SRGBColor _$color(Label v) => v.color;
32+
static const Field<Label, SRGBColor> _f$color =
33+
Field('color', _$color, opt: true, def: SRGBColor.black);
3434

3535
@override
3636
final MappableFields<Label> fields = const {
@@ -94,7 +94,7 @@ extension LabelValueCopy<$R, $Out> on ObjectCopyWith<$R, Label, $Out> {
9494

9595
abstract class LabelCopyWith<$R, $In extends Label, $Out>
9696
implements ClassCopyWith<$R, $In, $Out> {
97-
$R call({Uint8List? id, String? name, String? description, int? color});
97+
$R call({Uint8List? id, String? name, String? description, SRGBColor? color});
9898
LabelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);
9999
}
100100

@@ -109,7 +109,7 @@ class _LabelCopyWithImpl<$R, $Out> extends ClassCopyWithBase<$R, Label, $Out>
109109
{Object? id = $none,
110110
String? name,
111111
String? description,
112-
int? color}) =>
112+
SRGBColor? color}) =>
113113
$apply(FieldCopyWithData({
114114
if (id != $none) #id: id,
115115
if (name != null) #name: name,

api/pubspec.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ packages:
170170
dependency: "direct main"
171171
description:
172172
path: "packages/dart_leap"
173-
ref: dfda6c2e3cef2e29511f97e9470fd4deb8e0c573
174-
resolved-ref: dfda6c2e3cef2e29511f97e9470fd4deb8e0c573
175-
url: "https://github.com/LinwoodDev/dart_pkgs"
173+
ref: db69a03082e6811c58dc2d0e5c23d04305e1623f
174+
resolved-ref: db69a03082e6811c58dc2d0e5c23d04305e1623f
175+
url: "https://github.com/LinwoodDev/dart_pkgs.git"
176176
source: git
177177
version: "1.0.0"
178178
dart_mappable:
@@ -259,10 +259,10 @@ packages:
259259
dependency: transitive
260260
description:
261261
name: http_parser
262-
sha256: "76d306a1c3afb33fe82e2bbacad62a61f409b5634c915fceb0d799de1a913360"
262+
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
263263
url: "https://pub.dev"
264264
source: hosted
265-
version: "4.1.1"
265+
version: "4.1.2"
266266
io:
267267
dependency: transitive
268268
description:
@@ -379,10 +379,10 @@ packages:
379379
dependency: transitive
380380
description:
381381
name: pubspec_parse
382-
sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0"
382+
sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082"
383383
url: "https://pub.dev"
384384
source: hosted
385-
version: "1.4.0"
385+
version: "1.5.0"
386386
shelf:
387387
dependency: transitive
388388
description:
@@ -467,10 +467,10 @@ packages:
467467
dependency: transitive
468468
description:
469469
name: stream_channel
470-
sha256: "4ac0537115a24d772c408a2520ecd0abb99bca2ea9c4e634ccbdbfae64fe17ec"
470+
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
471471
url: "https://pub.dev"
472472
source: hosted
473-
version: "2.1.3"
473+
version: "2.1.4"
474474
stream_transform:
475475
dependency: transitive
476476
description:

api/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A starting point for Dart libraries or applications.
44
# homepage: https://www.example.com
55

66
environment:
7-
sdk: ">=3.0.0 <4.0.0"
7+
sdk: ">=3.3.0 <4.0.0"
88

99
dependencies:
1010
meta: ^1.11.0
@@ -16,8 +16,8 @@ dependencies:
1616
dart_mappable: ^4.3.0
1717
dart_leap:
1818
git:
19-
url: https://github.com/LinwoodDev/dart_pkgs
20-
ref: dfda6c2e3cef2e29511f97e9470fd4deb8e0c573
19+
url: https://github.com/LinwoodDev/dart_pkgs.git
20+
ref: db69a03082e6811c58dc2d0e5c23d04305e1623f
2121
path: packages/dart_leap
2222
dev_dependencies:
2323
build_runner: ^2.4.14

app/android/Gemfile.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ GEM
1010
artifactory (3.0.17)
1111
atomos (0.1.3)
1212
aws-eventstream (1.3.0)
13-
aws-partitions (1.1027.0)
14-
aws-sdk-core (3.214.0)
13+
aws-partitions (1.1041.0)
14+
aws-sdk-core (3.216.0)
1515
aws-eventstream (~> 1, >= 1.3.0)
1616
aws-partitions (~> 1, >= 1.992.0)
1717
aws-sigv4 (~> 1.9)
1818
jmespath (~> 1, >= 1.6.1)
19-
aws-sdk-kms (1.96.0)
20-
aws-sdk-core (~> 3, >= 3.210.0)
19+
aws-sdk-kms (1.97.0)
20+
aws-sdk-core (~> 3, >= 3.216.0)
2121
aws-sigv4 (~> 1.5)
22-
aws-sdk-s3 (1.176.1)
23-
aws-sdk-core (~> 3, >= 3.210.0)
22+
aws-sdk-s3 (1.178.0)
23+
aws-sdk-core (~> 3, >= 3.216.0)
2424
aws-sdk-kms (~> 1)
2525
aws-sigv4 (~> 1.5)
26-
aws-sigv4 (1.10.1)
26+
aws-sigv4 (1.11.0)
2727
aws-eventstream (~> 1, >= 1.0.2)
2828
babosa (1.0.4)
2929
base64 (0.2.0)
@@ -67,7 +67,7 @@ GEM
6767
faraday-retry (1.0.3)
6868
faraday_middleware (1.2.1)
6969
faraday (~> 1.0)
70-
fastimage (2.3.1)
70+
fastimage (2.4.0)
7171
fastlane (2.226.0)
7272
CFPropertyList (>= 2.3, < 4.0.0)
7373
addressable (>= 2.8, < 3.0.0)
@@ -155,7 +155,7 @@ GEM
155155
httpclient (2.8.3)
156156
jmespath (1.6.2)
157157
json (2.9.1)
158-
jwt (2.9.3)
158+
jwt (2.10.1)
159159
base64
160160
mini_magick (4.13.2)
161161
mini_mime (1.1.5)
@@ -166,7 +166,7 @@ GEM
166166
nkf (0.2.0)
167167
optparse (0.6.0)
168168
os (1.1.4)
169-
plist (3.7.1)
169+
plist (3.7.2)
170170
public_suffix (6.0.1)
171171
rake (13.2.1)
172172
representable (3.2.0)
@@ -177,7 +177,7 @@ GEM
177177
rexml (3.4.0)
178178
rouge (3.28.0)
179179
ruby2_keywords (0.0.5)
180-
rubyzip (2.3.2)
180+
rubyzip (2.4.1)
181181
screengrab (1.0.0)
182182
fastlane (>= 2.0.0, < 3.0.0)
183183
security (0.1.5)

app/lib/api/storage/sources.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ class SourcesService {
1616
final BehaviorSubject<SyncStatus> syncStatus =
1717
BehaviorSubject.seeded(SyncStatus.synced);
1818
final FlutterSecureStorage secureStorage = const FlutterSecureStorage(
19-
aOptions: AndroidOptions(
20-
encryptedSharedPreferences: true,
21-
),
19+
aOptions: AndroidOptions(),
2220
);
2321

2422
SourcesService(this.settingsCubit);

app/lib/pages/notes/label.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ class LabelDialog extends StatelessWidget {
3535
mainAxisSize: MainAxisSize.min,
3636
children: [
3737
StatefulBuilder(
38-
builder: (context, setState) => ColorButton(
38+
builder: (context, setState) => ColorButton.srgb(
3939
onTap: () async {
4040
final result = await showDialog<ColorPickerResponse>(
4141
context: context,
4242
builder: (context) => ColorPicker(
43-
value: Color(currentLabel.color),
43+
value: currentLabel.color,
4444
));
4545
if (result == null) return;
46-
setState(() =>
47-
currentLabel = currentLabel.copyWith(color: result.color));
46+
setState(() => currentLabel =
47+
currentLabel.copyWith(color: result.toSRGB()));
4848
},
49-
color: Color(currentLabel.color).withAlpha(255),
49+
color: currentLabel.color.withOpacity(1),
5050
size: 25,
5151
),
5252
),

app/lib/pages/notes/navigator/labels.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ class _NoteLabelsViewState extends State<_NoteLabelsView> {
6969
return MenuAnchor(
7070
builder: (context, controller, child) => Tooltip(
7171
message: item.model.name,
72-
child: ColorButton(
72+
child: ColorButton.srgb(
7373
onTap: () =>
7474
widget.onChanged?.call(widget.filter.copyWith(
7575
selectedLabel: selected ? null : item.model.id,
7676
source: item.source,
7777
)),
7878
selected: selected,
79-
color: Color(item.model.color).withAlpha(255),
79+
color: item.model.color.withOpacity(1),
8080
onLongPress: controller.toggle,
8181
onSecondaryTap: controller.toggle,
8282
),

app/lib/pages/notes/view.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ class _NoteViewState extends State<NoteView> {
260260
.map((e) => Padding(
261261
padding: const EdgeInsets.all(8.0),
262262
child: InputChip(
263-
avatar: ColorButton(
264-
color: Color(e.color),
263+
avatar: ColorButton.srgb(
264+
color: e.color,
265265
),
266266
label: Text(e.name),
267267
onDeleted: () async {

app/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Foundation
77

88
import connectivity_plus
99
import dynamic_color
10-
import flutter_secure_storage_macos
10+
import flutter_secure_storage_darwin
1111
import package_info_plus
1212
import path_provider_foundation
1313
import screen_retriever_macos
@@ -20,7 +20,7 @@ import window_manager
2020
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
2121
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
2222
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
23-
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
23+
FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin"))
2424
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
2525
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
2626
ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin"))

0 commit comments

Comments
 (0)