Skip to content

Commit

Permalink
chore: prevent app update dialog on dapp store
Browse files Browse the repository at this point in the history
change mint box ui
  • Loading branch information
d-reader-luka committed Apr 22, 2024
1 parent 988564d commit 778b846
Show file tree
Hide file tree
Showing 17 changed files with 335 additions and 244 deletions.
5 changes: 5 additions & 0 deletions assets/icons/lock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ class _ComicIssueDetailsState extends ConsumerState<ComicIssueDetails>
child: Stack(
children: [
CachedImageBgPlaceholder(
height: 431,
height: MediaQuery.sizeOf(context).height > 780
? 431
: 460,
imageUrl: issue.cover,
overrideBorderRadius: BorderRadius.circular(0),
foregroundDecoration: BoxDecoration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class IssueAbout extends ConsumerWidget {
height: 16,
),
...snapshot.data?.groups.map((candyMachineGroup) {
return ExpandableContainer(
return MintInfoContainer(
candyMachineGroup: candyMachineGroup,
totalSupply: snapshot.data?.supply ?? 0,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:d_reader_flutter/shared/theme/app_colors.dart';
import 'package:d_reader_flutter/shared/utils/formatter.dart';
import 'package:d_reader_flutter/shared/widgets/unsorted/solana_price.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

String mintNumbersText({required int itemsMinted, required int totalSupply}) {
Expand All @@ -16,10 +17,10 @@ String myMintNumbersText({required int itemsMinted, int? supply}) {
return 'You minted: $itemsMinted/${supply ?? '∞'}';
}

class ExpandableContainer extends ConsumerWidget {
class MintInfoContainer extends ConsumerWidget {
final CandyMachineGroupModel candyMachineGroup;
final int totalSupply;
const ExpandableContainer({
const MintInfoContainer({
super.key,
required this.candyMachineGroup,
required this.totalSupply,
Expand All @@ -36,118 +37,168 @@ class ExpandableContainer extends ConsumerWidget {
ref.read(expandedCandyMachineGroup.notifier).update((state) =>
state != candyMachineGroup.label ? candyMachineGroup.label : '');
},
child: AnimatedContainer(
height: ref.watch(expandedCandyMachineGroup) == candyMachineGroup.label
? 108
: 46,
duration: const Duration(milliseconds: 150),
margin: const EdgeInsets.only(bottom: 8),
child: _DecoratedContainer(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
candyMachineGroup.displayLabel,
style: textTheme.titleMedium,
),
const SizedBox(
width: 4,
),
child: _DecoratedContainer(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
'Mint',
style: textTheme.titleMedium,
),
const SizedBox(
width: 4,
),
candyMachineGroup.isActive
? const CircleAvatar(
backgroundColor: ColorPalette.dReaderYellow100,
radius: 6,
)
: const SizedBox(),
const SizedBox(
width: 4,
),
Text(
candyMachineGroup.isActive
? const CircleAvatar(
backgroundColor: ColorPalette.dReaderYellow100,
radius: 6,
)
: const SizedBox(),
const SizedBox(
width: 4,
),
Text(
candyMachineGroup.isActive
? 'Live'
? 'Live'
: isFutureMint
? 'Starts in ${Formatter.formatDateInRelative(candyMachineGroup.startDate)}'
: 'Ended',
style: textTheme.titleMedium?.copyWith(
color: candyMachineGroup.isActive
? ColorPalette.dReaderYellow100
: isFutureMint
? 'Starts in ${Formatter.formatDateInRelative(candyMachineGroup.startDate)}'
: 'Ended',
style: textTheme.titleMedium?.copyWith(
color: candyMachineGroup.isActive
? ColorPalette.dReaderYellow100
: isFutureMint
? ColorPalette.dReaderYellow300
: ColorPalette.greyscale200,
),
? ColorPalette.dReaderYellow300
: ColorPalette.greyscale200,
),
],
),
SolanaPrice(
price: candyMachineGroup.mintPrice > 0
? Formatter.formatPriceWithSignificant(
candyMachineGroup.mintPrice.round(),
)
: null,
)
],
),
Column(
children: [
const SizedBox(
height: 16,
),
LinearProgressIndicator(
backgroundColor: ColorPalette.greyscale400,
minHeight: 8,
valueColor: AlwaysStoppedAnimation<Color>(
candyMachineGroup.isActive
? ColorPalette.dReaderYellow100
: ColorPalette.greyscale200,
),
value: candyMachineGroup.itemsMinted /
candyMachineGroup.supply,
borderRadius: BorderRadius.circular(8),
],
),
SolanaPrice(
price: candyMachineGroup.mintPrice > 0
? Formatter.formatPriceWithSignificant(
candyMachineGroup.mintPrice.round(),
)
: null,
)
],
),
const SizedBox(
height: 24,
),
if (candyMachineGroup.isActive) ...[
LinearProgressIndicator(
backgroundColor: ColorPalette.greyscale400,
minHeight: 8,
valueColor: AlwaysStoppedAnimation<Color>(
candyMachineGroup.isActive
? ColorPalette.dReaderYellow100
: ColorPalette.greyscale200,
),
value: candyMachineGroup.itemsMinted / candyMachineGroup.supply,
borderRadius: BorderRadius.circular(8),
),
const SizedBox(
height: 24,
),
],
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
myMintNumbersText(
itemsMinted: candyMachineGroup.user?.itemsMinted ??
candyMachineGroup.wallet?.itemsMinted ??
0,
supply: candyMachineGroup.user?.supply ??
candyMachineGroup.wallet?.supply,
),
const SizedBox(
height: 8,
style: textTheme.bodySmall?.copyWith(
color: ColorPalette.greyscale100,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
myMintNumbersText(
itemsMinted: candyMachineGroup.user?.itemsMinted ??
candyMachineGroup.wallet?.itemsMinted ??
0,
supply: candyMachineGroup.user?.supply ??
candyMachineGroup.wallet?.supply,
),
style: textTheme.bodySmall?.copyWith(
color: ColorPalette.greyscale100,
),
Text(
candyMachineGroup.label == publicGroupLabel
? mintNumbersText(
itemsMinted: candyMachineState?.itemsMinted ??
candyMachineGroup.itemsMinted,
totalSupply: candyMachineState?.supply ??
candyMachineGroup.supply)
: mintNumbersText(
itemsMinted: candyMachineGroup.itemsMinted,
totalSupply: candyMachineGroup.supply,
),
),
Text(
candyMachineGroup.label == publicGroupLabel
? mintNumbersText(
itemsMinted: candyMachineState?.itemsMinted ??
candyMachineGroup.itemsMinted,
totalSupply: candyMachineState?.supply ??
candyMachineGroup.supply)
: mintNumbersText(
itemsMinted: candyMachineGroup.itemsMinted,
totalSupply: candyMachineGroup.supply,
),
style: textTheme.bodySmall?.copyWith(
color: ColorPalette.greyscale100,
),
),
],
style: textTheme.bodySmall?.copyWith(
color: ColorPalette.greyscale100,
),
],
),
],
),
),
],
),
const SizedBox(
height: 16,
),
const _ComicVaultContainer(),
],
),
),
);
}
}

class _ComicVaultContainer extends ConsumerWidget {
const _ComicVaultContainer();

@override
Widget build(BuildContext context, WidgetRef ref) {
final textTheme = Theme.of(context).textTheme;
return Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: ColorPalette.greyscale400,
),
child: GestureDetector(
onTap: () {
ref
.read(expandedCandyMachineGroup.notifier)
.update((state) => state == 'ComicVault' ? '' : 'ComicVault');
},
child: Column(
children: [
Row(
children: [
SvgPicture.asset(
'assets/icons/lock.svg',
),
const SizedBox(
width: 8,
),
Text(
'Comic Vault',
style: textTheme.bodySmall?.copyWith(
color: ColorPalette.greyscale100,
),
),
],
),
// Column(
// children: [
// const SizedBox(
// height: 8,
// ),
// Text(
// 'Comic Vault stores portion of the supply of each issue to later use in giveaways & other activities where we reward loyal users',
// style: textTheme.bodySmall?.copyWith(
// color: ColorPalette.greyscale100,
// ),
// ),
// ],
// ),
],
),
),
);
Expand All @@ -165,7 +216,7 @@ class _DecoratedContainer extends StatelessWidget {
return SingleChildScrollView(
physics: const NeverScrollableScrollPhysics(),
child: Container(
padding: const EdgeInsets.all(12),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: ColorPalette.greyscale500,
borderRadius: BorderRadius.circular(8),
Expand Down
3 changes: 2 additions & 1 deletion lib/features/creator/presentation/widgets/follow_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:d_reader_flutter/features/creator/domain/providers/creator_provi
import 'package:d_reader_flutter/features/library/presentation/providers/creators/creators_providers.dart';
import 'package:d_reader_flutter/shared/presentations/providers/common/count_provider.dart';
import 'package:d_reader_flutter/shared/theme/app_colors.dart';
import 'package:d_reader_flutter/shared/utils/formatter.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

Expand Down Expand Up @@ -70,7 +71,7 @@ class FollowBox extends HookConsumerWidget {
color: ColorPalette.greyscale400,
),
child: Text(
'${followingHook.value.count}',
Formatter.formatCount(followingHook.value.count),
textAlign: TextAlign.center,
style: textTheme.titleMedium?.copyWith(
color: ColorPalette.greyscale100,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:d_reader_flutter/constants/constants.dart';
import 'package:d_reader_flutter/constants/routes.dart';
import 'package:d_reader_flutter/features/comic_issue/domain/models/owned_issue.dart';
import 'package:d_reader_flutter/features/library/presentation/providers/owned/owned_controller.dart';
Expand Down Expand Up @@ -41,9 +42,12 @@ class OwnedIssueCard extends ConsumerWidget {
children: [
Expanded(
flex: 3,
child: CachedImageBgPlaceholder(
imageUrl: issue.cover,
bgImageFit: BoxFit.fill,
child: AspectRatio(
aspectRatio: comicIssueAspectRatio,
child: CachedImageBgPlaceholder(
imageUrl: issue.cover,
bgImageFit: BoxFit.cover,
),
),
),
const SizedBox(
Expand Down
Loading

0 comments on commit 778b846

Please sign in to comment.