Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-6964: add primary name and logo on welcome back page #1944

Merged
6 changes: 3 additions & 3 deletions lib/arns/domain/arns_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class ARNSRepository {
Future<List<ArnsRecord>> getActiveARNSRecordsForFile(String fileId);
Future<void> waitForARNSRecordsToUpdate();
Future<PrimaryNameDetails> getPrimaryName(String address,
{bool update = false});
{bool update = false, bool getLogo = true});

factory ARNSRepository({
required ArioSDK sdk,
Expand Down Expand Up @@ -377,14 +377,14 @@ class _ARNSRepository implements ARNSRepository {

@override
Future<PrimaryNameDetails> getPrimaryName(String address,
{bool update = false}) async {
{bool update = false, bool getLogo = true}) async {
logger.d('Getting primary name for address: $address');

if (!update && _cachedPrimaryName != null) {
return _cachedPrimaryName!;
}

final primaryName = await _sdk.getPrimaryNameDetails(address);
final primaryName = await _sdk.getPrimaryNameDetails(address, getLogo);

logger.d('Primary name: $primaryName');

Expand Down
63 changes: 42 additions & 21 deletions lib/authentication/components/login_modal.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:ardrive/authentication/components/breakpoint_layout_builder.dart';
import 'package:ardrive/gar/presentation/widgets/gar_modal.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/material.dart';

Expand All @@ -11,13 +12,15 @@ class ArDriveLoginModal extends StatelessWidget {
required this.content,
this.width,
this.hasCloseButton = true,
this.hasSettingsButton = false,
this.onClose,
this.padding,
});

final Widget content;
final double? width;
final bool hasCloseButton;
final bool hasSettingsButton;
final Function()? onClose;
final EdgeInsets? padding;

Expand All @@ -34,8 +37,8 @@ class ArDriveLoginModal extends StatelessWidget {
}

final contentPadding = (deviceWidth < TABLET)
? EdgeInsets.fromLTRB(22, hasCloseButton ? 0 : 44, 22, 32)
: EdgeInsets.fromLTRB(56, hasCloseButton ? 0 : 44, 56, 64);
? EdgeInsets.fromLTRB(22, hasCloseButton ? 0 : 24, 22, 32)
: EdgeInsets.fromLTRB(56, hasCloseButton ? 0 : 24, 56, 64);

return ConstrainedBox(
constraints: BoxConstraints(
Expand All @@ -57,27 +60,45 @@ class ArDriveLoginModal extends StatelessWidget {
child: Container(
color: colorTokens.containerRed,
)),
Row(children: [
const Spacer(),
if (hasCloseButton)
Padding(
padding: const EdgeInsets.all(22.0),
child: hasCloseButton
? ArDriveClickArea(
child: GestureDetector(
onTap: onClose ?? () => Navigator.pop(context),
child: const Align(
alignment: Alignment.centerRight,
child: ArDriveIcon(
icon: ArDriveIconsData.x,
size: 20,
Row(
children: [
const Spacer(),
if (hasCloseButton)
Padding(
padding: const EdgeInsets.all(22.0),
child: hasCloseButton
? ArDriveClickArea(
child: GestureDetector(
onTap: onClose ?? () => Navigator.pop(context),
child: const Align(
alignment: Alignment.centerRight,
child: ArDriveIcon(
icon: ArDriveIconsData.x,
size: 20,
),
),
),
),
)
: Container(),
)
]),
)
: Container(),
),
if (!hasCloseButton && hasSettingsButton)
Padding(
padding: const EdgeInsets.only(top: 22.0, right: 22.0),
child: GestureDetector(
onTap: () {
showGatewaySwitcherModal(context);
},
child: ArDriveClickArea(
tooltip: 'Advanced Settings',
child: Icon(
Icons.settings,
color: colorTokens.iconLow,
),
),
),
),
],
),
Padding(
padding: padding ?? contentPadding,
child: content,
Expand Down
Loading
Loading