-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gerardo Guijarro
committed
Jul 7, 2023
1 parent
5c1f1a2
commit 368a287
Showing
8 changed files
with
258 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:hypha_wallet/design/hypha_card.dart'; | ||
import 'package:hypha_wallet/design/hypha_colors.dart'; | ||
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart'; | ||
import 'package:hypha_wallet/ui/send/interactor/send_bloc.dart'; | ||
import 'package:hypha_wallet/ui/shared/components/text_request_bottom_sheet.dart'; | ||
import 'package:hypha_wallet/ui/shared/ui_constants.dart'; | ||
|
||
class SendMemoField extends StatelessWidget { | ||
const SendMemoField({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return BlocBuilder<SendBloc, SendState>( | ||
buildWhen: (previous, current) => previous.memo != current.memo, | ||
builder: (context, state) { | ||
return GestureDetector( | ||
onTap: () { | ||
showModalBottomSheet( | ||
isScrollControlled: true, | ||
clipBehavior: Clip.hardEdge, | ||
context: context, | ||
builder: (modelContext) => FractionallySizedBox( | ||
heightFactor: UIConstants.bottomSheetHeightFraction, | ||
child: TextRequestBottomSheet( | ||
title: 'Enter Memo', | ||
initialText: state.memo ?? '', | ||
onPressed: (String? text) { | ||
context.read<SendBloc>().add(SendEvent.onMemoEntered(text)); | ||
Get.back(); | ||
}), | ||
), | ||
shape: const RoundedRectangleBorder( | ||
borderRadius: BorderRadius.vertical(top: Radius.circular(30)), | ||
), | ||
); | ||
}, | ||
child: HyphaCard( | ||
child: Padding( | ||
padding: const EdgeInsets.all(16), | ||
child: Row( | ||
children: [ | ||
Expanded( | ||
child: Text( | ||
state.memo ?? 'Memo (optional)', | ||
style: context.hyphaTextTheme.regular | ||
.copyWith(color: state.memo == null ? HyphaColors.midGrey : null), | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
), | ||
state.memo == null ? const SizedBox.shrink() : const Icon(Icons.edit) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:hypha_wallet/design/avatar_image/hypha_avatar_image.dart'; | ||
import 'package:hypha_wallet/design/background/hypha_half_background.dart'; | ||
import 'package:hypha_wallet/design/background/hypha_page_background.dart'; | ||
import 'package:hypha_wallet/design/buttons/button_type.dart'; | ||
import 'package:hypha_wallet/design/buttons/hypha_app_button.dart'; | ||
import 'package:hypha_wallet/design/hypha_card.dart'; | ||
import 'package:hypha_wallet/design/hypha_colors.dart'; | ||
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart'; | ||
import 'package:hypha_wallet/ui/send/components/send_to_user_row.dart'; | ||
import 'package:hypha_wallet/ui/send/interactor/send_bloc.dart'; | ||
|
||
class SendReviewBottomSheet extends StatelessWidget { | ||
const SendReviewBottomSheet({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return HyphaPageBackground( | ||
withGradient: true, | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Stack( | ||
children: [ | ||
const HyphaHalfBackground(showTopBar: true, height: 120), | ||
Padding( | ||
padding: const EdgeInsets.only(top: 60, left: 24, right: 24, bottom: 24), | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
BlocBuilder<SendBloc, SendState>( | ||
builder: (context, state) { | ||
return HyphaAvatarImage( | ||
imageRadius: 50, | ||
imageFromUrl: state.tokenData.image, | ||
name: state.tokenData.name, | ||
); | ||
}, | ||
), | ||
const SizedBox(height: 12), | ||
BlocBuilder<SendBloc, SendState>( | ||
builder: (context, state) { | ||
return Text( | ||
state.formattedAmount, | ||
style: context.hyphaTextTheme.popsExtraLargeAndLight, | ||
); | ||
}, | ||
), | ||
BlocBuilder<SendBloc, SendState>( | ||
builder: (context, state) { | ||
return Text( | ||
state.tokenData.name, | ||
style: context.hyphaTextTheme.ralMediumBody.copyWith(height: 0), | ||
); | ||
}, | ||
), | ||
const SizedBox(height: 24), | ||
const SendToUserRow(imageRadius: 30), | ||
const SizedBox(height: 16), | ||
BlocBuilder<SendBloc, SendState>( | ||
builder: (context, state) { | ||
return state.memo == null | ||
? const SizedBox.shrink() | ||
: HyphaCard( | ||
child: Padding( | ||
padding: const EdgeInsets.all(16), | ||
child: Row( | ||
children: [ | ||
Expanded( | ||
child: Text( | ||
state.memo ?? 'Memo (optional)', | ||
style: context.hyphaTextTheme.regular | ||
.copyWith(color: state.memo == null ? HyphaColors.midGrey : null), | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
); | ||
}, | ||
), | ||
const SizedBox(height: 16), | ||
HyphaCard( | ||
child: Padding( | ||
padding: const EdgeInsets.all(16), | ||
child: Row( | ||
children: [ | ||
Expanded( | ||
child: Text( | ||
'Always free and instant!', | ||
style: context.hyphaTextTheme.regular.copyWith(color: HyphaColors.midGrey), | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
const SizedBox(height: 100), | ||
HyphaAppButton( | ||
title: 'Edit', | ||
buttonType: ButtonType.secondary, | ||
onPressed: () {}, | ||
), | ||
const SizedBox(height: 16), | ||
HyphaAppButton( | ||
title: 'Send', | ||
onPressed: () {}, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:hypha_wallet/design/avatar_image/hypha_avatar_image.dart'; | ||
import 'package:hypha_wallet/design/hypha_card.dart'; | ||
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart'; | ||
import 'package:hypha_wallet/ui/send/interactor/send_bloc.dart'; | ||
|
||
class SendToUserRow extends StatelessWidget { | ||
final double imageRadius; | ||
|
||
const SendToUserRow({super.key, required this.imageRadius}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return BlocBuilder<SendBloc, SendState>( | ||
builder: (context, state) { | ||
return ListTile( | ||
contentPadding: EdgeInsets.zero, | ||
leading: HyphaAvatarImage( | ||
imageRadius: imageRadius, | ||
name: state.receiverUser.userName, | ||
imageFromUrl: state.receiverUser.userImage, | ||
), | ||
title: Text( | ||
state.receiverUser.userName ?? state.receiverUser.accountName, | ||
style: context.hyphaTextTheme.smallTitles, | ||
), | ||
subtitle: Text('@${state.receiverUser.accountName}', style: context.hyphaTextTheme.ralMediumBody), | ||
trailing: HyphaCard( | ||
borderRadius: BorderRadius.circular(10), | ||
child: const Padding( | ||
padding: EdgeInsets.all(12), | ||
child: Text('To'), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.