Compare commits
1 commit
main
...
windows-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad8d4f36d9 |
6 changed files with 52 additions and 137 deletions
34
README.md
34
README.md
|
|
@ -156,9 +156,39 @@ Or, try the Nix package: `nix run git+https://git.federated.nexus/Henry-Hiles/ne
|
||||||
- With Nix: Either use direnv and `direnv allow`, or `nix flake develop`
|
- With Nix: Either use direnv and `direnv allow`, or `nix flake develop`
|
||||||
- Without Nix: Install Flutter, Go, Git, Libclang, and Glibc. Do not use any Snap packages, they cause various compilation issues.
|
- Without Nix: Install Flutter, Go, Git, Libclang, and Glibc. Do not use any Snap packages, they cause various compilation issues.
|
||||||
|
|
||||||
#### Windows / MacOS
|
#### Windows
|
||||||
|
|
||||||
I don't really know. You will need Flutter, Git, Go, and Visual Studio tools, and otherwise I guess just keep installing stuff until there aren't any errors. I will look into this sometimeTM.
|
You will need:
|
||||||
|
|
||||||
|
- Flutter
|
||||||
|
- Android SDK + NDK
|
||||||
|
- Git
|
||||||
|
- Go
|
||||||
|
- Visual Studio 2022 (Desktop development with C++)
|
||||||
|
- [MSYS2/MinGW-w64 GCC](https://www.msys2.org/) (for CGO)
|
||||||
|
- [LLVM/Clang + libclang](https://clang.llvm.org/get_started.html) (for `ffigen`)
|
||||||
|
|
||||||
|
On Windows, make sure these are available in your shell `PATH`:
|
||||||
|
|
||||||
|
- `C:\msys64\ucrt64\bin` (or your MinGW bin path containing `x86_64-w64-mingw32-gcc.exe`)
|
||||||
|
- `C:\Program Files\LLVM\bin` (contains `clang.exe` and `libclang.dll`)
|
||||||
|
|
||||||
|
Also make sure Go build cache env vars are present (PowerShell):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:LOCALAPPDATA = "C:\Users\<you>\AppData\Local"
|
||||||
|
$env:GOCACHE = "$env:LOCALAPPDATA\go-build"
|
||||||
|
```
|
||||||
|
|
||||||
|
For `dart scripts/generate.dart`, you may also need:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:CPATH = "C:\msys64\ucrt64\include"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### MacOS
|
||||||
|
|
||||||
|
Similar prerequisites apply (Flutter, Git, Go, C toolchain, LLVM/libclang), but exact setup has not been fully documented yet.
|
||||||
|
|
||||||
### Clone repo
|
### Clone repo
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
import "dart:convert";
|
|
||||||
import "package:emoji_text_field/models/emoji_category.dart";
|
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|
||||||
import "package:flutter/material.dart";
|
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
|
||||||
import "package:http/http.dart";
|
|
||||||
import "package:nexus/models/emoji.dart";
|
|
||||||
|
|
||||||
typedef EmojiTuple = (IMap<String, EmojiCategory>, IMap<String, List<String>>);
|
|
||||||
|
|
||||||
class EmojiController extends AsyncNotifier<EmojiTuple> {
|
|
||||||
@override
|
|
||||||
Future<EmojiTuple> build() async {
|
|
||||||
final response = await get(
|
|
||||||
Uri.https(
|
|
||||||
"github.com",
|
|
||||||
"github/gemoji/raw/refs/heads/master/db/emoji.json",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
|
||||||
throw Exception("Failed to load emoji data");
|
|
||||||
}
|
|
||||||
|
|
||||||
final data = json.decode(response.body);
|
|
||||||
|
|
||||||
final entries = (data as List)
|
|
||||||
.cast<Map<String, dynamic>>()
|
|
||||||
.map(Emoji.fromJson)
|
|
||||||
.toIList();
|
|
||||||
|
|
||||||
final categoryMap = entries.fold<IMap<String, IList<String>>>(
|
|
||||||
const IMap.empty(),
|
|
||||||
(acc, entry) => acc.update(
|
|
||||||
entry.category,
|
|
||||||
(list) => list.add(entry.emoji),
|
|
||||||
ifAbsent: () => IList([entry.emoji]),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final keywordMap = entries.fold<IMap<String, IList<String>>>(
|
|
||||||
const IMap.empty(),
|
|
||||||
(acc, entry) => acc.add(
|
|
||||||
entry.emoji,
|
|
||||||
IList<String>([...entry.tags, ...entry.aliases, entry.description]),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final customCategories = IMap.fromEntries(
|
|
||||||
categoryMap.entries.map(
|
|
||||||
(entry) => MapEntry(
|
|
||||||
entry.key,
|
|
||||||
EmojiCategory(
|
|
||||||
name: entry.key,
|
|
||||||
icon: switch (entry.key) {
|
|
||||||
"Smileys & Emotion" => Icons.emoji_emotions,
|
|
||||||
"People & Body" => Icons.emoji_people,
|
|
||||||
"Animals & Nature" => Icons.emoji_nature,
|
|
||||||
"Food & Drink" => Icons.emoji_food_beverage,
|
|
||||||
"Travel & Places" => Icons.travel_explore,
|
|
||||||
"Activities" => Icons.sports_soccer,
|
|
||||||
"Objects" => Icons.emoji_objects,
|
|
||||||
"Symbols" => Icons.emoji_symbols,
|
|
||||||
"Flags" => Icons.emoji_flags,
|
|
||||||
_ => Icons.category,
|
|
||||||
},
|
|
||||||
emojis: entry.value.toList(growable: false),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final customKeywords = IMap(
|
|
||||||
Map.fromEntries(
|
|
||||||
keywordMap.entries.map(
|
|
||||||
(e) => MapEntry(e.key, e.value.toList(growable: false)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return (customCategories, customKeywords);
|
|
||||||
}
|
|
||||||
|
|
||||||
static final provider =
|
|
||||||
AsyncNotifierProvider.autoDispose<EmojiController, EmojiTuple>(
|
|
||||||
EmojiController.new,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|
||||||
import "package:freezed_annotation/freezed_annotation.dart";
|
|
||||||
part "emoji.freezed.dart";
|
|
||||||
part "emoji.g.dart";
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
abstract class Emoji with _$Emoji {
|
|
||||||
const factory Emoji({
|
|
||||||
required String emoji,
|
|
||||||
required String category,
|
|
||||||
required IList<String> aliases,
|
|
||||||
required String description,
|
|
||||||
required IList<String> tags,
|
|
||||||
}) = _Emoji;
|
|
||||||
|
|
||||||
factory Emoji.fromJson(Map<String, Object?> json) => _$EmojiFromJson(json);
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import "package:emoji_text_field/emoji_text_field.dart";
|
import "package:emoji_text_field/emoji_text_field.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
import "package:flutter_hooks/flutter_hooks.dart";
|
||||||
import "package:nexus/controllers/emoji_controller.dart";
|
|
||||||
|
|
||||||
class EmojiPickerButton extends HookConsumerWidget {
|
class EmojiPickerButton extends HookWidget {
|
||||||
final TextEditingController? controller;
|
final TextEditingController? controller;
|
||||||
final void Function(String emoji)? onSelection;
|
final void Function(String emoji)? onSelection;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
|
|
@ -17,34 +16,25 @@ class EmojiPickerButton extends HookConsumerWidget {
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(_, WidgetRef ref) => IconButton(
|
Widget build(_) => IconButton(
|
||||||
onPressed: () async {
|
onPressed: () {
|
||||||
onPressed?.call();
|
onPressed?.call();
|
||||||
final controller = this.controller ?? TextEditingController();
|
final controller = this.controller ?? TextEditingController();
|
||||||
|
showModalBottomSheet(
|
||||||
final emojis = await ref.watch(EmojiController.provider.future);
|
context: context,
|
||||||
if (context.mounted) {
|
builder: (context) => EmojiKeyboardView(
|
||||||
showModalBottomSheet(
|
config: EmojiViewConfig(
|
||||||
context: context,
|
showRecentTab: false,
|
||||||
builder: (context) => EmojiKeyboardView(
|
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
config: EmojiViewConfig(
|
height: 600,
|
||||||
showRecentTab: false,
|
|
||||||
customCategories: emojis.$1.unlock,
|
|
||||||
customKeywords: emojis.$2.unlock,
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
|
||||||
height: 600,
|
|
||||||
),
|
|
||||||
textController: controller
|
|
||||||
..addListener(() {
|
|
||||||
// Without this, there will sometimes be a debugLocked is not true error sometimes
|
|
||||||
Future.delayed(Duration.zero, () {
|
|
||||||
if (context.mounted) Navigator.of(context).pop();
|
|
||||||
});
|
|
||||||
onSelection?.call(controller.text);
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
);
|
textController: controller
|
||||||
}
|
..addListener(() async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
onSelection?.call(controller.text);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.emoji_emotions),
|
icon: Icon(Icons.emoji_emotions),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ flutter.buildFlutterApplication {
|
||||||
dynamic_system_colors = "sha256-es6rjMK1drkqZBKYUP77yw/q5+0uLwWOEDOXRawy3Dc=";
|
dynamic_system_colors = "sha256-es6rjMK1drkqZBKYUP77yw/q5+0uLwWOEDOXRawy3Dc=";
|
||||||
flutter_chat_ui = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
flutter_chat_ui = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
||||||
flutter_link_previewer = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
flutter_link_previewer = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
||||||
emoji_text_field = "sha256-3TOys09EP2GRo6pUBGPXaqBlE39O2Cmwt42Hs1cTDKo=";
|
emoji_text_field = "sha256-F0QbIHP3wpKoL6QbJ20Oun0SsOdwnXe84IqsK2ad85w=";
|
||||||
};
|
};
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "5f7baaf8a6f059ec3ab8ff0f5d02339b00bf6997"
|
resolved-ref: "0e90703a6e876939be70bd1816c49cf14474de61"
|
||||||
url: "https://github.com/Henry-Hiles/emoji_text_field"
|
url: "https://github.com/Henry-Hiles/emoji_text_field"
|
||||||
source: git
|
source: git
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue