From 77e4a30bc578761d038a9ec2a2e93f0bb953b3a3 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 30 Apr 2025 12:03:47 +0800 Subject: [PATCH] opt: emote panel Signed-off-by: bggRGjQaUbCoE --- lib/pages/emote/view.dart | 84 +++++++++---------- lib/pages/live_emote/view.dart | 75 ++++++++--------- .../video/detail/reply_new/reply_page.dart | 50 +++++------ 3 files changed, 101 insertions(+), 108 deletions(-) diff --git a/lib/pages/emote/view.dart b/lib/pages/emote/view.dart index 6f47df72..f6115bf8 100644 --- a/lib/pages/emote/view.dart +++ b/lib/pages/emote/view.dart @@ -42,50 +42,48 @@ class _EmotePanelState extends State (e) { int size = e.emote!.first.meta!.size!; int type = e.type!; - return Padding( - padding: const EdgeInsets.fromLTRB(12, 6, 12, 0), - child: GridView.builder( - gridDelegate: - SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: - type == 4 ? 100 : (size == 1 ? 40 : 60), - crossAxisSpacing: 8, - mainAxisSpacing: 8, - mainAxisExtent: size == 1 ? 40 : 60, - ), - itemCount: e.emote!.length, - itemBuilder: (context, index) { - return Material( - color: Colors.transparent, - child: InkWell( - borderRadius: BorderRadius.circular(8), - onTap: () { - widget.onChoose(e.emote![index]); - }, - child: Padding( - padding: const EdgeInsets.all(6), - child: type == 4 - ? Center( - child: Text( - e.emote![index].text!, - overflow: TextOverflow.clip, - maxLines: 1, - ), - ) - : NetworkImgLayer( - src: e.emote![index].url!, - width: size * 38, - height: size * 38, - semanticsLabel: - e.emote![index].text!, - type: 'emote', - boxFit: BoxFit.contain, - ), - ), - ), - ); - }, + return GridView.builder( + padding: const EdgeInsets.only( + left: 12, right: 12, bottom: 12), + gridDelegate: + SliverGridDelegateWithMaxCrossAxisExtent( + maxCrossAxisExtent: + type == 4 ? 100 : (size == 1 ? 40 : 60), + crossAxisSpacing: 8, + mainAxisSpacing: 8, + mainAxisExtent: size == 1 ? 40 : 60, ), + itemCount: e.emote!.length, + itemBuilder: (context, index) { + return Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(8), + onTap: () { + widget.onChoose(e.emote![index]); + }, + child: Padding( + padding: const EdgeInsets.all(6), + child: type == 4 + ? Center( + child: Text( + e.emote![index].text!, + overflow: TextOverflow.clip, + maxLines: 1, + ), + ) + : NetworkImgLayer( + src: e.emote![index].url!, + width: size * 38, + height: size * 38, + semanticsLabel: e.emote![index].text!, + type: 'emote', + boxFit: BoxFit.contain, + ), + ), + ), + ); + }, ); }, ).toList(), diff --git a/lib/pages/live_emote/view.dart b/lib/pages/live_emote/view.dart index 71fe2b6f..b482eb22 100644 --- a/lib/pages/live_emote/view.dart +++ b/lib/pages/live_emote/view.dart @@ -60,46 +60,45 @@ class _LiveEmotePanelState extends State max(1, item.emoticons!.first.width! / 80); double heightFac = max(1, item.emoticons!.first.height! / 80); - return Padding( - padding: const EdgeInsets.fromLTRB(12, 6, 12, 0), - child: GridView.builder( - gridDelegate: - SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: widthFac * 40, - mainAxisExtent: heightFac * 40, - crossAxisSpacing: 8, - mainAxisSpacing: 8, - ), - itemCount: item.emoticons!.length, - itemBuilder: (context, index) { - return Material( - color: Colors.transparent, - child: InkWell( - borderRadius: BorderRadius.circular(8), - onTap: () { - if (item.pkgType == 3) { - widget.onChoose(item.emoticons![index]); - } else { - widget.onSendEmoticonUnique( - item.emoticons![index], - ); - } - }, - child: Padding( - padding: const EdgeInsets.all(6), - child: NetworkImgLayer( - boxFit: BoxFit.contain, - src: item.emoticons![index].url!, - width: widthFac * 38, - height: heightFac * 38, - type: 'emote', - quality: item.pkgType == 3 ? null : 80, - ), + return GridView.builder( + padding: const EdgeInsets.only( + left: 12, right: 12, bottom: 12), + gridDelegate: + SliverGridDelegateWithMaxCrossAxisExtent( + maxCrossAxisExtent: widthFac * 40, + mainAxisExtent: heightFac * 40, + crossAxisSpacing: 8, + mainAxisSpacing: 8, + ), + itemCount: item.emoticons!.length, + itemBuilder: (context, index) { + return Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(8), + onTap: () { + if (item.pkgType == 3) { + widget.onChoose(item.emoticons![index]); + } else { + widget.onSendEmoticonUnique( + item.emoticons![index], + ); + } + }, + child: Padding( + padding: const EdgeInsets.all(6), + child: NetworkImgLayer( + boxFit: BoxFit.contain, + src: item.emoticons![index].url!, + width: widthFac * 38, + height: heightFac * 38, + type: 'emote', + quality: item.pkgType == 3 ? null : 80, ), ), - ); - }, - ), + ), + ); + }, ); }, ).toList(), diff --git a/lib/pages/video/detail/reply_new/reply_page.dart b/lib/pages/video/detail/reply_new/reply_page.dart index 3d358024..e667c2a3 100644 --- a/lib/pages/video/detail/reply_new/reply_page.dart +++ b/lib/pages/video/detail/reply_new/reply_page.dart @@ -39,35 +39,31 @@ class ReplyPage extends CommonPublishPage { class _ReplyPageState extends CommonPublishPageState { final RxBool _syncToDynamic = false.obs; - Widget get child => MediaQuery.removePadding( - removeTop: true, - context: context, - child: GestureDetector( - onTap: Get.back, - child: LayoutBuilder( - builder: (context, constraints) { - bool isH = constraints.maxWidth > constraints.maxHeight; - late double padding = constraints.maxWidth * 0.12; - return Padding( - padding: EdgeInsets.symmetric(horizontal: isH ? padding : 0), - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.transparent, - body: GestureDetector( - onTap: () {}, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - buildInputView(), - buildImagePreview(), - buildPanelContainer(themeData.colorScheme.surface), - ], - ), + Widget get child => GestureDetector( + onTap: Get.back, + child: LayoutBuilder( + builder: (context, constraints) { + bool isH = constraints.maxWidth > constraints.maxHeight; + late double padding = constraints.maxWidth * 0.12; + return Padding( + padding: EdgeInsets.symmetric(horizontal: isH ? padding : 0), + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.transparent, + body: GestureDetector( + onTap: () {}, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + buildInputView(), + buildImagePreview(), + buildPanelContainer(themeData.colorScheme.surface), + ], ), ), - ); - }, - ), + ), + ); + }, ), );