opt: emote panel

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-30 12:03:47 +08:00
parent 15f4ae2567
commit 77e4a30bc5
3 changed files with 101 additions and 108 deletions

View File

@@ -42,50 +42,48 @@ class _EmotePanelState extends State<EmotePanel>
(e) { (e) {
int size = e.emote!.first.meta!.size!; int size = e.emote!.first.meta!.size!;
int type = e.type!; int type = e.type!;
return Padding( return GridView.builder(
padding: const EdgeInsets.fromLTRB(12, 6, 12, 0), padding: const EdgeInsets.only(
child: GridView.builder( left: 12, right: 12, bottom: 12),
gridDelegate: gridDelegate:
SliverGridDelegateWithMaxCrossAxisExtent( SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: maxCrossAxisExtent:
type == 4 ? 100 : (size == 1 ? 40 : 60), type == 4 ? 100 : (size == 1 ? 40 : 60),
crossAxisSpacing: 8, crossAxisSpacing: 8,
mainAxisSpacing: 8, mainAxisSpacing: 8,
mainAxisExtent: size == 1 ? 40 : 60, 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,
),
),
),
);
},
), ),
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(), ).toList(),

View File

@@ -60,46 +60,45 @@ class _LiveEmotePanelState extends State<LiveEmotePanel>
max(1, item.emoticons!.first.width! / 80); max(1, item.emoticons!.first.width! / 80);
double heightFac = double heightFac =
max(1, item.emoticons!.first.height! / 80); max(1, item.emoticons!.first.height! / 80);
return Padding( return GridView.builder(
padding: const EdgeInsets.fromLTRB(12, 6, 12, 0), padding: const EdgeInsets.only(
child: GridView.builder( left: 12, right: 12, bottom: 12),
gridDelegate: gridDelegate:
SliverGridDelegateWithMaxCrossAxisExtent( SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: widthFac * 40, maxCrossAxisExtent: widthFac * 40,
mainAxisExtent: heightFac * 40, mainAxisExtent: heightFac * 40,
crossAxisSpacing: 8, crossAxisSpacing: 8,
mainAxisSpacing: 8, mainAxisSpacing: 8,
), ),
itemCount: item.emoticons!.length, itemCount: item.emoticons!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Material( return Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
onTap: () { onTap: () {
if (item.pkgType == 3) { if (item.pkgType == 3) {
widget.onChoose(item.emoticons![index]); widget.onChoose(item.emoticons![index]);
} else { } else {
widget.onSendEmoticonUnique( widget.onSendEmoticonUnique(
item.emoticons![index], item.emoticons![index],
); );
} }
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),
child: NetworkImgLayer( child: NetworkImgLayer(
boxFit: BoxFit.contain, boxFit: BoxFit.contain,
src: item.emoticons![index].url!, src: item.emoticons![index].url!,
width: widthFac * 38, width: widthFac * 38,
height: heightFac * 38, height: heightFac * 38,
type: 'emote', type: 'emote',
quality: item.pkgType == 3 ? null : 80, quality: item.pkgType == 3 ? null : 80,
),
), ),
), ),
); ),
}, );
), },
); );
}, },
).toList(), ).toList(),

View File

@@ -39,35 +39,31 @@ class ReplyPage extends CommonPublishPage {
class _ReplyPageState extends CommonPublishPageState<ReplyPage> { class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
final RxBool _syncToDynamic = false.obs; final RxBool _syncToDynamic = false.obs;
Widget get child => MediaQuery.removePadding( Widget get child => GestureDetector(
removeTop: true, onTap: Get.back,
context: context, child: LayoutBuilder(
child: GestureDetector( builder: (context, constraints) {
onTap: Get.back, bool isH = constraints.maxWidth > constraints.maxHeight;
child: LayoutBuilder( late double padding = constraints.maxWidth * 0.12;
builder: (context, constraints) { return Padding(
bool isH = constraints.maxWidth > constraints.maxHeight; padding: EdgeInsets.symmetric(horizontal: isH ? padding : 0),
late double padding = constraints.maxWidth * 0.12; child: Scaffold(
return Padding( resizeToAvoidBottomInset: false,
padding: EdgeInsets.symmetric(horizontal: isH ? padding : 0), backgroundColor: Colors.transparent,
child: Scaffold( body: GestureDetector(
resizeToAvoidBottomInset: false, onTap: () {},
backgroundColor: Colors.transparent, child: Column(
body: GestureDetector( mainAxisAlignment: MainAxisAlignment.end,
onTap: () {}, children: [
child: Column( buildInputView(),
mainAxisAlignment: MainAxisAlignment.end, buildImagePreview(),
children: [ buildPanelContainer(themeData.colorScheme.surface),
buildInputView(), ],
buildImagePreview(),
buildPanelContainer(themeData.colorScheme.surface),
],
),
), ),
), ),
); ),
}, );
), },
), ),
); );