Skip to content

Commit

Permalink
Merge pull request #346 from DanXi-Dev/stickers-feature
Browse files Browse the repository at this point in the history
[Feature] Stickers feature
  • Loading branch information
w568w committed Apr 9, 2024
2 parents 3262b64 + 44030a6 commit 1d3ca44
Show file tree
Hide file tree
Showing 29 changed files with 153 additions and 45 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ windows/out
ios/fastlane/Matchfile

# FVM Version Cache
.fvm/
.fvm/
.fvmrc
Binary file added assets/graphics/stickers/danxi_angry.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_call.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_cate.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_dying.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_egg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_fright.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_heart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_hug.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_overwhelm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_roll.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_roped.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_sleep.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_swim.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_thrill.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_touchFish.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/graphics/stickers/danxi_twin.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
62 changes: 29 additions & 33 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ PODS:
- Flutter
- flutter_fgbg (0.0.1):
- Flutter
- flutter_inappwebview (0.0.1):
- flutter_inappwebview_ios (0.0.1):
- Flutter
- flutter_inappwebview/Core (= 0.0.1)
- flutter_inappwebview_ios/Core (= 0.0.1)
- OrderedSet (~> 5.0)
- flutter_inappwebview/Core (0.0.1):
- flutter_inappwebview_ios/Core (0.0.1):
- Flutter
- OrderedSet (~> 5.0)
- flutter_js (0.1.0):
Expand All @@ -60,11 +60,9 @@ PODS:
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- gallery_saver (0.0.1):
- gal (1.0.0):
- Flutter
- FlutterMacOS
- image_picker_ios (0.0.1):
- Flutter
- in_app_review (0.2.0):
Expand All @@ -75,7 +73,7 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.1.1):
- permission_handler_apple (9.3.0):
- Flutter
- platform_device_id (0.0.1):
- Flutter
Expand All @@ -95,7 +93,7 @@ PODS:
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- FlutterMacOS
- SwiftyGif (5.4.4)
- Toast (4.0.0)
- uni_links (0.0.1):
Expand All @@ -111,12 +109,12 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`)
- flutter_fgbg (from `.symlinks/plugins/flutter_fgbg/ios`)
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`)
- flutter_js (from `.symlinks/plugins/flutter_js/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- gallery_saver (from `.symlinks/plugins/gallery_saver/ios`)
- gal (from `.symlinks/plugins/gal/darwin`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- open_file (from `.symlinks/plugins/open_file/ios`)
Expand All @@ -128,15 +126,14 @@ DEPENDENCIES:
- screen_capture_event (from `.symlinks/plugins/screen_capture_event/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- FMDB
- OrderedSet
- SDWebImage
- SwiftyGif
Expand All @@ -157,8 +154,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_email_sender/ios"
flutter_fgbg:
:path: ".symlinks/plugins/flutter_fgbg/ios"
flutter_inappwebview:
:path: ".symlinks/plugins/flutter_inappwebview/ios"
flutter_inappwebview_ios:
:path: ".symlinks/plugins/flutter_inappwebview_ios/ios"
flutter_js:
:path: ".symlinks/plugins/flutter_js/ios"
flutter_keyboard_visibility:
Expand All @@ -167,8 +164,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
gallery_saver:
:path: ".symlinks/plugins/gallery_saver/ios"
gal:
:path: ".symlinks/plugins/gal/darwin"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
in_app_review:
Expand All @@ -192,7 +189,7 @@ EXTERNAL SOURCES:
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
:path: ".symlinks/plugins/sqflite/darwin"
uni_links:
:path: ".symlinks/plugins/uni_links/ios"
url_launcher_ios:
Expand All @@ -201,39 +198,38 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
device_identity: ad27231cb8754e5bc63ce2225e2e1d95d374ca88
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_email_sender: 02d7443217d8c41483223627972bfdc09f74276b
flutter_fgbg: 31c0d1140a131daea2d342121808f6aa0dcd879d
flutter_inappwebview: acd4fc0f012cefd09015000c241137d82f01ba62
flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0
flutter_js: 95929d4e146e8ceb1c8e1889d8c2065c5d840076
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
gallery_saver: 9fc173c9f4fcc48af53b2a9ebea1b643255be542
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
open_file: 2b95472e6ba492308fc6f297d9588286d40b22f2
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: 036b856153a2b1f61f21030ff725f3e6fece2b78
platform_device_id: 81b3e2993881f87d0c82ef151dc274df4869aef5
quick_actions_ios: 9e80dcfadfbc5d47d9cf8f47bcf428b11cf383d4
quick_actions_ios: d24571db7345d2e48d094db8d077a015a568002d
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
screen_capture_event: bcf965bb31968a51c08ad3698725c5ad8c597124
SDWebImage: 96e0c18ef14010b7485210e92fac888587ebb958
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586

PODFILE CHECKSUM: 38e9f50b4517e4be37f9d3ada406555aaf9f8b69
PODFILE CHECKSUM: ddb21f5fa784144c3d27c8f4c9eb30905418df66

COCOAPODS: 1.13.0
2 changes: 1 addition & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -530,5 +530,6 @@
"manually_add_course_message": "If there is a class that is not included in the class schedule, but you want to check it, add it manually yourself.",
"start_date_select": "Semester start date query",
"start_date_select_message": "You must select the start date of the semester to view your class schedule. Not selecting will result in a date error. \nTip: Start date is the Monday of the first week.",
"empty_classroom_warning": "Not connected to the campus intranet, so classroom usage information may not be accurate.\nPlease connect to the campus intranet for accurate information."
"empty_classroom_warning": "Not connected to the campus intranet, so classroom usage information may not be accurate.\nPlease connect to the campus intranet for accurate information.",
"sticker": "stickers"
}
3 changes: 2 additions & 1 deletion lib/l10n/intl_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -513,5 +513,6 @@
"copy_floor_id": "拷贝楼层号",
"copy_floor_id_success": "楼层号成功保存至剪贴板",
"copy_hole_id": "拷贝洞号",
"copy_hole_id_success": "洞号成功保存至剪贴板"
"copy_hole_id_success": "洞号成功保存至剪贴板",
"sticker": "表情"
}
3 changes: 2 additions & 1 deletion lib/l10n/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -522,5 +522,6 @@
"manually_add_course_message": "是否有课未收录在课表上,但你又想查看的呢?手动添加它吧。",
"start_date_select": "学期开始日期查询:",
"start_date_select_message": "必须先正确选择学期的开始日期,否则导致日期错误。\n提示:开始日期是第一周的周一。",
"empty_classroom_warning": "未连接到校园内网,教室使用情况可能不准确。\n请连接到校园内网以获取准确的信息。"
"empty_classroom_warning": "未连接到校园内网,教室使用情况可能不准确。\n请连接到校园内网以获取准确的信息。",
"sticker": "表情"
}
49 changes: 49 additions & 0 deletions lib/page/opentreehole/hole_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import 'package:dan_xi/util/noticing.dart';
import 'package:dan_xi/util/opentreehole/editor_object.dart';
import 'package:dan_xi/util/platform_universal.dart';
import 'package:dan_xi/util/public_extension_methods.dart';
import 'package:dan_xi/util/stickers.dart';
import 'package:dan_xi/widget/dialogs/care_dialog.dart';
import 'package:dan_xi/widget/libraries/error_page_widget.dart';
import 'package:dan_xi/widget/libraries/image_picker_proxy.dart';
Expand Down Expand Up @@ -325,6 +326,49 @@ class BBSEditorWidgetState extends State<BBSEditorWidget> {
final GlobalKey<OTTagSelectorState> _tagSelectorKey =
GlobalKey<OTTagSelectorState>();

Future _buildStickersSheet(BuildContext context) {
return showPlatformModalSheet(
context: context,
builder: (BuildContext context) {
final Widget body = Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Icons.emoji_emotions), title: Text(S.of(context).sticker)),
// const Divider(),
Wrap(
children: Stickers.values
.map((e) => Padding(
padding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 4),
child: InkWell(
onTap: () {
// insert sticker into the current cursor position
var cursorPosition =
widget.controller.selection.base.offset;
widget.controller.text =
"${widget.controller.text.substring(0, cursorPosition)}![](${e.name})${widget.controller.text.substring(cursorPosition)}";
// close the modal sheet
Navigator.of(context).pop();
},
child: Image.asset(
getStickerAssetPath(e.name)!,
width: 60,
height: 60,
),
),
))
.toList(),
),
]),
);
return PlatformX.isCupertino(context) ? Card(child: body) : body;
});
}

Widget _buildIntroButton(BuildContext context, IconData iconData,
String title, String description) =>
PlatformIconButton(
Expand Down Expand Up @@ -474,6 +518,10 @@ class BBSEditorWidgetState extends State<BBSEditorWidget> {
child: Text(S.of(context).community_convention),
onPressed: () => BrowserUtil.openUrl(
"https://www.fduhole.com/#/licence", context),
),
PlatformTextButton(
child: Text(S.of(context).sticker),
onPressed: () => _buildStickersSheet(context),
)
],
),
Expand All @@ -498,6 +546,7 @@ class BBSEditorWidgetState extends State<BBSEditorWidget> {
class TagSuggestionWidget extends StatefulWidget {
const TagSuggestionWidget(
{super.key, required this.content, required this.tagSelectorKey});

final String content;
final GlobalKey<OTTagSelectorState> tagSelectorKey;

Expand Down
45 changes: 45 additions & 0 deletions lib/util/stickers.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2021 DanXi-Dev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

enum Stickers {
danxi_angry,
danxi_call,
danxi_cate,
danxi_dying,
danxi_egg,
danxi_fright,
danxi_heart,
danxi_hug,
danxi_overwhelm,
danxi_roll,
danxi_roped,
danxi_sleep,
danxi_swim,
danxi_thrill,
danxi_touchFish,
danxi_twin;
}

String? getStickerAssetPath(String stickerName) {
try {
Stickers sticker = Stickers.values.firstWhere(
(e) => e.name.toString() == stickerName);
return "assets/graphics/stickers/${sticker.name}.jpg";
} catch (error) {
return null;
}
}
Loading

0 comments on commit 1d3ca44

Please sign in to comment.