mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-26 00:58:50 +00:00
wip: new contact emoji selection and crypto selection
This commit is contained in:
parent
9df0569bb1
commit
9417d78c81
1 changed files with 501 additions and 357 deletions
|
@ -15,15 +15,17 @@ import 'package:stackwallet/utilities/clipboard_interface.dart';
|
|||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||
import 'package:stackwallet/widgets/emoji_select_sheet.dart';
|
||||
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
|
||||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
|
||||
class AddAddressBookEntryView extends ConsumerStatefulWidget {
|
||||
const AddAddressBookEntryView({
|
||||
Key? key,
|
||||
|
@ -108,14 +110,20 @@ class _AddAddressBookEntryViewState
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final isDesktop = Util.isDesktop;
|
||||
return ConditionalParent(
|
||||
condition: !isDesktop,
|
||||
builder: (child) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () async {
|
||||
if (FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(const Duration(milliseconds: 75));
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
@ -139,7 +147,9 @@ class _AddAddressBookEntryViewState
|
|||
key: const Key("addAddressBookEntryFavoriteButtonKey"),
|
||||
size: 36,
|
||||
shadows: const [],
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.star,
|
||||
color: _isFavorite
|
||||
|
@ -162,7 +172,63 @@ class _AddAddressBookEntryViewState
|
|||
),
|
||||
],
|
||||
),
|
||||
body: LayoutBuilder(
|
||||
body: child);
|
||||
},
|
||||
child: ConditionalParent(
|
||||
condition: isDesktop,
|
||||
builder: (child) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"New contact",
|
||||
style: STextStyles.desktopH3(context),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
AppBarIconButton(
|
||||
key:
|
||||
const Key("addAddressBookEntryFavoriteButtonKey"),
|
||||
size: 36,
|
||||
shadows: const [],
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.star,
|
||||
color: _isFavorite
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.favoriteStarActive
|
||||
: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.favoriteStarInactive,
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isFavorite = !_isFavorite;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const DesktopDialogCloseButton(),
|
||||
],
|
||||
),
|
||||
Expanded(child: child),
|
||||
],
|
||||
);
|
||||
},
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraint) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
|
@ -193,7 +259,10 @@ class _AddAddressBookEntryViewState
|
|||
});
|
||||
return;
|
||||
}
|
||||
showModalBottomSheet<dynamic>(
|
||||
|
||||
///TODO if desktop make dialog
|
||||
!isDesktop
|
||||
? showModalBottomSheet<dynamic>(
|
||||
backgroundColor: Colors.transparent,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
|
@ -208,6 +277,73 @@ class _AddAddressBookEntryViewState
|
|||
_selectedEmoji = value;
|
||||
});
|
||||
}
|
||||
})
|
||||
: showDialog<dynamic>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DesktopDialog(
|
||||
maxHeight: 700,
|
||||
maxWidth: 700,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.all(32),
|
||||
child: Text(
|
||||
"Select emoji",
|
||||
style:
|
||||
STextStyles.desktopH3(
|
||||
context),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: LayoutBuilder(
|
||||
builder:
|
||||
(context, constraints) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection:
|
||||
Axis.vertical,
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(
|
||||
minHeight: constraints
|
||||
.maxHeight,
|
||||
minWidth: constraints
|
||||
.maxWidth,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
children: const [
|
||||
Padding(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
horizontal:
|
||||
32),
|
||||
// child:
|
||||
// EmojiSelectSheet(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).then((value) {
|
||||
if (value is Emoji) {
|
||||
setState(() {
|
||||
_selectedEmoji = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
child: SizedBox(
|
||||
|
@ -233,8 +369,8 @@ class _AddAddressBookEntryViewState
|
|||
)
|
||||
: Text(
|
||||
_selectedEmoji!.char,
|
||||
style:
|
||||
STextStyles.pageTitleH1(context),
|
||||
style: STextStyles.pageTitleH1(
|
||||
context),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -316,7 +452,8 @@ class _AddAddressBookEntryViewState
|
|||
),
|
||||
onChanged: (newValue) {
|
||||
ref
|
||||
.read(contactNameIsNotEmptyStateProvider.state)
|
||||
.read(
|
||||
contactNameIsNotEmptyStateProvider.state)
|
||||
.state = newValue.isNotEmpty;
|
||||
},
|
||||
),
|
||||
|
@ -430,17 +567,20 @@ class _AddAddressBookEntryViewState
|
|||
style: shouldEnableSave
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonColor(context)
|
||||
.getPrimaryEnabledButtonColor(
|
||||
context)
|
||||
: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getPrimaryDisabledButtonColor(
|
||||
context),
|
||||
onPressed: shouldEnableSave
|
||||
? () async {
|
||||
if (FocusScope.of(context).hasFocus) {
|
||||
if (FocusScope.of(context)
|
||||
.hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75),
|
||||
const Duration(
|
||||
milliseconds: 75),
|
||||
);
|
||||
}
|
||||
List<ContactAddressEntry> entries =
|
||||
|
@ -449,7 +589,8 @@ class _AddAddressBookEntryViewState
|
|||
i < forms.length;
|
||||
i++) {
|
||||
entries.add(ref
|
||||
.read(addressEntryDataProvider(
|
||||
.read(
|
||||
addressEntryDataProvider(
|
||||
forms[i].id))
|
||||
.buildAddressEntry());
|
||||
}
|
||||
|
@ -461,7 +602,8 @@ class _AddAddressBookEntryViewState
|
|||
);
|
||||
|
||||
if (await ref
|
||||
.read(addressBookServiceProvider)
|
||||
.read(
|
||||
addressBookServiceProvider)
|
||||
.addContact(contact)) {
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
@ -474,7 +616,8 @@ class _AddAddressBookEntryViewState
|
|||
: null,
|
||||
child: Text(
|
||||
"Save",
|
||||
style: STextStyles.button(context).copyWith(
|
||||
style:
|
||||
STextStyles.button(context).copyWith(
|
||||
color: shouldEnableSave
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
@ -498,6 +641,7 @@ class _AddAddressBookEntryViewState
|
|||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue