Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/app/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"

#include <dynamic_color/dynamic_color_plugin.h>
#include <emoji_picker_flutter/emoji_picker_flutter_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
Expand All @@ -16,6 +17,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin");
emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
Expand Down
1 change: 1 addition & 0 deletions packages/app/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color
emoji_picker_flutter
file_selector_linux
screen_retriever
url_launcher_linux
Expand Down
8 changes: 8 additions & 0 deletions packages/app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ packages:
relative: true
source: path
version: "0.1.0"
emoji_picker_flutter:
dependency: transitive
description:
name: emoji_picker_flutter
sha256: "009c51efc763d5a6ba05a5628b8b2184c327cd117d66ea9c3e7edf2ff269c423"
url: "https://pub.dev"
source: hosted
version: "1.6.3"
fake_async:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions packages/neon_framework/lib/src/theme/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class NeonDialogTheme {
this.constraints = const BoxConstraints(
minWidth: 280,
maxWidth: 560,
maxHeight: 560 * 1.5,
),
this.padding = const EdgeInsets.all(24),
});
Expand Down
36 changes: 36 additions & 0 deletions packages/neon_framework/lib/src/widgets/dialog.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
Expand Down Expand Up @@ -523,3 +524,38 @@ class NeonUnifiedPushDialog extends StatelessWidget {
],
);
}

/// Shows an emoji picker.
///
/// When the user selects an emoji the dialog will pop and return the emoji as a `String`.
class NeonEmojiPickerDialog extends StatelessWidget {
/// Creates a new emoji picker dialog.
const NeonEmojiPickerDialog({
super.key,
});

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);

return NeonDialog(
content: SizedBox(
width: NeonDialogTheme.of(context).constraints.maxWidth,
child: EmojiPicker(
config: Config(
emojiSizeMax: 25,
columns: 10,
bgColor: Colors.transparent,
indicatorColor: theme.colorScheme.primary,
iconColorSelected: theme.colorScheme.primary,
skinToneDialogBgColor: theme.dialogBackgroundColor,
skinToneIndicatorColor: theme.colorScheme.primary,
),
onEmojiSelected: (category, emoji) {
Navigator.of(context).pop(emoji.emoji);
},
),
),
);
}
}
1 change: 1 addition & 0 deletions packages/neon_framework/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
crypto: ^3.0.0
cupertino_icons: ^1.0.0
dynamic_color: ^1.0.0
emoji_picker_flutter: ^1.6.3
file_picker: ^6.0.0
filesize: ^2.0.0
flutter:
Expand Down
37 changes: 37 additions & 0 deletions packages/neon_framework/test/dialog_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:neon_framework/l10n/localizations_en.dart';
import 'package:neon_framework/src/theme/theme.dart';
import 'package:neon_framework/src/widgets/dialog.dart';
import 'package:neon_framework/theme.dart';
import 'package:neon_framework/utils.dart';
import 'package:shared_preferences/shared_preferences.dart';

Widget wrapDialog(Widget dialog, [TargetPlatform platform = TargetPlatform.android]) {
final theme = AppTheme.test(platform: platform);
Expand Down Expand Up @@ -192,5 +194,40 @@ void main() {
await widgetTester.pumpWidget(wrapDialog(dialog, TargetPlatform.macOS));
expect(find.byType(NeonDialogAction), findsNothing);
});

testWidgets('NeonEmojiPickerDialog', (tester) async {
SharedPreferences.setMockInitialValues({});

await tester.pumpWidget(
MaterialApp(
localizationsDelegates: NeonLocalizations.localizationsDelegates,
supportedLocales: NeonLocalizations.supportedLocales,
theme: ThemeData(
extensions: const [
NeonTheme(
branding: Branding(
name: '',
logo: SizedBox.shrink(),
),
),
],
),
home: const SizedBox.shrink(),
),
);
final BuildContext context = tester.element(find.byType(SizedBox));

final future = showDialog<String>(
context: context,
builder: (context) => const NeonEmojiPickerDialog(),
);
await tester.pumpAndSettle();

await tester.tap(find.byIcon(Icons.tag_faces));
await tester.pumpAndSettle();

await tester.tap(find.text('😀'));
expect(await future, '😀');
});
});
}