android - 我们如何使用颤振在firebase中添加表情符号
问题描述
我正在寻找一种方法,用户可以将键盘的表情符号存储到 firebasefirestore 中是否有你们向我推荐的库或功能。
解决方案
表情符号在技术上只是带有特定代码的 unicode 字符,您可以在此处找到完整的代码列表。您可以将这些 unicode 值保存在 FirebaseFirestore 上,您不需要任何库,flutter 开箱即用!
您可以稍后获取这些 unicode 并使用文本类在 Flutter 上渲染它们,方法是传递\u
和大括号中的 4 个字母十六进制,{}
如下所示:
Text("This is how you render unicode: \u{1f60e} ")
下面是一个示例实现:
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const Center(
child: Text("This is how you render unicode: \u{1f60e} "), // This is the main part.
),
),
);
}
}
推荐阅读
- python-3.x - 如何在Python中输入()在一段时间内为空或无时执行
- content-management-system - 用于 Angular 项目的 BuilderIO 视觉 CMS 的替代品
- heroku - 我在heroku中的哪里输入--fix选项?
- wso2 - 在 WSO2 APIM 3.2.0 中添加全局中介扩展
- python - 在 discord.py 中将“client.load_extension('name here')”彼此分开
- r - 使用现有数据中的值创建新数据框
- php - 尝试 SQL 注入绕过登录
- python - CSV 未使用分隔符打开;但使用 genfromtxt 以分隔符开头
- python - Python中可能的简单异步/等待示例
- xcode - 应用程序运行时 Xcode 调试器不开始会话