Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
frnandu committed Sep 23, 2024
1 parent 060dd98 commit a542dcc
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 53 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
- public_member_api_docs
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

Expand Down
1 change: 1 addition & 0 deletions lib/data_layer/data_sources/isar_db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import '../models/db/db_relay_set.dart';
import '../models/db/db_user_relay_list.dart';

class IsarDbDs {
// the isar obj
late Isar isar;

IsarDbDs();
Expand Down
16 changes: 0 additions & 16 deletions lib/provider/relay_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,6 @@ class RelayProvider extends ChangeNotifier {
return "";
}

Future<Nip51Set?> getNip51RelaySet(String name) async {
Nip51Set? r = await ndk.lists.getCachedNip51RelaySet(name, loggedUserSigner!);
if (r == null) {
ndk.lists.getSingleNip51RelaySet(name, loggedUserSigner!);
}
return r;
}

Future<Nip51List?> getNip51List(int kind) async {
Nip51List? r = await ndk.lists.getCachedNip51List(kind, loggedUserSigner!);
if (r == null) {
ndk.lists.getSingleNip51List(kind, loggedUserSigner!);
}
return r;
}

void onRelayStatusChange() {
notifyListeners();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/badge_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BedgeComponent extends StatelessWidget {

BadgeDefinition badgeDefinition;

BedgeComponent({
BedgeComponent({super.key,
required this.badgeDefinition,
});

Expand Down
10 changes: 5 additions & 5 deletions lib/ui/content/content_mention_user_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import '../simple_name_component.dart';
import 'content_str_link_component.dart';

class ContentMentionUserComponent extends StatefulWidget {
String pubkey;
String _pubkey;

ContentMentionUserComponent({super.key, required this.pubkey});
ContentMentionUserComponent({super.key, required String pubkey}) : _pubkey = pubkey;

@override
State<StatefulWidget> createState() {
Expand All @@ -25,18 +25,18 @@ class _ContentMentionUserComponent extends State<ContentMentionUserComponent> {
return Selector<MetadataProvider, Metadata?>(
builder: (context, metadata, child) {
String name =
SimpleNameComponent.getSimpleName(widget.pubkey, metadata);
SimpleNameComponent.getSimpleName(widget._pubkey, metadata);

return ContentStrLinkComponent(
str: "$name",
showUnderline: false,
onTap: () {
RouterUtil.router(context, RouterPath.USER, widget.pubkey);
RouterUtil.router(context, RouterPath.USER, widget._pubkey);
},
);
},
selector: (context, _provider) {
return _provider.getMetadata(widget.pubkey);
return _provider.getMetadata(widget._pubkey);
},
);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/new_notes_updated_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import '../main.dart';

class NewNotesUpdatedComponent extends StatelessWidget {
Function? onTap;
String text;
String _text;

List<Nip01Event> newEvents;

NewNotesUpdatedComponent({super.key, required this.newEvents, required this.text, this.onTap});
NewNotesUpdatedComponent({super.key, required this.newEvents, required String text, this.onTap}) : _text = text;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -63,7 +63,7 @@ class NewNotesUpdatedComponent extends StatelessWidget {
return UserPicComponent(pubkey: pubKey, width: width + 10);
}).toList(), //
),
Text(text,style: TextStyle(color: textColor),
Text(_text,style: TextStyle(color: textColor),
)
]))
);
Expand Down
48 changes: 24 additions & 24 deletions lib/ui/user/metadata_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ import 'metadata_top_component.dart';
import 'user_badges_component.dart';

class MetadataComponent extends StatefulWidget {
String pubKey;
final String _pubKey;

Metadata? metadata;
final Metadata? _metadata;

bool jumpable;
final bool _jumpable;

bool showBadges;
final bool _showBadges;

bool userPicturePreview;
final bool _userPicturePreview;

bool followsYou;
final bool _followsYou;

MetadataComponent({super.key,
required this.pubKey,
this.metadata,
this.jumpable = false,
this.showBadges = false,
this.userPicturePreview = false,
this.followsYou = false
});
const MetadataComponent({super.key,
required String pubKey,
Metadata? metadata,
bool jumpable = false,
bool showBadges = false,
bool userPicturePreview = false,
bool followsYou = false
}) : _pubKey = pubKey, _metadata = metadata, _jumpable = jumpable, _showBadges = showBadges, _userPicturePreview = userPicturePreview, _followsYou = followsYou;

@override
State<StatefulWidget> createState() {
Expand All @@ -41,22 +41,22 @@ class _MetadataComponent extends State<MetadataComponent> {
List<Widget> mainList = [];

mainList.add(MetadataTopComponent(
pubkey: widget.pubKey,
metadata: widget.metadata,
jumpable: widget.jumpable,
userPicturePreview: widget.userPicturePreview,
followsYou: widget.followsYou,
pubkey: widget._pubKey,
metadata: widget._metadata,
jumpable: widget._jumpable,
userPicturePreview: widget._userPicturePreview,
followsYou: widget._followsYou,
));

if (widget.showBadges) {
if (widget._showBadges) {
mainList.add(UserBadgesComponent(
pubkey: widget.pubKey,
pubkey: widget._pubKey,
));
}
var themeData = Theme.of(context);

if (widget.metadata != null &&
StringUtil.isNotBlank(widget.metadata!.about)) {
if (widget._metadata != null &&
StringUtil.isNotBlank(widget._metadata!.about)) {
mainList.add(
Container(
width: double.maxFinite,
Expand All @@ -74,7 +74,7 @@ class _MetadataComponent extends State<MetadataComponent> {
mainAxisSize: MainAxisSize.min,
children: ContentDecoder.decode(
context,
widget.metadata!.about!,
widget._metadata!.about!,
null,
showLinkPreview: false,
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ packages:
path: "../dart_ndk"
relative: true
source: path
version: "0.1.0-dev93"
version: "0.1.0-dev95"
nested:
dependency: transitive
description:
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ dependencies:
lottie: ^3.1.2
bolt11_decoder: ^1.0.2

ndk: ^0.1.0-dev94
# ndk: ^0.1.0-dev95
# ndk:
# git:
# url: https://github.com/relaystr/dart_ndk.git
# ref: master
# ndk:
# path: ../dart_ndk
ndk:
path: ../dart_ndk

dev_dependencies:
flutter_launcher_icons: ^0.13.1
Expand Down

0 comments on commit a542dcc

Please sign in to comment.