desktop emoji select

This commit is contained in:
julian 2022-11-17 12:56:10 -06:00
parent 682966dab8
commit 11735cdaf7
2 changed files with 151 additions and 169 deletions

View file

@ -191,33 +191,33 @@ class _AddAddressBookEntryViewState
style: STextStyles.desktopH3(context), style: STextStyles.desktopH3(context),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox(width: 10), // const SizedBox(width: 10),
AppBarIconButton( // AppBarIconButton(
key: // key:
const Key("addAddressBookEntryFavoriteButtonKey"), // const Key("addAddressBookEntryFavoriteButtonKey"),
size: 36, // size: 36,
shadows: const [], // shadows: const [],
color: Theme.of(context) // color: Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.background, // .background,
icon: SvgPicture.asset( // icon: SvgPicture.asset(
Assets.svg.star, // Assets.svg.star,
color: _isFavorite // color: _isFavorite
? Theme.of(context) // ? Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.favoriteStarActive // .favoriteStarActive
: Theme.of(context) // : Theme.of(context)
.extension<StackColors>()! // .extension<StackColors>()!
.favoriteStarInactive, // .favoriteStarInactive,
width: 20, // width: 20,
height: 20, // height: 20,
), // ),
onPressed: () { // onPressed: () {
setState(() { // setState(() {
_isFavorite = !_isFavorite; // _isFavorite = !_isFavorite;
}); // });
}, // },
), // ),
], ],
), ),
), ),
@ -228,7 +228,8 @@ class _AddAddressBookEntryViewState
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.symmetric(horizontal: 10),
child: child, child: child,
)), ),
),
], ],
); );
}, },
@ -292,66 +293,17 @@ class _AddAddressBookEntryViewState
: showDialog<dynamic>( : showDialog<dynamic>(
context: context, context: context,
builder: (context) { builder: (context) {
return DesktopDialog( return const DesktopDialog(
maxHeight: 700, maxHeight: 700,
maxWidth: 700, maxWidth: 600,
child: Column( child: Padding(
children: [ padding: EdgeInsets.only(
Row( left: 32,
children: [ right: 20,
Padding( top: 32,
padding: bottom: 32,
const EdgeInsets
.all(32),
child: Text(
"Select emoji",
style: STextStyles
.desktopH3(
context),
textAlign:
TextAlign
.center,
), ),
), child: EmojiSelectSheet(),
],
),
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) { }).then((value) {

View file

@ -4,6 +4,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.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/desktop/secondary_button.dart';
class EmojiSelectSheet extends ConsumerWidget { class EmojiSelectSheet extends ConsumerWidget {
const EmojiSelectSheet({ const EmojiSelectSheet({
@ -16,7 +19,9 @@ class EmojiSelectSheet extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final size = MediaQuery.of(context).size; final isDesktop = Util.isDesktop;
final size = isDesktop ? const Size(600, 700) : MediaQuery.of(context).size;
final double maxHeight = size.height * 0.60; final double maxHeight = size.height * 0.60;
final double availableWidth = size.width - (2 * horizontalPadding); final double availableWidth = size.width - (2 * horizontalPadding);
final int emojisPerRow = final int emojisPerRow =
@ -24,7 +29,9 @@ class EmojiSelectSheet extends ConsumerWidget {
final itemCount = Emoji.all().length; final itemCount = Emoji.all().length;
return Container( return ConditionalParent(
condition: !isDesktop,
builder: (child) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).extension<StackColors>()!.popupBG, color: Theme.of(context).extension<StackColors>()!.popupBG,
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
@ -40,10 +47,15 @@ class EmojiSelectSheet extends ConsumerWidget {
top: 10, top: 10,
bottom: 0, bottom: 0,
), ),
child: child,
),
),
),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
if (!isDesktop)
Center( Center(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -58,16 +70,19 @@ class EmojiSelectSheet extends ConsumerWidget {
height: 4, height: 4,
), ),
), ),
if (!isDesktop)
const SizedBox( const SizedBox(
height: 36, height: 36,
), ),
Text( Text(
"Select emoji", "Select emoji",
style: STextStyles.pageTitleH2(context), style: isDesktop
? STextStyles.desktopH3(context)
: STextStyles.pageTitleH2(context),
textAlign: TextAlign.left, textAlign: TextAlign.left,
), ),
const SizedBox( SizedBox(
height: 16, height: isDesktop ? 28 : 16,
), ),
Flexible( Flexible(
child: Row( child: Row(
@ -92,7 +107,12 @@ class EmojiSelectSheet extends ConsumerWidget {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(emoji.char), child: Text(
emoji.char,
style: isDesktop
? STextStyles.desktopTextSmall(context)
: null,
),
), ),
), ),
); );
@ -102,12 +122,22 @@ class EmojiSelectSheet extends ConsumerWidget {
], ],
), ),
), ),
const SizedBox( SizedBox(
height: 24, height: isDesktop ? 20 : 24,
),
if (isDesktop)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SecondaryButton(
label: "Cancel",
width: 248,
buttonHeight: ButtonHeight.l,
onPressed: Navigator.of(context).pop,
), ),
], ],
), ),
), ],
), ),
); );
} }